A fully in-browser vector database implementation with semantic search capabilities. Here's the vector DB in 300 lines of code
You can try it here.
- Pure Browser Implementation - No backend required, runs entirely in your browser
- Persistent Storage - Uses IndexedDB to store vectors across sessions
- Embeddings - Powered by HuggingFace Transformers.js (bge-small-en-v1.5))
- Cosine Similarity - Fast vector similarity search with configurable top-K results
- Auto-chunking - Automatically splits documents by paragraphs for better search granularity
- TypeScript
- IndexedDB - Browser-native persistent storage of vectors & metadata
- React & Tailwind - For UI
- Transformers.js - Client-side embeddings generation
- Vite - Fast development & build
# Install dependencies
pnpm install
# Run development server
pnpm dev
# Build for production
pnpm build
- Add Documents - Paste text, it's automatically split into paragraphs and embedded
- Search - Query using natural language
- Get Results - Ranked by cosine similarity with configurable top-K
All embeddings are generated client-side and stored in IndexedDB for instant recall.