Skip to content

zvec-ai/zvec-node

Repository files navigation

Zvec Node.js Binding

🚀 Quickstart | 🏠 Home | 📚 Docs | 🎮 Discord | 🐦 X (Twitter)

The official Node.js binding for Zvec — a lightweight, lightning-fast, in-process vector database.

💫 Features

  • Blazing Fast: Searches billions of vectors in milliseconds.
  • Simple, Just Works: Install with npm i @zvec/zvec and start searching in seconds. Pure local, no servers, no config, no fuss.
  • Dense + Sparse Vectors: Work with both dense and sparse embeddings, with native support for multi-vector queries in a single call.
  • Hybrid Search: Combine semantic similarity with structured filters for precise results.
  • Durable Storage: Write-ahead logging (WAL) guarantees persistence — data is never lost, even on process crash or power failure.
  • Concurrent Access: Multiple processes can read the same collection simultaneously; writes are single-process exclusive.
  • Runs Anywhere: As an in-process library, Zvec runs wherever your code runs — notebooks, servers, CLI tools, or even edge devices.

📦 Installation

npm install @zvec/zvec

✅ Supported Platforms

  • Linux (x86_64, ARM64)
  • macOS (ARM64)
  • Windows (x86_64)

🛠️ Building from Source

If you prefer to build Zvec from source, please check the Building from Source guide.

⚡ One-Minute Example

import { ZVecCreateAndOpen, ZVecCollectionSchema, ZVecDataType } from "@zvec/zvec";

// Define collection schema
const schema = new ZVecCollectionSchema({
  name: "example",
  vectors: { name: "embedding", dataType: ZVecDataType.VECTOR_FP32, dimension: 4 },
});

// Create collection
const collection = ZVecCreateAndOpen("./zvec_example", schema);

// Insert documents
collection.insertSync([
  { id: "doc_1", vectors: { embedding: [0.1, 0.2, 0.3, 0.4] } },
  { id: "doc_2", vectors: { embedding: [0.2, 0.3, 0.4, 0.1] } },
]);

// Search by vector similarity
const results = collection.querySync({
  fieldName: "embedding",
  vector: [0.4, 0.3, 0.3, 0.1],
  topk: 10,
});

// Results: array of { id, score, vectors, fields }, sorted by relevance
console.log(results);

About

High-performance Node.js bindings for Zvec, a lightweight, lightning-fast, in-process vector database

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors