A distributed vector database that learns. Store embeddings, query with Cypher, scale horizontally with Raft consensus, and let the index improve itself through Graph Neural Networks.
npx ruvectorAll-in-One Package: The core
ruvectorpackage includes everything โ vector search, graph queries, GNN layers, distributed clustering, AI routing, and WASM support. No additional packages needed.
Traditional vector databases just store and search. When you ask "find similar items," they return results but never get smarter. They don't scale horizontally. They can't route AI requests intelligently.
RuVector is different:
- Store vectors like any vector DB (embeddings from OpenAI, Cohere, etc.)
- Query with Cypher like Neo4j (
MATCH (a)-[:SIMILAR]->(b) RETURN b) - The index learns โ GNN layers make search results improve over time
- Scale horizontally โ Raft consensus, multi-master replication, auto-sharding
- Route AI requests โ Semantic routing and FastGRNN neural inference for LLM optimization
- Compress automatically โ 2-32x memory reduction with adaptive tiered compression
- Run anywhere โ Node.js, browser (WASM), HTTP server, or native Rust
Think of it as: Pinecone + Neo4j + PyTorch + etcd in one Rust package.
# Install
npm install ruvector
# Or try instantly
npx ruvector| Feature | What It Does | Why It Matters |
|---|---|---|
| Vector Search | HNSW index, <0.5ms latency, SIMD acceleration | Fast enough for real-time apps |
| Cypher Queries | MATCH, WHERE, CREATE, RETURN |
Familiar Neo4j syntax |
| GNN Layers | Neural network on index topology | Search improves with usage |
| Hyperedges | Connect 3+ nodes at once | Model complex relationships |
| Metadata Filtering | Filter vectors by properties | Combine semantic + structured search |
| Collections | Namespace isolation, multi-tenancy | Organize vectors by project/user |
| Feature | What It Does | Why It Matters |
|---|---|---|
| Raft Consensus | Leader election, log replication | Strong consistency for metadata |
| Auto-Sharding | Consistent hashing, shard migration | Scale to billions of vectors |
| Multi-Master Replication | Write to any node, conflict resolution | High availability, no SPOF |
| Snapshots | Point-in-time backups, incremental | Disaster recovery |
| Cluster Metrics | Prometheus-compatible monitoring | Observability at scale |
cargo add ruvector-raft ruvector-cluster ruvector-replication| Feature | What It Does | Why It Matters |
|---|---|---|
| Tensor Compression | f32โf16โPQ8โPQ4โBinary | 2-32x memory reduction |
| Differentiable Search | Soft attention k-NN | End-to-end trainable |
| Semantic Router | Route queries to optimal endpoints | Multi-model AI orchestration |
| Tiny Dancer | FastGRNN neural inference | Optimize LLM inference costs |
| Adaptive Routing | Learn optimal routing strategies | Minimize latency, maximize accuracy |
| Feature | What It Does | Why It Matters |
|---|---|---|
| HTTP/gRPC Server | REST API, streaming support | Easy integration |
| WASM/Browser | Full client-side support | Run AI search offline |
| Node.js Bindings | Native napi-rs bindings | No serialization overhead |
| FFI Bindings | C-compatible interface | Use from Python, Go, etc. |
| CLI Tools | Benchmarking, testing, management | DevOps-friendly |
Real benchmark results on standard hardware:
| Operation | Dimensions | Time | Throughput |
|---|---|---|---|
| HNSW Search (k=10) | 384 | 61ยตs | 16,400 QPS |
| HNSW Search (k=100) | 384 | 164ยตs | 6,100 QPS |
| Cosine Distance | 1536 | 143ns | 7M ops/sec |
| Dot Product | 384 | 33ns | 30M ops/sec |
| Batch Distance (1000) | 384 | 237ยตs | 4.2M/sec |
Production-validated metrics at hyperscale:
| Metric | Value | Details |
|---|---|---|
| Concurrent Streams | 500M baseline | Burst capacity to 25B (50x) |
| Global Latency (p50) | <10ms | Multi-region + CDN edge caching |
| Global Latency (p99) | <50ms | Cross-continental with failover |
| Availability SLA | 99.99% | 15 regions, automatic failover |
| Cost per Stream/Month | $0.0035 | 60% optimized ($1.74M total at 500M) |
| Regions | 15 global | Americas, EMEA, APAC coverage |
| Throughput per Region | 100K+ QPS | Adaptive batching enabled |
| Memory Efficiency | 2-32x compression | Tiered hot/warm/cold storage |
| Index Build Time | 1M vectors/min | Parallel HNSW construction |
| Replication Lag | <100ms | Multi-master async replication |
| Feature | RuVector | Pinecone | Qdrant | Milvus | ChromaDB |
|---|---|---|---|---|---|
| Latency (p50) | 61ยตs | ~2ms | ~1ms | ~5ms | ~50ms |
| Memory (1M vec) | 200MB* | 2GB | 1.5GB | 1GB | 3GB |
| Graph Queries | โ Cypher | โ | โ | โ | โ |
| Hyperedges | โ | โ | โ | โ | โ |
| Self-Learning (GNN) | โ | โ | โ | โ | โ |
| AI Agent Routing | โ Tiny Dancer | โ | โ | โ | โ |
| Raft Consensus | โ | โ | โ | โ | โ |
| Multi-Master Replication | โ | โ | โ | โ | โ |
| Auto-Compression | โ 2-32x | โ | โ | โ | โ |
| Browser/WASM | โ | โ | โ | โ | โ |
| Differentiable | โ | โ | โ | โ | โ |
| Open Source | โ MIT | โ | โ | โ | โ |
*With PQ8 compression. Benchmarks on Apple M2 / Intel i7.
Traditional vector search:
Query โ HNSW Index โ Top K Results
RuVector with GNN:
Query โ HNSW Index โ GNN Layer โ Enhanced Results
โ โ
โโโโโ learns from โโโโโโ
The GNN layer:
- Takes your query and its nearest neighbors
- Applies multi-head attention to weigh which neighbors matter
- Updates representations based on graph structure
- Returns better-ranked results
Over time, frequently-accessed paths get reinforced, making common queries faster and more accurate.
The architecture adapts to your data. Hot paths get full precision and maximum compute. Cold paths compress automatically and throttle resources. Recent data stays crystal clear; historical data optimizes itself in the background.
Think of it like your computer's memory hierarchyโfrequently accessed data lives in fast cache, while older files move to slower, denser storage. RuVector does this automatically for your vectors:
| Access Frequency | Format | Compression | What Happens |
|---|---|---|---|
| Hot (>80%) | f32 | 1x | Full precision, instant retrieval |
| Warm (40-80%) | f16 | 2x | Slight compression, imperceptible latency |
| Cool (10-40%) | PQ8 | 8x | Smart quantization, ~1ms overhead |
| Cold (1-10%) | PQ4 | 16x | Heavy compression, still fast search |
| Archive (<1%) | Binary | 32x | Maximum density, batch retrieval |
No configuration needed. RuVector tracks access patterns and automatically promotes/demotes vectors between tiers. Your hot data stays fast; your cold data shrinks.
RAG (Retrieval-Augmented Generation)
const context = ruvector.search(questionEmbedding, 5);
const prompt = `Context: ${context.join('\n')}\n\nQuestion: ${question}`;Recommendation Systems
MATCH (user:User)-[:VIEWED]->(item:Product)
MATCH (item)-[:SIMILAR_TO]->(rec:Product)
RETURN rec ORDER BY rec.score DESC LIMIT 10Knowledge Graphs
MATCH (concept:Concept)-[:RELATES_TO*1..3]->(related)
RETURN related| Platform | Command |
|---|---|
| npm | npm install ruvector |
| Browser/WASM | npm install ruvector-wasm |
| Rust | cargo add ruvector-core ruvector-graph ruvector-gnn |
| Topic | Link |
|---|---|
| Getting Started | docs/guide/GETTING_STARTED.md |
| Cypher Reference | docs/api/CYPHER_REFERENCE.md |
| GNN Architecture | docs/gnn-layer-implementation.md |
| Node.js API | crates/ruvector-gnn-node/README.md |
| WASM API | crates/ruvector-gnn-wasm/README.md |
| Performance Tuning | docs/optimization/PERFORMANCE_TUNING_GUIDE.md |
| API Reference | docs/api/ |
All crates are published to crates.io under the ruvector-* namespace.
| Crate | Description | crates.io |
|---|---|---|
| ruvector-core | Vector database engine with HNSW indexing | |
| ruvector-collections | Collection and namespace management | |
| ruvector-filter | Vector filtering and metadata queries | |
| ruvector-metrics | Performance metrics and monitoring | |
| ruvector-snapshot | Snapshot and persistence management |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-graph | Hypergraph database with Neo4j-style Cypher | |
| ruvector-graph-node | Node.js bindings for graph operations | |
| ruvector-graph-wasm | WASM bindings for browser graph queries | |
| ruvector-gnn | Graph Neural Network layers and training | |
| ruvector-gnn-node | Node.js bindings for GNN inference | |
| ruvector-gnn-wasm | WASM bindings for browser GNN |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-cluster | Cluster management and coordination | |
| ruvector-raft | Raft consensus implementation | |
| ruvector-replication | Data replication and synchronization |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-tiny-dancer-core | FastGRNN neural inference for AI routing | |
| ruvector-tiny-dancer-node | Node.js bindings for AI routing | |
| ruvector-tiny-dancer-wasm | WASM bindings for browser AI routing |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-router-core | Core semantic routing engine | |
| ruvector-router-cli | CLI for router testing and benchmarking | |
| ruvector-router-ffi | FFI bindings for other languages | |
| ruvector-router-wasm | WASM bindings for browser routing |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-node | Main Node.js bindings (napi-rs) | |
| ruvector-wasm | Main WASM bindings for browsers | |
| ruvector-cli | Command-line interface | |
| ruvector-server | HTTP/gRPC server |
| Package | Description | npm |
|---|---|---|
| ruvector | All-in-one CLI & package (vectors, graphs, GNN) | |
| @ruvector/core | Core vector database with native Rust bindings | |
| @ruvector/gnn | Graph Neural Network layers & tensor compression | |
| @ruvector/graph-node | Hypergraph database with Cypher queries | |
| @ruvector/tiny-dancer | FastGRNN neural inference for AI agent routing | |
| @ruvector/router | Semantic router with HNSW vector search | |
| @ruvector/agentic-synth | Synthetic data generator for AI/ML |
Platform-specific native bindings (auto-detected):
@ruvector/node-linux-x64-gnu,@ruvector/node-linux-arm64-gnu,@ruvector/node-darwin-x64,@ruvector/node-darwin-arm64,@ruvector/node-win32-x64-msvc@ruvector/gnn-linux-x64-gnu,@ruvector/gnn-linux-arm64-gnu,@ruvector/gnn-darwin-x64,@ruvector/gnn-darwin-arm64,@ruvector/gnn-win32-x64-msvc@ruvector/tiny-dancer-linux-x64-gnu,@ruvector/tiny-dancer-linux-arm64-gnu,@ruvector/tiny-dancer-darwin-x64,@ruvector/tiny-dancer-darwin-arm64,@ruvector/tiny-dancer-win32-x64-msvc@ruvector/router-linux-x64-gnu,@ruvector/router-linux-arm64-gnu,@ruvector/router-darwin-x64,@ruvector/router-darwin-arm64,@ruvector/router-win32-x64-msvc
| Package | Description | Status |
|---|---|---|
| @ruvector/wasm | WASM fallback for core vector DB | Crate ready |
| @ruvector/gnn-wasm | WASM fallback for GNN | Crate ready |
| @ruvector/graph-wasm | WASM fallback for graph DB | Crate ready |
| @ruvector/cluster | Distributed clustering | Crate ready |
| @ruvector/server | HTTP/gRPC server mode | Crate ready |
See GitHub Issue #20 for multi-platform npm package roadmap.
# Install all-in-one package
npm install ruvector
# Or install individual packages
npm install @ruvector/core @ruvector/gnn @ruvector/graph-node
# List all available packages
npx ruvector installconst ruvector = require('ruvector');
// Vector search
const db = new ruvector.VectorDB(128);
db.insert('doc1', embedding1);
const results = db.search(queryEmbedding, 10);
// Graph queries (Cypher)
db.execute("CREATE (a:Person {name: 'Alice'})-[:KNOWS]->(b:Person {name: 'Bob'})");
db.execute("MATCH (p:Person)-[:KNOWS]->(friend) RETURN friend.name");
// GNN-enhanced search
const layer = new ruvector.GNNLayer(128, 256, 4);
const enhanced = layer.forward(query, neighbors, weights);
// Compression (2-32x memory savings)
const compressed = ruvector.compress(embedding, 0.3);
// Tiny Dancer: AI agent routing
const router = new ruvector.Router();
const decision = router.route(candidates, { optimize: 'cost' });cargo add ruvector-graph ruvector-gnnuse ruvector_graph::{GraphDB, NodeBuilder};
use ruvector_gnn::{RuvectorLayer, differentiable_search};
let db = GraphDB::new();
let doc = NodeBuilder::new("doc1")
.label("Document")
.property("embedding", vec![0.1, 0.2, 0.3])
.build();
db.create_node(doc)?;
// GNN layer
let layer = RuvectorLayer::new(128, 256, 4, 0.1);
let enhanced = layer.forward(&query, &neighbors, &weights);use ruvector_raft::{RaftNode, RaftNodeConfig};
use ruvector_cluster::{ClusterManager, ConsistentHashRing};
use ruvector_replication::{SyncManager, SyncMode};
// Configure a 5-node Raft cluster
let config = RaftNodeConfig {
node_id: "node-1".into(),
cluster_members: vec!["node-1", "node-2", "node-3", "node-4", "node-5"]
.into_iter().map(Into::into).collect(),
election_timeout_min: 150, // ms
election_timeout_max: 300, // ms
heartbeat_interval: 50, // ms
};
let raft = RaftNode::new(config);
// Auto-sharding with consistent hashing (150 virtual nodes per real node)
let ring = ConsistentHashRing::new(64, 3); // 64 shards, replication factor 3
let shard = ring.get_shard("my-vector-key");
// Multi-master replication with conflict resolution
let sync = SyncManager::new(SyncMode::SemiSync { min_replicas: 2 });crates/
โโโ ruvector-core/ # Vector DB engine (HNSW, storage)
โโโ ruvector-graph/ # Graph DB + Cypher parser + Hyperedges
โโโ ruvector-gnn/ # GNN layers, compression, training
โโโ ruvector-tiny-dancer-core/ # AI agent routing (FastGRNN)
โโโ ruvector-*-wasm/ # WebAssembly bindings
โโโ ruvector-*-node/ # Node.js bindings (napi-rs)
We welcome contributions! See CONTRIBUTING.md.
# Run tests
cargo test --workspace
# Run benchmarks
cargo bench --workspace
# Build WASM
cargo build -p ruvector-gnn-wasm --target wasm32-unknown-unknownMIT License โ free for commercial and personal use.