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¶
- Install:
npm install vecnest - Connect:
await db.connect() - Add & search:
db.addText(...)anddb.searchText(...) - 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¶
- Installation — Requirements, install, and peer dependencies.
- Quick start — Minimal JavaScript and React examples.
- Vecnest UI setup — Add the inspector (DBs, docs, 3D) to your app.
- Guide — Step-by-step: JavaScript API, React hooks, CRUD, search.
- API reference — Full API with code snippets.
- Metadata filtering — Filter syntax and examples.
- Architecture — Storage, search, embeddings, SDK design.
- Examples — Demo, JS-only, and RAG vanilla/React examples.
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.