GrafeoDB/grafeo

GrafeoDB tackles a common pain point in graph databases: supporting multiple query languages and data models without duplicating execution logic or fragmenting the ecosystem. It achieves this through a modular translator architecture that parses six distinct query languages into abstract syntax trees, then compiles them into a unified logical plan. This plan executes efficiently against its dual LPG and RDF storage backends, all implemented in Rust for performance and safety.

what GrafeoDB is and how it works

GrafeoDB is an open-source graph database written entirely in Rust, designed for high-performance graph processing and flexible querying. It supports two prominent graph data models simultaneously: the labeled property graph (LPG) and the resource description framework (RDF). This dual support lets GrafeoDB work with a broad spectrum of graph data use cases, from social networks to semantic web applications.

What sets Grafeo apart is its support for six query languages: GQL, Cypher, Gremlin, GraphQL, SPARQL, and SQL/PGQ. Instead of implementing separate execution engines for each, Grafeo uses a modular translator system that parses different query syntaxes into a common abstract syntax tree (AST). The AST is then translated into a unified logical plan that executes over the common storage layer. This architecture reduces code duplication and ensures consistent behavior across query languages.

Under the hood, Grafeo employs MVCC transactions for concurrency control, columnar storage with compression for efficient data layout, and morsel-driven parallelism to maximize CPU utilization. It also integrates vector search as a first-class data type, using HNSW indexing and SIMD-accelerated distance calculations. Multiple vector quantization options provide tradeoffs between accuracy and storage.

The repository is implemented purely in Rust, minimizing external dependencies and targeting both embedded (zero dependency, in-process) and server modes. This flexibility means it can be embedded in applications or run as a standalone graph database server.

technical strengths and tradeoffs

The modular translator architecture is the technical highlight. Parsing six different query languages into a shared AST and unified logical plan is a clever engineering approach that avoids the maintenance nightmare of multiple execution engines. It enables Grafeo to support a wide range of graph query workloads with consistent optimizations.

Vector search integration is another standout. Many graph databases treat vector search as an add-on; Grafeo makes it a first-class citizen, with HNSW indexing and SIMD-accelerated distance functions implemented natively. This is particularly relevant for AI and recommendation workloads requiring similarity search.

Grafeo’s use of columnar storage with compression is a tradeoff favoring analytical workloads and minimizing memory footprint. The morsel-driven parallelism strategy, which partitions work into small chunks for parallel execution, helps scale query throughput on modern multi-core CPUs.

Benchmarks included in the repository show Grafeo outperforming Neo4j, Memgraph, and ArangoDB on both interactive and analytical workloads, often with dramatically lower memory usage. For example, Grafeo’s embedded mode executes the SNB Interactive workload in 2,904 ms using 136 MB of memory, compared to LadybugDB’s 5,333 ms and 4,890 MB.

The tradeoffs include the complexity of maintaining the modular translator and supporting many query languages in a single codebase. Also, Rust’s ecosystem, while mature, may present a learning curve for teams accustomed to more established graph database languages and tools.

quick start with GrafeoDB

Installation of the Rust crate is straightforward:

cargo add grafeo

Grafeo uses persona-based feature profiles that describe use cases. You can compose them freely.

Node.js / TypeScript example

const { GrafeoDB } = require('@grafeo-db/js');

// Create an in-memory database
const db = await GrafeoDB.create();

// Or open a persistent database
// const db = await GrafeoDB.create({ path: './my-graph.db' });

// Create nodes and relationships
await db.execute("INSERT (:Person {name: 'Alix', age: 30})");
await db.execute("INSERT (:Person {name: 'Gus', age: 25})");
await db.execute(`
    MATCH (a:Person {name: 'Alix'}), (b:Person {name: 'Gus'})
    INSERT (a)-[:KNOWS {since: 2020}]->(b)
`);

// Query the graph
const result = await db.execute(`
    MATCH (p:Person)-[:KNOWS]->(friend)
    RETURN p.name, friend.name
`);
console.log(result.toArray());

await db.close();

Python example

import grafeo

# Install with CLI support
uv add grafeo[cli]

The quickstart examples highlight Grafeo’s ease of embedding in different ecosystems with minimal setup.

verdict

GrafeoDB is worth a look if you need a Rust-native graph database that supports multiple graph data models and query languages within a single, unified execution engine. Its architectural approach to multi-language parsing and compilation is elegant and reduces maintenance overhead compared to running multiple engines side-by-side.

Its vector search support, parallel execution model, and efficient columnar storage make it suitable for workloads combining graph analytics with similarity search.

The benchmarks are impressive, especially considering its lower memory footprint compared to established graph databases.

That said, the complexity of the codebase and the Rust ecosystem might pose challenges for teams without Rust experience or those heavily invested in other graph database ecosystems. It’s a solid option for projects prioritizing performance, integration flexibility, and modern graph workloads.


→ GitHub Repo: GrafeoDB/grafeo ⭐ 596 · Rust