latticedb logo

latticedb

Embedded single-file knowledge graph database with vector search and full-text search for AI/RAG apps

ZigDatabasesRAGZigMIT 603 28
Website GitHub

What is it?

What it is

Embedded property‑graph database with native vector and full‑text indexing.

Why it exists

Provides a zero‑config, single‑file, embedded database enabling local applications to query graph relationships, semantic vectors, and textual content through a unified query layer.

Who should use it

Embedded application developers, AI/ML engineers building local RAG pipelines, researchers and prototypists working with connected data on a single machine, and local-first app teams.

Who should avoid it

Multi-user networked applications requiring concurrent writes, tabular-data-focused projects better suited for relational databases, systems needing distributed scaling or clustering, developers dependent on full Cypher features like OPTIONAL MATCH, and teams requiring mature operational tooling and ecosystems.

Stars over time

+15 stars in the last 1 day

603588
Aug 30, 2026Aug 31, 2026

How it works

A quick walkthrough in plain English

How latticedb works

Step 1 of 3

You interact with it

Open latticedb, send a request, or connect it to your stack.

Features

Graph data model with nodes, edges, labels, and arbitrary properties
ACID transactions with commit/rollback and crash recovery via write-ahead log
Multi-hop traversal and variable-length path queries (e.g., *1..3)
HNSW approximate nearest neighbor vector search with configurable M and ef
BM25 full-text search with tokenization, stemming, and fuzzy search support
Cypher query language implementation with MATCH, WHERE, RETURN, CREATE, DELETE, SET, REMOVE
Vector distance operator (<=) and full-text search operator (@@) in queries
Parameterized queries with $name syntax
Single-file embedded storage with zero configuration
Write-ahead log (WAL) for durability and crash recovery
Durable named streams and graph changefeeds sharing the transaction path
In-memory database mode (:memory:) touching no files
Online freelist reuse and lattice compact for safe physical tail reclamation
Hot backup capability (lattice backup) without closing the database
Serialize database to bytes and open from bytes for object storage workflows
Clean C API with bindings for Python, TypeScript, Go, and Java
Bulk vector node insertion for fast ingestion
Configurable HNSW parameters (M, ef_construction, ef_search)

Advantages

  • Sub-microsecond node lookups (0.13 μs) matching embedded key-value performance
  • Fast vector search: 0.83 ms mean latency at 1M vectors with 100% recall@10
  • Efficient full-text search: 19 μs latency on 100-doc index with BM25 ranking
  • Zero-configuration, single-file database with no server or network required
  • ACID guarantees with WAL-backed durability and automatic crash recovery
  • Outperforms SQLite and RocksDB in point lookup benchmarks (23x faster than SQLite on disk)
  • Competitive vector search latency versus server-based systems (FAISS, Weaviate, Qdrant) without network overhead
  • Sub-linear O(log N) vector search scaling with 99–100% recall@10 across 1K–1M vectors
  • Unified query layer combining graph traversal, vector similarity, and BM25 full-text search
  • Durable changefeeds and named streams integrated alongside graph writes in the WAL path
  • Optimized for local-first, single-process applications and embedded knowledge tools
  • MIT-licensed open source with active development and comprehensive documentation

Disadvantages

  • Embedded single-writer model: only one process can write at a time; not suitable for concurrent multi-client writes over a network
  • No network server or clustering: data confined to one machine; cannot scale beyond a single node or shard across multiple machines
  • Full Cypher language not complete: missing OPTIONAL MATCH, CALL procedures, and some advanced Cypher features
  • Data model and query patterns optimized for relationship-heavy workloads; less natural for fundamentally tabular or row-column data patterns
  • Limited mature tooling and ecosystem: no visual admin dashboard, limited monitoring, fewer third-party integrations compared to Neo4j or PostgreSQL
  • Hash-based embeddings are placeholders: default hash_embed produces deterministic but non-semantic vectors; external models (Ollama/OpenAI) required for meaningful similarity search
  • Not ideal for tabular or row-column data: relational databases may be simpler and equally fast for sales records, user accounts, or time-series workloads
  • No distributed queries, sharding, or multi-node replicas supported: backup is file-level ship, not true replication or fault-tolerant clustering

Installation

FAQ

What is LatticeDB and what problem does it solve?

LatticeDB is an embedded property-graph database written in Zig that combines graph traversal, vector similarity search (HNSW), and full-text search (BM25) into a single-file system. It solves the challenge of querying related, semantic, and textual data together without needing separate services.

How do I get started with LatticeDB?

LatticeDB requires no configuration—just open a single file. For installation, use the CLI: `curl -fsSL https://raw.githubusercontent.com/jeffhajewski/latticedb/main/dist/install.sh | bash`, or install via pip: `pip install latticedb`. Python, TypeScript, Go, and Java bindings are available for programmatic access.

Can I use LatticeDB with Python?

Yes. The Python binding allows you to create databases, write nodes and edges, set vectors, and execute Cypher queries. Example code demonstrates creating a knowledge graph with authors, documents, and chunks, then performing vector search combined with graph traversal and full-text search.

How does vector search work in LatticeDB?

LatticeDB uses HNSW (Hierarchical Navigable Small World) algorithm for approximate nearest neighbor search. Vectors are stored as embeddings and indexed using cosine similarity. Queries compare the query vector to stored ones using the `<=>` operator (cosine distance). At 1 million vectors, it achieves 0.83 ms mean latency with 100% recall@10.

Is LatticeDB suitable for multi-user or multi-process scenarios?

No. LatticeDB follows a single-writer model—it is designed for one owning process on one machine. While it supports concurrent read operations within the same process, it is not intended for shared, multi-client access. For multi-user scenarios, consider a client-server database like Neo4j or PostgreSQL.

What are the main features and use cases?

Key features include: embedded single-file storage, unified Cypher query language supporting graph traversal, vector search, and full-text search; ACID transactions with crash recovery; durable event logs; and zero-config operation. Common use cases are connected local data (notes, documents, citations), graph-plus-retrieval patterns (RAG, agent memory), and lightweight local knowledge tools.

Loading documentation…
View on GitHub

Featured in Videos

YouTube tutorials and walkthroughs for latticedb

Alternatives

Similar projects ranked by category, topics, and text overlap.

Compare