Registry / vector-search / rvlite

rvlite

JSON →
library0.2.6jsnpmunverified

RvLite is a lightweight, embeddable vector database designed for universal execution across Node.js, browsers, and Edge environments. It leverages WebAssembly for high performance and portability, resulting in a small bundle size of approximately 850KB. The current stable version is 0.2.6. It supports multiple querying paradigms, including vector search with cosine, Euclidean, or dot product distance, standard SQL with extensions for distance operations, Cypher for property graph queries (Neo4j-compatible syntax), and SPARQL for RDF triple store interactions. Persistence options include file-based storage in Node.js and IndexedDB in browsers. The package provides a comprehensive SDK for programmatic interaction and a CLI for command-line operations and an interactive REPL, making it suitable for a wide range of AI-driven applications like RAG and knowledge graphs. Its key differentiators are its multi-query language support and extreme portability across JavaScript runtimes.

npm install rvlite
INSTALL
IMPORT
SIG · RVLITE
R
rvlite
vector-searchjavascriptv0.2.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createRvLite
import { createRvLite } from 'rvlite';
const createRvLite = require('rvlite').createRvLite;
Primary factory function to initialize a new RvLite database instance. Returns a Promise and requires `dimensions` as an option.
RvLite
import { RvLite } from 'rvlite';
import RvLite from 'rvlite';
The main RvLite class. Typically used for static methods such as `RvLite.load()` for persistence or for TypeScript type annotations.
RvLiteInstance
import type { RvLiteInstance } from 'rvlite';
TypeScript type definition for an initialized RvLite database instance, useful for explicit typing.

Demonstrates initializing a RvLite database, inserting vectors with metadata, performing semantic search, and executing SQL queries with vector distance. Includes an example of Node.js file-based persistence.

import { createRvLite } from 'rvlite'; import * as fs from 'fs'; // Required for Node.js persistence example async function runRvLiteExample() { // Create a new in-memory database instance with a specified vector dimension const db = await createRvLite({ dimensions: 384 }); console.log("RvLite database initialized with 384 dimensions."); // Insert a vector with associated metadata const docId1 = await db.insert([0.1, 0.2, 0.3, ...Array(381).fill(0)], { text: "The quick brown fox jumps over the lazy dog." }); console.log(`Inserted document with ID: ${docId1}`); // Insert another vector with a custom ID const docId2 = "custom-doc-id"; await db.insertWithId(docId2, [0.4, 0.5, 0.6, ...Array(381).fill(0)], { source: "my-blog", tags: ["nature", "animal"] }); console.log(`Inserted document with custom ID: ${docId2}`); // Perform a semantic search for similar vectors, retrieving top 2 results const queryVector = [0.15, 0.25, 0.35, ...Array(381).fill(0)]; const searchResults = await db.search(queryVector, 2); console.log("\nTop 2 search results:", searchResults); // Demonstrate SQL capabilities: Create a table and insert data await db.sql("CREATE TABLE documents (id TEXT PRIMARY KEY, content TEXT, embedding VECTOR)"); await db.sql(`INSERT INTO documents (id, content, embedding) VALUES ('sql-doc-1', 'SQL is a powerful language.', '[0.1, 0.1, 0.1, ${Array(381).fill(0).map(() => '0.0').join(', ')}]')`); console.log("\nSQL table 'documents' created and data inserted."); // Query using SQL with vector distance function const sqlResults = await db.sql(` SELECT id, content, distance(embedding, '[0.1, 0.2, 0.3, ${Array(381).fill(0).map(() => '0.0').join(', ')}]') as dist FROM documents ORDER BY dist ASC LIMIT 1 `); console.log("\nSQL query results with distance:", sqlResults); // Node.js persistence example: Export to file if (typeof window === 'undefined') { // Check if running in Node.js environment const state = await db.exportJson(); fs.writeFileSync('rvlite_db_backup.json', JSON.stringify(state, null, 2)); console.log("\nDatabase state exported to rvlite_db_backup.json"); } } runRvLiteExample().catch(console.error);
rvl --version
Debug
Known issues
breakingRvLite is currently at version 0.2.6. As a pre-1.0 release, the API surface may undergo breaking changes in future minor versions.
fix
Always review release notes when updating `rvlite` to identify and adapt to any API changes.
affects: <1.0.0
gotchaRvLite relies on WebAssembly (WASM) for its core functionality. Ensure your environment (Node.js, browser, Edge) supports WASM and that the `@ruvector/rvf-wasm` peer dependency is correctly installed and accessible.
fix
Verify that `node >= 18.0.0` is used for Node.js environments and ensure `@ruvector/rvf-wasm` is explicitly installed via `npm install @ruvector/rvf-wasm`.
affects: >=0.1.0
gotchaThe `createRvLite` and `RvLite.load` functions *require* the `dimensions` option to be provided, specifying the dimensionality of vectors stored in the database. All subsequent vector operations (insert, search) must use vectors of this exact dimension.
fix
Initialize the database with `createRvLite({ dimensions: YOUR_DIMENSION_NUMBER })` and ensure all vectors processed match this dimension (e.g., 384 for common embeddings).
affects: >=0.1.0
gotchaRvLite lists `@anthropic-ai/sdk` and `@ruvector/rvf-wasm` as peer dependencies. These must be manually installed by the user alongside `rvlite` to ensure full functionality, especially `@ruvector/rvf-wasm` which is critical.
fix
Run `npm install rvlite @ruvector/rvf-wasm @anthropic-ai/sdk` (if Anthropic features are needed) to satisfy all peer dependencies.
affects: >=0.1.0
Errors
Common errors & fixes
Error: WebAssembly module instantiation failed: CompileError: WebAssembly.instantiate(): expected a WebAssembly module
The core WebAssembly module for RvLite (`@ruvector/rvf-wasm`) failed to load or compile, often due to an incomplete or corrupted installation.
fix
Ensure `@ruvector/rvf-wasm` is correctly installed by running `npm uninstall @ruvector/rvf-wasm && npm install @ruvector/rvf-wasm` and verify Node.js version is `>=18`.
Error: Database dimensions must be specified during initialization.
The `createRvLite` or `RvLite.load` function was called without providing the `dimensions` option in the configuration object.
fix
Initialize your database instance with a `dimensions` property, e.g., `await createRvLite({ dimensions: 384 })`.
Error: Vector dimensions mismatch. Expected X, got Y.
An attempt was made to insert or query with a vector whose dimensionality does not match the `dimensions` the database was initialized with.
fix
Ensure all vectors passed to `db.insert()`, `db.insertWithId()`, or `db.search()` have the exact number of dimensions (X) that was provided during `createRvLite`.
TypeError: db.sql is not a function
Attempting to call query methods (like `.sql`, `.cypher`, `.sparql`) on an `RvLite` instance that has not been properly initialized or awaited.
fix
Ensure the database instance `db` is the result of an awaited call to `createRvLite` or `RvLite.load`, e.g., `const db = await createRvLite({ dimensions: 384 });`.
Upgrade
Version history
0.2.6latest on npm
Audit
Dependencies
@anthropic-ai/sdkoptionalPeer dependency, likely for integrating with Anthropic AI models or embedding services, used by advanced features.
@ruvector/rvf-wasmrequiredCrucial peer dependency providing the core WebAssembly components for vector operations, graph primitives, and database functionality.
Agent activity
51 hits · last 30 days
node
43
OpenAI (training)
1
Resources