A lightweight and educational vector database written in TypeScript, powered by ONNX Runtime, RocksDB, and modern indexing algorithms like HNSW.
This project is built for learning purposes. It helps developers understand how vector databases work by providing a minimal but extensible implementation using familiar tools from the Node.js ecosystem.
- Embedding text with ONNX models (e.g.,
all-MiniLM-L6-v2) - Persistent storage using RocksDB or SQLite
- Vector similarity search (brute-force, HNSW)
- Metadata filtering support
- CLI and programmatic API
- Type-safe validation with Zod
- Optional GPU acceleration via ONNX Runtime (CUDA)
| Component | Tech |
|---|---|
| Language | TypeScript |
| Embedding Engine | ONNX Runtime (onnxruntime-node) |
| Storage Engine | RocksDB (node-rocksdb) |
| Indexing | Brute-force, hnswlib-node |
| CLI Interface | commander |
| Validation | zod |
| Testing | vitest |
pnpm installAdd runtime dependencies:
pnpm add onnxruntime-node hnswlib-node rocksdb zod commanderAdd dev dependencies:
pnpm add -D typescript tsx vitest @types/nodeOptional: for GPU support (requires CUDA 11.8+):
pnpm add onnxruntime-node-gpuignite-vec-db/
βββ src/
β βββ cli/ # Command-line interface (commander)
β βββ db/ # Persistence (RocksDB / SQLite)
β βββ index/ # Indexing algorithms
β βββ models/ # ONNX Runtime embedder
β βββ core/ # Vector math, engine core
β βββ utils/
βββ onnx/ # ONNX models
βββ tests/ # Vitest-based test suite
βββ scripts/ # Helpers for data ingestion, etc.
βββ README.md
pnpm tsx src/cli/index.ts add "Artificial intelligence is transforming the world."pnpm tsx src/cli/index.ts search "Machine learning innovations"- Web UI with React
- WebAssembly support for browser-side DB
- Advanced filtering (facets, tags)
- Vector quantization (PQ / IVFPQ)
- Embedding model loading from HuggingFace
This project is not meant to compete with Pinecone, Weaviate, or FAISS β it's a clean-room reimplementation to demystify vector databases and give developers hands-on experience with embeddings, indexing, and similarity search at a low level.
Made with β€οΈ for learning.