# rama-l7/hydradb architecture

> Architecture diagram of the GitHub repository rama-l7/hydradb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rama-l7/hydradb
- Repository: https://github.com/rama-l7/hydradb

## Overview

HydraDB is a distributed, object-store-native graph database. Applications enter through Bolt or HTTPS; data nodes serve queries and canonical mutations, while indexers asynchronously publish traversal indexes. Query execution parses OpenCypher, coordinates work, and evaluates it against shard data and sparse traversal kernels. The README documents the durable object-store model, snapshot reads, writer handoff, and major client capabilities. Some subsystem links below are based on README descriptions or SOURCE INDEX references rather than inspected call sites.

Main entry points: [`src/client/service.rs`](https://github.com/rama-l7/hydradb/blob/main/src/client/service.rs) (Client query service), [`src/shard/query.rs`](https://github.com/rama-l7/hydradb/blob/main/src/shard/query.rs) (Shard query execution), [`crates/telemetry/src/otlp.rs`](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/otlp.rs) (OTLP export), [`src/engine.rs`](https://github.com/rama-l7/hydradb/blob/main/src/engine.rs) (Graph engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Client access"]
  node_bolt["Bolt server<br/>[bolt.rs]"]
  node_http["HTTPS API<br/>[http.rs]"]
  node_client_service["Client query service<br/>[service.rs]"]
end

subgraph group_query["Query execution"]
  node_cypher["OpenCypher parser<br/>[opencypher.rs]"]
  node_coordination["Query coordination<br/>[coordination.rs]"]
  node_shard_query["Shard query execution<br/>[query.rs]"]
  node_path_procedure["Path procedures<br/>[path_procedure.rs]"]
  node_shard_write["Graph mutations<br/>[write.rs]"]
  node_sparse_kernel["Sparse traversal kernels<br/>[mod.rs]"]
end

subgraph group_storage["Storage and indexing"]
  node_indexer["Background indexer<br/>[graph-indexer.rs]"]
  node_core_state["Graph state and snapshots<br/>[state.rs]"]
  node_engine["Graph engine<br/>[engine.rs]"]
  node_artifact_build["Traversal index builder<br/>[artifact_build.rs]"]
end

subgraph group_runtime["Node runtime"]
  node_graph_node["Data node<br/>[graph-node.rs]"]
  node_writer_lease["Writer leases<br/>[writer_lease.rs]"]
  node_heartbeat["Node heartbeats<br/>[heartbeat.rs]"]
end

subgraph group_telemetry["Observability"]
  node_telemetry_layers["Logging and tracing<br/>[layers.rs]"]
  node_telemetry_config["Telemetry configuration<br/>[config.rs]"]
  node_telemetry_meter["Metric instruments<br/>[meter.rs]"]
  node_telemetry_otlp["OTLP export<br/>[otlp.rs]"]
  node_telemetry_redact["Telemetry redaction<br/>[redact.rs]"]
  node_telemetry_sampling["Trace sampling<br/>[sampling.rs]"]
  node_telemetry_semconv["Metric conventions<br/>[semconv.rs]"]
end

node_applications(("Applications"))
node_object_store[("Object storage")]

node_applications -->|"connects via Bolt"| node_bolt
node_applications -->|"queries via HTTPS"| node_http
node_bolt -.->|"handles requests"| node_client_service
node_http -.->|"handles requests"| node_client_service
node_client_service -->|"coordinates queries"| node_coordination
node_client_service -->|"uses query parsing"| node_cypher
node_graph_node -.->|"serves client queries"| node_client_service
node_graph_node -->|"uses writer leases"| node_writer_lease
node_graph_node -->|"publishes readiness"| node_heartbeat
node_coordination -->|"uses query parsing"| node_cypher
node_coordination -.->|"dispatches shard work"| node_shard_query
node_shard_query -->|"uses path procedures"| node_path_procedure
node_shard_query -->|"runs traversal"| node_sparse_kernel
node_shard_query -.->|"reads graph state"| node_core_state
node_shard_write -.->|"writes graph state"| node_core_state
node_engine -->|"builds artifacts"| node_artifact_build
node_engine -->|"uses lease coordination"| node_writer_lease
node_engine -->|"persists graph data"| node_object_store
node_indexer -->|"publishes index generations"| node_object_store
node_indexer -.->|"builds traversal indexes"| node_artifact_build
node_telemetry_layers -->|"loads configuration"| node_telemetry_config
node_telemetry_layers -->|"routes through redaction"| node_telemetry_redact
node_telemetry_layers -->|"configures export"| node_telemetry_otlp
node_telemetry_otlp -->|"exports metrics"| node_telemetry_meter
node_telemetry_otlp -->|"uses sampling"| node_telemetry_sampling
node_telemetry_otlp -->|"uses conventions"| node_telemetry_semconv

click node_bolt "https://github.com/rama-l7/hydradb/blob/main/src/client/bolt.rs"
click node_http "https://github.com/rama-l7/hydradb/blob/main/src/client/http.rs"
click node_client_service "https://github.com/rama-l7/hydradb/blob/main/src/client/service.rs"
click node_graph_node "https://github.com/rama-l7/hydradb/blob/main/src/bin/graph-node.rs"
click node_indexer "https://github.com/rama-l7/hydradb/blob/main/src/bin/graph-indexer.rs"
click node_cypher "https://github.com/rama-l7/hydradb/blob/main/src/query/opencypher.rs"
click node_coordination "https://github.com/rama-l7/hydradb/blob/main/src/query/coordination.rs"
click node_shard_query "https://github.com/rama-l7/hydradb/blob/main/src/shard/query.rs"
click node_path_procedure "https://github.com/rama-l7/hydradb/blob/main/src/query/path_procedure.rs"
click node_shard_write "https://github.com/rama-l7/hydradb/blob/main/src/shard/write.rs"
click node_core_state "https://github.com/rama-l7/hydradb/blob/main/src/core/state.rs"
click node_engine "https://github.com/rama-l7/hydradb/blob/main/src/engine.rs"
click node_artifact_build "https://github.com/rama-l7/hydradb/blob/main/src/engine/artifact_build.rs"
click node_sparse_kernel "https://github.com/rama-l7/hydradb/blob/main/src/sparse_kernel/mod.rs"
click node_writer_lease "https://github.com/rama-l7/hydradb/blob/main/src/engine/writer_lease.rs"
click node_heartbeat "https://github.com/rama-l7/hydradb/blob/main/crates/placement/src/heartbeat.rs"
click node_telemetry_layers "https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/layers.rs"
click node_telemetry_config "https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/config.rs"
click node_telemetry_meter "https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/meter.rs"
click node_telemetry_otlp "https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/otlp.rs"
click node_telemetry_redact "https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/redact.rs"
click node_telemetry_sampling "https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/sampling.rs"
click node_telemetry_semconv "https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/semconv.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bolt,node_http,node_client_service toneBlue
class node_cypher,node_coordination,node_shard_query,node_path_procedure,node_shard_write,node_sparse_kernel,node_object_store toneAmber
class node_indexer,node_core_state,node_engine,node_artifact_build toneMint
class node_graph_node,node_writer_lease,node_heartbeat toneRose
class node_telemetry_layers,node_telemetry_config,node_telemetry_meter,node_telemetry_otlp,node_telemetry_redact,node_telemetry_sampling,node_telemetry_semconv,node_applications toneIndigo
```

## Components

### Client access

- [Bolt server](https://github.com/rama-l7/hydradb/blob/main/src/client/bolt.rs): `src/client/bolt.rs`
- [HTTPS API](https://github.com/rama-l7/hydradb/blob/main/src/client/http.rs): `src/client/http.rs`
- [Client query service](https://github.com/rama-l7/hydradb/blob/main/src/client/service.rs): `src/client/service.rs`

### Query execution

- [OpenCypher parser](https://github.com/rama-l7/hydradb/blob/main/src/query/opencypher.rs): `src/query/opencypher.rs`
- [Query coordination](https://github.com/rama-l7/hydradb/blob/main/src/query/coordination.rs): `src/query/coordination.rs`
- [Shard query execution](https://github.com/rama-l7/hydradb/blob/main/src/shard/query.rs): `src/shard/query.rs`
- [Path procedures](https://github.com/rama-l7/hydradb/blob/main/src/query/path_procedure.rs): `src/query/path_procedure.rs`
- [Graph mutations](https://github.com/rama-l7/hydradb/blob/main/src/shard/write.rs): `src/shard/write.rs`
- [Sparse traversal kernels](https://github.com/rama-l7/hydradb/blob/main/src/sparse_kernel/mod.rs): `src/sparse_kernel/mod.rs`

### Storage and indexing

- [Background indexer](https://github.com/rama-l7/hydradb/blob/main/src/bin/graph-indexer.rs): `src/bin/graph-indexer.rs`
- [Graph state and snapshots](https://github.com/rama-l7/hydradb/blob/main/src/core/state.rs): `src/core/state.rs`
- [Graph engine](https://github.com/rama-l7/hydradb/blob/main/src/engine.rs): `src/engine.rs`
- [Traversal index builder](https://github.com/rama-l7/hydradb/blob/main/src/engine/artifact_build.rs): `src/engine/artifact_build.rs`

### Node runtime

- [Data node](https://github.com/rama-l7/hydradb/blob/main/src/bin/graph-node.rs): `src/bin/graph-node.rs`
- [Writer leases](https://github.com/rama-l7/hydradb/blob/main/src/engine/writer_lease.rs): `src/engine/writer_lease.rs`
- [Node heartbeats](https://github.com/rama-l7/hydradb/blob/main/crates/placement/src/heartbeat.rs): `crates/placement/src/heartbeat.rs`

### Observability

- [Logging and tracing](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/layers.rs): `crates/telemetry/src/layers.rs`
- [Telemetry configuration](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/config.rs): `crates/telemetry/src/config.rs`
- [Metric instruments](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/meter.rs): `crates/telemetry/src/meter.rs`
- [OTLP export](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/otlp.rs): `crates/telemetry/src/otlp.rs`
- [Telemetry redaction](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/redact.rs): `crates/telemetry/src/redact.rs`
- [Trace sampling](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/sampling.rs): `crates/telemetry/src/sampling.rs`
- [Metric conventions](https://github.com/rama-l7/hydradb/blob/main/crates/telemetry/src/semconv.rs): `crates/telemetry/src/semconv.rs`

### Other components

- **Applications**
- **Object storage**

## Connections

- Applications → Bolt server: connects via Bolt
- Applications → HTTPS API: queries via HTTPS
- Bolt server → Client query service: handles requests
- HTTPS API → Client query service: handles requests
- Client query service → Query coordination: coordinates queries (evidence: `src/client/service.rs`)
- Client query service → OpenCypher parser: uses query parsing (evidence: `src/client/service.rs`)
- Data node → Client query service: serves client queries
- Data node → Writer leases: uses writer leases
- Data node → Node heartbeats: publishes readiness
- Query coordination → OpenCypher parser: uses query parsing (evidence: `src/query/coordination.rs`)
- Query coordination → Shard query execution: dispatches shard work
- Shard query execution → Path procedures: uses path procedures (evidence: `src/shard/query.rs`)
- Shard query execution → Sparse traversal kernels: runs traversal (evidence: `src/shard/query.rs`)
- Shard query execution → Graph state and snapshots: reads graph state
- Graph mutations → Graph state and snapshots: writes graph state
- Graph engine → Traversal index builder: builds artifacts (evidence: `src/engine.rs`)
- Graph engine → Writer leases: uses lease coordination (evidence: `src/engine.rs`)
- Graph engine → Object storage: persists graph data
- Background indexer → Object storage: publishes index generations
- Background indexer → Traversal index builder: builds traversal indexes
- Logging and tracing → Telemetry configuration: loads configuration (evidence: `crates/telemetry/src/layers.rs`)
- Logging and tracing → Telemetry redaction: routes through redaction (evidence: `crates/telemetry/src/layers.rs`)
- Logging and tracing → OTLP export: configures export (evidence: `crates/telemetry/src/layers.rs`)
- OTLP export → Metric instruments: exports metrics (evidence: `crates/telemetry/src/otlp.rs`)
- OTLP export → Trace sampling: uses sampling (evidence: `crates/telemetry/src/otlp.rs`)
- OTLP export → Metric conventions: uses conventions (evidence: `crates/telemetry/src/otlp.rs`)
