{"id":18768,"library":"ruvector","title":"RuVector","description":"RuVector is a self-learning vector database for Node.js built in Rust, offering sub-millisecond hybrid search, Graph RAG, FlashAttention-3, HNSW, and DiskANN, with over 50 attention mechanisms. Current stable version is 2.2.0, with frequent releases (weekly to monthly). Key differentiators: single npm package, no external services required, native Node.js performance via Rust native bindings with WASM fallback, TypeScript-first API, and built-in self-learning capabilities. It integrates deeply with the Claude Code ecosystem and provides enterprise-grade features like ONNX embeddings, AST analysis, and security scanning.","status":"active","version":"0.2.23","language":"javascript","source_language":"en","source_url":"https://github.com/ruvnet/ruvector","tags":["javascript","vector","database","vector-database","vector-search","similarity-search","semantic-search","embeddings","hnsw","typescript"],"install":[{"cmd":"npm install ruvector","lang":"bash","label":"npm"},{"cmd":"yarn add ruvector","lang":"bash","label":"yarn"},{"cmd":"pnpm add ruvector","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides neural attention and memory subsystems required by the core vector operations","package":"@ruvector/pi-brain","optional":false},{"reason":"Handles intelligent agent routing and query distribution across vector indexes","package":"@ruvector/router","optional":false},{"reason":"Enables LLM integration for Graph RAG and natural language query parsing","package":"@ruvector/ruvllm","optional":false},{"reason":"Provides DiskANN and Vamana graph-based ANN for large-scale persistent storage","package":"@ruvector/diskann","optional":false}],"imports":[{"note":"ESM-only since v2.0. The main entry point is @ruvector/attention, not ruvector.","wrong":"const RuVector = require('@ruvector/attention')","symbol":"default","correct":"import RuVector from '@ruvector/attention'"},{"note":"Named export available from @ruvector/attention. Requires peer dep @ruvector/router.","wrong":"import { HybridSearch } from 'ruvector'","symbol":"HybridSearch","correct":"import { HybridSearch } from '@ruvector/attention'"},{"note":"RuVector provides its own HNSW implementation; do not mix with hnswlib.","wrong":"import { HNSWIndex } from 'hnswlib'","symbol":"HNSWIndex","correct":"import { HNSWIndex } from '@ruvector/attention'"}],"quickstart":{"code":"import RuVector, { HNSWIndex, HybridSearch, FlashAttention } from '@ruvector/attention'\n\n// Create a new vector database instance\nconst db = new RuVector({ dimension: 384, metric: 'cosine' })\n\n// Add vectors with metadata\nconst id1 = await db.add([0.1, 0.2, 0.3, /* ... 384-d vector */], { label: 'doc1' })\nconst id2 = await db.add([0.4, 0.5, 0.6, /* ... */], { label: 'doc2' })\n\n// Perform hybrid search (sparse + dense fusion)\nconst hybrid = new HybridSearch(db, { alpha: 0.5 })\nconst results = await hybrid.search([0.1, 0.2, 0.3], { topK: 5, rerank: true })\nconsole.log('Hybrid results:', results)\n\n// Use FlashAttention-3 for exact nearest neighbor\nconst attn = new FlashAttention({ heads: 8, headDim: 64 })\nconst scores = await attn.compute(queryVectors, keyVectors)\n\n// Build HNSW index for fast approximate search\nconst index = new HNSWIndex({ dimension: 384, M: 16, efConstruction: 200 })\nawait index.build(vectors)\nconst neighbors = await index.search(query, 10)\nconsole.log('ANN neighbors:', neighbors)\n\n// Persist to disk using DiskANN\nawait db.save('./my_index.ruv')","lang":"typescript","description":"Demonstrates core operations: creating a vector database, adding vectors, hybrid search, FlashAttention-3, and HNSW indexing."},"warnings":[{"fix":"Change imports to use '@ruvector/attention' instead of 'ruvector'.","message":"Since v2.0.0, the package has moved from default export 'ruvector' to package '@ruvector/attention'. All imports from 'ruvector' will fail.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade Node.js to version 18 or later.","message":"Node.js <18.0.0 is no longer supported. Engine requirement is >=18.0.0.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Migrate to @ruvector/attention.","message":"The 'ruvector' package on npm is legacy and will not receive updates. Use '@ruvector/attention' for all new projects.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure your platform is supported or set environment variable RUVECTOR_FORCE_WASM=1 to force WASM.","message":"The package uses native Node.js addons (N-API) by default. If they fail to load, it falls back to WASM, which may be slower and lack some features (e.g., DiskANN).","severity":"gotcha","affected_versions":"*"},{"fix":"Always ensure both sparse (e.g., SPLADE) and dense indexes are added to the database before using HybridSearch.","message":"HybridSearch requires both 'alpha' parameter in constructor and both sparse/dense indexes to be built. Missing one will cause silent fallback to dense-only.","severity":"gotcha","affected_versions":">=2.1.0"},{"fix":"Update calls to pass an object with 'vector' and 'metadata' keys.","message":"In v0.x to v1.x migration, the API for adding vectors changed from 'db.add(vector, metadata)' to 'db.add({ vector, metadata })' as an object parameter.","severity":"breaking","affected_versions":">=1.0.0 <2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install the correct package: npm install @ruvector/attention","cause":"Package not installed or wrong package name used.","error":"Error: Cannot find module '@ruvector/attention' or 'ruvector'"},{"fix":"Use import syntax or set type: module in package.json. Alternatively, use dynamic import().","cause":"Using CommonJS require() with an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Use import RuVector from '@ruvector/attention' (default export) and ensure version >=2.0.0.","cause":"Importing the wrong default export, possibly from an older version or wrong subpackage.","error":"TypeError: RuVector is not a constructor"},{"fix":"Set RUVECTOR_FORCE_WASM=1 and allocate more memory via WebAssembly.Memory, or install platform-specific native package.","cause":"Native addon failed to load, falling back to WASM with insufficient memory allocation.","error":"Uncaught RuntimeError: memory access out of bounds (WASM)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}