Skip to content

Vecnest

Vecnest is an open-source, browser-based vector database. Vectors are stored in IndexedDB and queried via cosine similarity. Optional Transformers.js embeddings let you add and search by text—no backend required.


Features

Feature Description
IndexedDB persistence Vectors and metadata survive reloads; same-origin storage.
HNSW indexing Approximate nearest neighbor search via WebAssembly for O(log n) performance.
Cosine similarity search Fast vector search with automatic HNSW optimization.
Optional embeddings Use addText / searchText with Transformers.js, or supply your own vectors.
Update & delete Update vectors and metadata by ID; delete by ID with optional HNSW rebuild.
Metadata filtering Filter search results with operators: $eq, $gt, $gte, $lt, $lte, $in, $nin.
Web Workers Background-thread search to keep the UI responsive.
React hooks useVecnest, useSearch, useSearchText for React 18+.
List & count List vectors with pagination; count total; storage estimate.

Quickest path

  1. Install: npm install vecnest
  2. Connect: await db.connect()
  3. Add & search: db.addText(...) and db.searchText(...)
  4. Done. No backend.
import { VecnestDB } from 'vecnest';

const db = new VecnestDB('my-db');
await db.connect();

await db.addText('Machine learning is a subset of AI.', { source: 'doc1' });
await db.addText('Neural networks learn from data.', { source: 'doc2' });

const results = await db.searchText('What is ML?', { k: 5 });
console.log(results); // [{ id, score, metadata }, ...]

db.close();

Documentation


Use cases

  • Offline RAG — Semantic search over your data without a server.
  • Local-first knowledge bases — Store and query documents entirely in the browser.
  • Privacy-preserving chat — Embed and search over user data on-device.
  • Prototypes & demos — Add vector search to a frontend without deploying a backend.

License

AGPL-3.0. See LICENSE in the repository.