Crate Map
relata-core is the dependency root — every other crate in the workspace depends on it. The next ring is storage + query + canonical + ontology. The outer ring is server, CLI, and domain modules. Dependency arrows always point inward toward relata-core; no inner crate depends on an outer crate.
Dependency graph
┌──────────────┐
│ relata-core │ ← every crate depends on this
└──────┬───────┘
┌─────────────────┼─────────────────┐
▼ ▼ ▼
relata-canonical relata-storage relata-ontology
│ │ │
└────────┬────────┘ │
▼ │
relata-query ◄────────────────────┘
│
┌─────────────┼──────────────┐
▼ ▼ ▼
relata-graph relata-acl relata-identity
│ │ │
└─────┬───────┴──────┬───────┘
▼ ▼
relata-prov relata-detect
│ │
└──────┬───────┘
▼
relata-server ◄── relata-cluster, relata-cache
│
▼
relata-cliFoundation
| Crate | Layer | Role |
|---|---|---|
relata-core | Foundation | Core types: bi-temporal row model, ObjectId / LinkId / EventId / RowId (16-byte newtypes; production RowId is a server-minted counter — see Data Model), Identity datatype, HLC timestamps. The one crate that depends on nothing else in the workspace. |
Storage and data plane
| Crate | Layer | Role |
|---|---|---|
relata-storage | Storage | In-memory bi-temporal store with per-type interior locking (&self writes via PlRwLock). WAL. Custom BM25 full-text (integer posting lists + q-gram prefix + trigram suffix + 15 hand-rolled stemmers (en/fr/de/es/pt/it/nl/sv/no/da/fi/hu/ro + Russian Cyrillic, Turkish, Arabic) + CJK pass-through + subword tokenization (camelCase/digit); NOT Tantivy). Vectors: custom HNSW (vector.rs) + DiskANN warm tier (vector_diskann.rs). Backup/restore. Per-column bloom filters. Summary index for O(1) COUNT/SUM. HLL + CMS cardinality sketches. Pure-Rust Kafka ingest adapter. Arena allocation via bumpalo. |
relata-canonical | Storage | ~76 canonical type validators shipped (email, IBAN, MMSI, VIN, IMEI, MSISDN, Aadhaar, GeoPoint, and more). Deterministic binary encoding. The target catalogue is ~170; the shipped count is in crates/relata-canonical/src/lib.rs. |
relata-ontology | Storage | Schema-as-code. Git-branched ontology with HEAD pointer. State-machine constraints on PropertySpec. Computed columns. |
Query and compute
| Crate | Layer | Role |
|---|---|---|
relata-query | Query | SQL parser → planner → executor. DataFusion bridge for columnar aggregation. Cost-based optimizer (join ordering + index selection). MV refresh (ON COMMIT, IncrementalAggregate + HLL). Watch subscriptions. Query result cache. Pattern tracker + speculative prefetch. ReadOptions / WITH CACHE. |
relata-graph | Query | CSR adjacency. BFS/DFS. Pregel-style iterative BFS. PLL distance index (pll.rs) wired into GRAPH_SSSP (algo => 'pll') and GRAPH_DIJKSTRA (reachability pre-check); PATHS_BETWEEN uses BFS/DFS. 10+ SQL graph operators (GRAPH_DIJKSTRA, GRAPH_LINK_PREDICT, GRAPH_SCC, GRAPH_CYCLES, GRAPH_SSSP, GRAPH_SPANNING_TREE, GRAPH_APSP, GRAPH_DIAMETER, GRAPH_SIMILARITY, GRAPH_NODE_METRIC). Incremental degree index, exposed as the DEGREE() SQL function. |
Identity and detection
| Crate | Layer | Role |
|---|---|---|
relata-identity | Domain | IdentityIndex materialized view. RESOLVE_IDENTITY, IDENTITY_CLUSTER, and SAME_IDENTITY SQL operators. Substrate for cross-source fusion. |
relata-detect | Domain | Two-phase SmartIngest: eager (validate + canonicalize in the writer's commit path) and lazy (DETECT_IDENTITIES operator run by the indexer). Configurable detector packs: network, contact, crypto (default on); financial, payment, social, transport, device, ics (opt-in); all, none. |
Governance and trust
| Crate | Layer | Role |
|---|---|---|
relata-acl | Trust | Cedar-inspired ABAC. Deny-wins evaluation. Bitmap row filtering (precomputed per (principal, type)). Cell masking (redact / hash / partial). |
relata-prov | Trust | PROV-O assertions. Hash-chained commit manifests. Content-addressed blobs. Audit log replay. |
Server and clients
| Crate | Layer | Role |
|---|---|---|
relata-server | Server | Postgres wire protocol + gRPC + Arrow Flight + MCP. Auth: OIDC, mTLS. Hosts the query coordinator on server/cluster profiles. |
relata-cli | Server | The relata binary entry point. Profiles: free / server / cluster (lite is a removed legacy alias — rejected at startup). Hosts the protocol-compatibility servers: s3_server.rs, pgwire_listener.rs, clickhouse_server.rs, neo4j_server.rs, redis_server.rs, mongo_server.rs, bolt_server.rs. |
relata-sdk-rust | Client | Internal/reference client (not a published consumer SDK — Python/TypeScript/Go are the published SDKs). gRPC + HTTP + in-memory client. Arrow-IPC zero-copy. RFC 7807 error shape. Multi-tenant headers. SearchBuilder for the /search API. Used by the server binary, the tray app, the test harness, and relata-bench. |
Cluster and cache
| Crate | Layer | Role |
|---|---|---|
relata-cluster | Distribution | Coordinator / reader / writer / indexer roles. Hash partitioning. Multi-region replication. Branch-level writer leases. Status: alpha — not recommended for production. |
relata-cache | Cache | RAM-only foyer cache. S3-FIFO admission (scan-resistant). |
Intelligence and feeds
| Crate | Layer | Role |
|---|---|---|
relata-feed, relata-feed-broker | Intelligence | RIFN intelligence feed network. Inbound feed ingestion and fan-out. |
relata-jobs | Intelligence | Continuous pattern-detection jobs (C2 beacon, convoy, transaction ring). Governance-aware DAG workflow engine. |
relata-intelligence | Intelligence | Incident clustering. Anomaly detection. LLM interpretation. Detection-rule tuning: snooze, suppression, exception lists. |
Extension points
These crates define the contract that external extension crates must implement. They are not run directly.
| Crate | Role |
|---|---|
relata-connector-stub | Trait shapes for external relata-connector-* crates (data source connectors). |
relata-pack-stub | Trait shapes for external relata-pack-* crates (domain-specific intelligence packs). |
Domain packs and connectors live in separate repositories (relata-pack-*, relata-connector-*). They are not part of this workspace.
Benchmarks
| Crate | Role |
|---|---|
relata-bench | 50+ benchmarks + conformance runner. --gate quick pre-merge (~30s). --no-ann skips HNSW builds (~8 min vs. ~15 min). Protocol coverage for all 8 compat doors + 5 native protocols. Not in the workspace test gate; run separately. |
Testing
| Crate | Role |
|---|---|
relata-testing | In-process test fixtures. TestFixture spins up an in-memory ObjectStore; spawn_ephemeral (behind the ephemeral feature) starts a real relata process on a random port for SDK integration tests. Consumed by the workspace test gate, not shipped at runtime. |
Apps
Console and Portal live in SEPARATE repositories (
github.com/relatadb/consoleandgithub.com/relatadb/portal), not in this workspace. Onlyapps/relata-trayships in-repo. They are listed here for orientation; they are not part of the Rust workspace test gate.
| App | Repo | Role |
|---|---|---|
| Console | github.com/relatadb/console (separate repo) | Next.js showcase + ops surface. 68 pages, 19 tutorials, 24 docs, 8 interactive showcases. Force-directed graph explorer, universal search, CDR/SDR analyzer, case investigator. Talks to the server via /api/relata/* proxy. |
| Portal | github.com/relatadb/portal (separate repo — this site) | Next.js docs and landing site. Hand-authored rolling-latest surface with per-version snapshots. |
apps/relata-tray | in-repo | macOS menu-bar app (Tauri 2). Click-to-launch server + popup health WebView. Bundled in the DMG release. |
Build invariants
These are enforced at the workspace level, not per-crate.
No
unsafein library code. Everylib.rscompiles withunsafe_codeforbidden or denied — most carry#![forbid(unsafe_code)];relata-queryandrelata-storagecarry#![deny(unsafe_code)];relata-clusterforbids it outside tests. The single workspace exception is therelataCLI binary, whose smoke-test harness uses a minimallibc::killFFI shim.
missing_docsis denied. Every public item has a doc comment. Builds fail otherwise.
Workspace resolver
"3", edition 2024, MSRV 1.85.
parking_lotlocks only.PlMutexandPlRwLocktype aliases are the only mutexes used. parking_lot does not poison on panic.
Workspace dependency pinning. All shared dependency versions live in
[workspace.dependencies]. Usedep.workspace = true, not inline version strings.
cargo deny checkenforces a license allowlist and bans unknown registries and git dependencies.