hydradb README

The project's README from github.com/hydra-db/hydradb. As one markdown file: README.md.

HydraDB

OpenCypher TCK Release License: ELv2 Rust 1.99+ Benchmarks Discord

HydraDB is an object-store-native distributed graph database written in Rust. It pairs durable graph storage on SlateDB with snapshot-consistent OpenCypher queries, GraphBLAS traversal, Neo4j-compatible Bolt, and an HTTPS query API. S3-compatible storage is the source of truth; query nodes and indexers hold only disposable cache in memory and on local SSD, so they scale and restart without moving the graph.

Join the community on Discord. Contributions start with an approved issue; see CONTRIBUTING.md.

Why HydraDB

Architecture

flowchart LR
    C["Applications<br/>Neo4j drivers or HTTPS"]
    SVC["Service or load balancer"]

    subgraph Q["Query tier"]
        Q1["graph-node"]
        Q2["graph-node"]
        QN["graph-node"]
    end

    subgraph I["Indexing tier"]
        IX1["graph-indexer"]
        IXN["graph-indexer"]
    end

    CACHE["Disposable memory and SSD cache"]
    STORE["S3-compatible object storage<br/>WAL, SSTs, leases, CSC generations"]

    C --> SVC
    SVC --> Q1
    SVC --> Q2
    SVC --> QN
    Q1 <--> CACHE
    Q2 <--> CACHE
    QN <--> CACHE
    Q1 <--> STORE
    Q2 <--> STORE
    QN <--> STORE
    IX1 <--> STORE
    IXN <--> STORE

Query nodes serve reads and canonical mutations. Indexer workers build immutable CSC generations asynchronously and publish them through atomic object-store pointers. Readers stay correct when an index is absent or behind because the visible WAL tail is applied to the indexed base. See architecture.md for the full design.

Getting Started

Run with Docker

The published image needs no Rust toolchain or native libraries. Each release pushes ghcr.io/hydra-db/hydradb for linux/amd64 and linux/arm64, tagged latest, the version (0.5.0, 0.5, 0), and sha-<commit>. Its entrypoint is graph-node. A single plaintext development node on a local directory:

mkdir -p .hydradb/store
printf '%s\n' 'local-development-token-32-bytes' > .hydradb/auth-token
chmod 600 .hydradb/auth-token

docker run -d --name hydradb \
  -p 127.0.0.1:7687:7687 -p 127.0.0.1:8443:8443 -p 127.0.0.1:9090:9090 \
  -v "$PWD/.hydradb/store:/data" \
  -v "$PWD/.hydradb/auth-token:/run/secrets/auth-token:ro" \
  -e CLOUD_PROVIDER=local -e LOCAL_PATH=/data \
  -e GRAPH_NAMESPACE=default -e GRAPH_ID=default \
  -e GRAPH_CELL_ID=cell-0 -e GRAPH_CELLS=cell-0 -e GRAPH_NODE_ID=node-0 \
  -e GRAPH_ADVERTISED_BOLT_ADDR=127.0.0.1:7687 \
  -e GRAPH_BOLT_NODE_ADDRESSES=node-0=127.0.0.1:7687 \
  -e GRAPH_AUTH_TOKEN_FILE=/run/secrets/auth-token -e GRAPH_ALLOW_PLAINTEXT=true \
  ghcr.io/hydra-db/hydradb:latest

curl -fsS http://127.0.0.1:9090/readyz && echo READY

Ports, token, and namespace match Run a local node, so its curl examples work unchanged. Bolt clients use any non-empty username and the token as the password. The graph persists in .hydradb/store across docker rm; delete the directory to start over.

The token is readable only by its owner, and the ports are published on loopback only, so nothing outside this machine can reach the node. This recipe is for local development. For production, treat the token as a real secret: generate a unique random value, keep it out of docs and shell history, deliver it through a secret manager (the Helm chart mounts it from a Kubernetes Secret), and turn TLS back on by dropping GRAPH_ALLOW_PLAINTEXT.

The container runs as uid 10001. Docker Desktop maps bind-mount ownership for you. On Linux, hand both mounts to that uid first, or the node exits with Permission denied on the store or the 0600 token:

sudo chown -R 10001:10001 .hydradb/store .hydradb/auth-token

Don't use --user instead: the image's cache directory is owned by 10001, and the node exits with Permission denied. Change GRAPH_ADVERTISED_BOLT_ADDR and GRAPH_BOLT_NODE_ADDRESSES if clients reach the node by another address.

The image also ships graph-indexer and falkor-dump-import (use --entrypoint), and is built with the DataFusion engine and OTLP export. For production, use the Helm chart, which defaults to this image.

Prerequisites

Building from source needs Rust 1.99+, a C/C++ toolchain, libcypher-parser, and SuiteSparse GraphBLAS. just runs the recipes. On Ubuntu or WSL:

sudo apt-get install -y build-essential clang libclang-dev cmake pkg-config \
  libcypher-parser-dev libgraphblas-dev curl git python3 python3-venv

On macOS: brew install just cmake pkg-config llvm suite-sparse and brew install cleishm/neo4j/libcypher-parser. Install Rust from rustup.rs, not Homebrew. AGENTS.md has the full native-dependency setup and the common build and startup failure modes.

Build and verify

git clone https://github.com/hydra-db/hydradb.git
cd hydradb

just native-check   # confirms cypher-parser and GraphBLAS are discoverable
just check          # compiles every default-feature target

bash scripts/runtime_smoke.sh then builds graph-node, starts it, and exercises Bolt and HTTP against a throwaway store, printing runtime-smoke-ok.

Run a local node

A single plaintext development node on a local directory. TLS is required in deployed environments and disabled explicitly here.

mkdir -p .hydradb/store .hydradb/cache
printf '%s\n' 'local-development-token-32-bytes' > .hydradb/auth-token

export CLOUD_PROVIDER=local LOCAL_PATH="$PWD/.hydradb/store"
export GRAPH_NAMESPACE=default GRAPH_ID=default GRAPH_CELL_ID=cell-0 GRAPH_CELLS=cell-0
export GRAPH_NODE_ID=node-0 GRAPH_BOLT_NODE_ADDRESSES=node-0=127.0.0.1:7687
export GRAPH_ADVERTISED_BOLT_ADDR=127.0.0.1:7687
export GRAPH_DATA_CACHE_DIR="$PWD/.hydradb/cache"
export GRAPH_AUTH_TOKEN_FILE="$PWD/.hydradb/auth-token" GRAPH_ALLOW_PLAINTEXT=true
export RUST_MIN_STACK=33554432

cargo run --locked --features server-runtime --bin graph-node

It listens on Bolt 127.0.0.1:7687, HTTP 127.0.0.1:8443, and admin 127.0.0.1:9090. The node holds the foreground; from a second shell, write and read a small graph over HTTP:

TOKEN='local-development-token-32-bytes'

curl -sS http://127.0.0.1:8443/v1/graphs/default/query \
  -H "Authorization: Bearer $TOKEN" -H 'X-Graph-Namespace: default' \
  -H 'Content-Type: application/json' \
  --data '{"cell_id":"cell-0","query":"CREATE (a {id: 1})-[:FOLLOWS]->(b {id: 2})"}'

curl -sS http://127.0.0.1:8443/v1/graphs/default/query \
  -H "Authorization: Bearer $TOKEN" -H 'X-Graph-Namespace: default' \
  -H 'Content-Type: application/json' \
  --data '{"cell_id":"cell-0","query":"MATCH (a {id: 1})-[:FOLLOWS]->(b) RETURN b.id AS id"}'

The second call returns one row with {"type":"vertex_id","value":2}.

Querying

HydraDB speaks a practical OpenCypher subset for reads and mutations: typed relationships, bounded variable-length paths, property and label predicates, ordering, pagination, aggregation, OPTIONAL MATCH, UNION, and batched UNWIND writes. Connect with a Neo4j driver over a routed URI (neo4j://127.0.0.1:7687; neo4j+s:// with a trusted certificate).

Snapshot-scoped native path and degree procedures (algo.SPpaths, algo.SSpaths, algo.MSpaths, algo.degree) run over compiled GraphBLAS topology. The query surface, worked examples, and read-consistency modes are in USING-HYDRADB.md and the OpenCypher subset.

Kubernetes

The Helm chart deploys query nodes, indexer workers, services, cache volumes, network policies, disruption budgets, TLS, authentication, and optional Prometheus integration.

helm upgrade --install hydradb charts/hydradb \
  --namespace hydradb --create-namespace \
  --values charts/hydradb/examples/values-eks.yaml \
  --atomic --timeout 15m

Copy and edit the example values first; credentials, buckets, image references, TLS, and advertised Bolt addresses are environment-specific. See the Helm chart guide.

Observability

The public HTTP server exposes GET /healthz; graph-node and indexer admin servers expose GET /readyz and GET /metrics. Build with otlp added to the feature set to export OpenTelemetry data. Duration histograms state their unit in the metric name (_seconds vs _microseconds); do not compare across the two. The optional failed-query telemetry sink is described in crates/query-telemetry/README.md.

Development

Run just for the full command surface; recipes run from the repository root. just ci runs the local CI-equivalent sequence. The openCypher TCK runner lives under query-language/ behind the just tck-* recipes. Benchmark, stress, chaos, and deployment harnesses are maintained separately in hydra-db/benchmark.

src/core/           configuration, graph model, cache policy, errors
src/shard/          storage lifecycle, reads, writes, queries, path procedures
src/engine/         routing, placement, immutable indexes, index GC
src/query/          OpenCypher parsing, algebra, planning, transport types
src/client/         Bolt, HTTP, authentication, quotas, cursors
src/sparse_kernel/  Rust sparse and SuiteSparse GraphBLAS execution
crates/             placement and telemetry workspace crates
charts/hydradb/     Kubernetes Helm chart
query-language/     openCypher and GQL grammar, harness, and the TCK suite

Documentation

Document Contents
Architecture Design, snapshots, writer ownership, query execution, indexing
Using HydraDB Connecting, the OpenCypher dialect, path queries, query engines, consistency, operating
OpenCypher subset What the engine accepts and rejects at parse time
Helm chart guide Kubernetes configuration, TLS, auth, upgrades

Benchmarks

Published results are on the HydraDB benchmark site; the harness lives in hydra-db/benchmark.

Contributing

Issues and pull requests are welcome. Keep changes focused, add regression coverage for behavioral changes, and run just ci before opening a PR. Changes to storage, fencing, snapshots, routing, or index publication should state the invariant they preserve and include a failure-oriented test.

License

HydraDB is licensed under the Elastic License 2.0 (ELv2).

hydradb (hydra-db/hydradb)

Searching Database…

What is this?HydraDB is an object-store-native distributed graph database written in Rust: the graph lives in S3-compatible storage, queried over OpenCypher with Neo4j-compatible Bolt connectivity and an HTTPS JSON/NDJSON API.
How is that different from a regular graph database like Neo4j?The durable graph lives in object storage, not on the server's disks: query nodes and indexers keep only disposable state on local SSD or NVMe, so they can be replaced or scaled without moving the graph itself.
How do I get a local instance running?Build from source: Rust 1.91+, a C/C++ toolchain, libcypher-parser and SuiteSparse GraphBLAS, driven by the just command runner. Start with just smoke, then a dev node serves Bolt on 7687, the HTTP API on 8443 and admin/metrics on 9090.
Do I need a special client library to query it?No: existing Neo4j drivers connect over Bolt 5.x using routed neo4j+s:// or neo4j+ssc:// URIs, or you can call the HTTPS API with plain JSON or streaming NDJSON. Direct bolt:// addresses are for diagnostics.
Any gotchas before I try it?The native build has sharp edges: on macOS libcypher-parser needs the cleishm/neo4j tap, raw cargo invocations miss BINDGEN_EXTRA_CLANGARGS (prefer just), first queries abort without RUST_MIN_STACK=33554432, and TLS is on by default outside local dev.
What does a real production deployment look like?A Helm chart deploys query nodes, indexer workers, cache volumes, network policies, disruption budgets, TLS and optional Prometheus on Kubernetes, with environment-specific values for buckets, credentials and images. Docker itself is used only by test harnesses.
What are the algo.SPpaths, algo.SSpaths and algo.MSpaths procedures for?They are native snapshot-scoped path procedures: SPpaths finds bounded paths between one source and one target, SSpaths from a single source, and MSpaths resolves many indexed source-target pairs and evaluates them together, avoiding client-side query fan-out.
What happens if two writers race on the same cell?Object-store CAS leases select the active writer for each cell, and SlateDB writer epochs fence off stale writers, so an old writer cannot corrupt durable state. There is even a just fence recipe that proves the takeover.
Can I test it without a real S3 bucket or a cluster?Yes: just smoke runs a full local cycle (write, delete edges, traverse, reopen and verify durability) against a temporary local object store, and MinIO harnesses like just minio-chaos exercise the same flows in Docker containers.
What is SuiteSparse GraphBLAS used for here?The planner uses property indexes, reverse adjacency, sparse traversal and SuiteSparse GraphBLAS where appropriate for graph-native execution; just smoke-graphblas pins the traversal kernel to it explicitly.
What are similar projects?siglake, walgit, seaweedfs, VictoriaMetrics, thanos, neo4j, automq, emqx
Creator
hydra-db
Size
3.4 MB
Stars
13.1K
Age
4mo
Commits · 90 Days