VectoriaDB is a production-ready in-memory vector database built on transformers.js. Use it to surface the right tool, prompt, or document snippet from natural-language queries without shipping data to an external service.Documentation Index
Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
Use this file to discover all available pages before exploring further.
Features
Offline Embeddings
Embeddings run locally via transformers.js, so your data never leaves the server and you avoid API quotas.
Type-safe Metadata
Strong generics ensure every document you index keeps the same shape as your metadata interface.
Operational Guardrails
Built-in rate limits, batch validation, HNSW indexing, and storage adapters keep the index production ready.
When to Use VectoriaDB
- Tool discovery - Surface the right tool from natural-language queries
- Document search - Semantic search over documents, prompts, or code snippets
- Recommendation systems - Find similar items based on text embeddings
- Offline-first applications - No external API dependencies
The default Xenova
all-MiniLM-L6-v2 model is ~22 MB. The first initialization downloads and caches it under cacheDir; subsequent boots reuse the local copy.Installation
Quick Start
initialize() must run before add, search, or update. Calling it twice is safe because VectoriaDB short-circuits if it is already ready.
Core Concepts
Documents
Each document has:- id - Unique identifier
- text - Natural language text to embed
- metadata - Type-safe custom data
Embeddings
VectoriaDB generates embeddings locally using transformers.js. The default model isall-MiniLM-L6-v2 which provides good quality with fast inference.
Similarity Search
Search returns documents ranked by cosine similarity to your query. You can filter results by metadata and set minimum similarity thresholds.Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
modelName | string | 'Xenova/all-MiniLM-L6-v2' | Embedding model to use |
cacheDir | string | './.cache/transformers' | Model cache directory |
dimensions | number | Auto-detected | Vector dimensions |
defaultSimilarityThreshold | number | 0.3 | Minimum similarity score |
defaultTopK | number | 10 | Default results limit |
useHNSW | boolean | false | Enable HNSW index |
maxDocuments | number | 100000 | Max documents (DoS protection) |
maxDocumentSize | number | 1000000 | Max document size in chars |
maxBatchSize | number | 1000 | Max batch operation size |
verboseErrors | boolean | true | Enable detailed errors |
Related Documentation
Indexing
Adding and updating documents
Search
Querying the index
Persistence
Storage adapters
HNSW
Scaling to large datasets
TF-IDF
Zero-dependency alternative