Skip to main content

Getting Started with Lyra

Lyra is an immutable, runtime-agnostic, edge and in-memory full-text search engine capable of working both on client and server.

Through the implementation of an optimized prefix tree and some clever tweaks, Lyra can perform searches through millions of entries in microseconds.

Requirements

A JavaScript runtime is the only requirement. Lyra has been designed to work on any runtime and has no dependencies.

Installation

Lyra can be installed on Node.js, Bun, and Deno.

Node.js and Bun

Lyra can be installed using either npm, yarn, or pnpm.

npm
npm install @lyrasearch/lyra
yarn
yarn add @lyrasearch/lyra
pnpm
pnpm add @lyrasearch/lyra

Deno

Deno
import * as lyra from "https://deno.land/x/lyra@0.0.4/src/lyra.ts";

Please note: from now on, we'll be using Node.js to illustrate how to work with Lyra, thought the APIs are the same as for Deno.

Start working with Lyra

Once Lyra is installed, it can easily be imported it in any project.

esm

import { create, insert, remove, search } from "@lyrasearch/lyra";

cjs

const { create, insert, remove, search } = require("@lyrasearch/lyra");

Lyra exposes its own types, ESM modules and CJS modules.