Skip to content

vanedb/vanedb-cpp

Repository files navigation

VaneDB

Embeddable vector database for edge AI

Build codecov License: MIT C++20 Python 3.9+


Header-only C++20 vector database with SIMD acceleration. Runs on Linux, macOS, Windows, iOS, and Android.

Two implementations. VaneDB is maintained as both C++ and Rust under the @vanedb org. This repo is the C++ header-only version — drop a header into any CMake project, no Rust toolchain needed. For the Rust crate (with Python/PyO3 and WASM bindings), see vanedb/vanedb.

Why VaneDB?

Feature VaneDB FAISS hnswlib Pinecone
Header-only Yes No No N/A
Mobile/Edge Native No Partial No
Dependencies Zero Many Few Cloud
Binary size <100KB 200MB+ ~1MB N/A
GPU (Metal) Yes No No N/A

Perfect for: Mobile AI apps, Obsidian/Logseq plugins, edge devices, offline-first applications.

Features

  • SIMD-optimized: ARM NEON, x86 AVX2 (~100ns for 768d vectors)
  • Multiple indexes: Brute-force, HNSW, Memory-mapped
  • GPU acceleration: Metal (Apple Silicon). CUDA (NVIDIA) is experimental — kernel source only, not yet wired into the build
  • Thread-safe: Concurrent reads with std::shared_mutex
  • Python bindings: NumPy integration, GIL-safe

Quick Start

#include "core/vector_store.h"

vanedb::VectorStore store(768, vanedb::DistanceMetric::COSINE);
store.add(1, embedding);
auto results = store.search(query, 5);  // top-5 nearest neighbors
#include "core/hnsw_index.h"

vanedb::HNSWIndex index(768, vanedb::DistanceMetric::COSINE, 100000);
index.add(1, embedding);
auto results = index.search(query, 5);
index.save("index.bin");
import vanedb_py as vanedb
import numpy as np

index = vanedb.HNSWIndex(768, vanedb.DistanceMetric.COSINE)
index.add(1, np.random.rand(768).astype(np.float32))
ids, distances = index.search(query, 10)

Build

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failure

Documentation

License

MIT License - see LICENSE for details.