{"id":16570,"library":"vectoriadb","title":"VectoriaDB","description":"VectoriaDB is a lightweight, production-ready, in-memory vector database designed for efficient semantic search in JavaScript and TypeScript environments. It is currently at stable version 2.2.0, with frequent minor releases in the 2.x line addressing performance, security, and new features like geospatial support. The library differentiates itself by providing a complete, privacy-first solution for vector search within a single Node.js process, leveraging `transformers.js` to generate embeddings locally using a default `Xenova/all-MiniLM-L6-v2` model. It features optimized HNSW indexing for sub-millisecond search on 100k+ documents, robust TypeScript support, and minimal dependencies, making it ideal for embedded search in applications, CLIs, or desktop environments where external vector database services are undesirable or unnecessary. Unlike distributed vector databases, VectoriaDB focuses on performance and simplicity for in-memory, single-node deployments.","status":"active","version":"2.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/agentfront/vectoriadb","tags":["javascript","vector-database","semantic-search","embeddings","in-memory","cosine-similarity","transformers","machine-learning","vector-search","typescript"],"install":[{"cmd":"npm install vectoriadb","lang":"bash","label":"npm"},{"cmd":"yarn add vectoriadb","lang":"bash","label":"yarn"},{"cmd":"pnpm add vectoriadb","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for local embedding generation using pre-trained transformer models.","package":"@huggingface/transformers","optional":false}],"imports":[{"note":"VectoriaDB is ESM-first and primarily used with ES module imports. Avoid CommonJS `require()` unless using dynamic imports.","wrong":"const VectoriaDB = require('vectoriadb')","symbol":"VectoriaDB","correct":"import { VectoriaDB } from 'vectoriadb'"},{"note":"Type import for specifying parameters when performing searches. Use `import type` for type-only imports to prevent bundling issues.","wrong":"import { SearchOptions } from 'vectoriadb'","symbol":"SearchOptions","correct":"import type { SearchOptions } from 'vectoriadb'"},{"note":"Type definition for the structure of documents stored in VectoriaDB, typically used with generics for metadata.","symbol":"Document","correct":"import type { Document } from 'vectoriadb'"}],"quickstart":{"code":"import { VectoriaDB } from 'vectoriadb';\n\n// Create and initialize the database\nconst db = new VectoriaDB();\nawait db.initialize();\n\n// Add documents\nawait db.add('doc-1', 'How to create a user account', {\n  id: 'doc-1',\n  category: 'auth',\n  author: 'Alice'\n});\n\nawait db.add('doc-2', 'Send email notifications to users', {\n  id: 'doc-2',\n  category: 'notifications',\n  author: 'Bob'\n});\n\n// Search\nconst results = await db.search('creating new accounts');\nconsole.log(results[0].metadata); // { id: 'doc-1', category: 'auth', ... }\nconsole.log(results[0].score); // 0.87","lang":"typescript","description":"This quickstart demonstrates how to initialize VectoriaDB, add new text documents with associated metadata, and perform a semantic search query."},"warnings":[{"fix":"Ensure your development and production environments use Node.js 18+ and TypeScript 5.0+.","message":"VectoriaDB requires Node.js version 18 or higher and TypeScript 5.0+ (if using TypeScript). Running with older versions may lead to compatibility issues or errors, particularly due to `transformers.js` dependencies.","severity":"gotcha","affected_versions":"<=2.2.0"},{"fix":"Upgrade to VectoriaDB v2.2.0 or newer. Ensure `db.close()` is called on your `VectoriaDB` instance to trigger proper resource disposal via the new `dispose` method in `EmbeddingService`.","message":"Versions prior to 2.2.0 might not properly release native ONNX resources, potentially leading to resource leaks or native mutex crashes during application shutdown, especially if `EmbeddingService` was used directly.","severity":"breaking","affected_versions":"<2.2.0"},{"fix":"Upgrade to VectoriaDB v2.1.3 or newer to benefit from the patched authentication vulnerability.","message":"Version 2.1.3 included a patch for a vulnerability in the authentication mechanism. Older versions might be susceptible to security risks if authentication features were used.","severity":"security","affected_versions":"<2.1.3"},{"fix":"Evaluate your use case carefully. For distributed, persistent, or extremely large-scale vector search, consider alternatives like Pinecone, Weaviate, or Milvus.","message":"VectoriaDB is designed for in-memory use cases and embedded search. It is not suitable for persistent storage (without external adapters), distributed architectures, or multi-million document scales requiring specialized distributed vector databases.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure your project is configured for ES modules (e.g., add `\"type\": \"module\"` to `package.json`) or use dynamic `import()` for CommonJS contexts.","cause":"CommonJS environment attempting to import an ES module-first package, or incorrect module resolution setup.","error":"Error: Cannot find module 'vectoriadb'"},{"fix":"Use the named import syntax: `import { VectoriaDB } from 'vectoriadb';`","cause":"Attempting to instantiate `VectoriaDB` incorrectly, often due to a default import when a named import is required, or CJS `require()` syntax in an ESM context.","error":"TypeError: VectoriaDB is not a constructor"},{"fix":"Upgrade to VectoriaDB v2.2.0 or newer, which explicitly sets `dtype` to 'fp32' in `EmbeddingService` to suppress these warnings.","cause":"Older versions of VectoriaDB (prior to v2.2.0) implicitly handling `dtype` for ONNX runtime, leading to warning messages.","error":"ONNX runtime warnings regarding 'dtype'"},{"fix":"Upgrade your Node.js environment to version 18 or newer.","cause":"Running VectoriaDB on an unsupported Node.js version, which is a dependency requirement for `transformers.js`.","error":"Error: Node.js version X.X.X is not supported. Please upgrade to Node.js 18 or higher."}],"ecosystem":"npm"}