cardinal

Architecture

The rules that let any request, job or socket land on any node.

Nodes keep no state

Postgres and S3-compatible object storage are the only stateful dependencies. Nodes hold no local disk state, no file locks and no process-local state that correctness depends on. One release runs as CARDINAL_ROLE=web, worker or all.

Rust computes, Elixir does IO

LayerDoesNever does
Rust cratesMetadata compile, queries, permissions, formatting, naming, templates, spreadsheets, schema diffsDatabase, network, filesystem or async
ElixirHTTP, transactions, realtime, jobs, clustering
Vue deskRenders views from metadata, and runs the pure Rust crates as WASM

One schema per tenant

Every transaction runs SET LOCAL search_path, so PgBouncer transaction pooling stays safe. Migrations run under per-tenant advisory locks, and DDL diffs add tables and columns or widen a type. A migration never drops a column.

The request owns the transaction

Record code never commits. Realtime broadcasts, cache busts, emails and jobs run after commit, and jobs are enqueued in the same transaction through Oban.

Caches are optional for correctness

Compiled metadata sits in ETS, keyed by tenant and meta_version. Every transaction reads the tenant's meta_version, so a version bump makes each node miss the old entry with no message between nodes.

Apps never write SQL

Queries and permission predicates compile to parametrized SQL in cardinal_query and cardinal_perm.

On this page