Contract-first database · v0.2.5 Open Source

Vibe fast.
Commit safely.

Build with AI. Keep your data correct.

RiffDB puts your business rules inside the database, so AI-generated applications cannot bypass them. Get transactions, analytics, and search in one Rust-powered engine, without stitching together five different systems.

ACID transactions · Compiled contracts · Zero-ETL analytics · Native MCP

v0.2.5

Open source in Rust (MIT / Apache-2.0) for Linux and Apple Silicon macOS with TypeScript, Python, Go, and Rust SDKs. Want hosted databases? Join managed early access.

SDK
CLI
MCP
One semantic pathCompiled
command
commit 0042
authorized
validated
durable
Every interface reaches the same authorization, ACID commit coordinator, and zero-ETL projections.

Proven against real software

Built against real frameworks.
Not toy benchmarks.

RiffDB is not a theoretical query language looking for a workload. We built out-of-tree adapters for four demanding open-source systems using ordinary compiled contracts and generated Go, Python, and TypeScript SDKs, with zero SQL or privileged storage hooks.

Python · OLTP + OLAP + Search

MLflow

Hybrid tracking, out-of-order traces & analytics

Runs MLflow 3.15.1 experiment tracking, 100-tag atomic batches, out-of-order distributed trace spans (init_or_mutate), LIKE/ILIKE search, and columnar OLAP trace metrics in one engine.

Python · 81/81 Conformance Tests

LangGraph

8 / 8 upstream checkpoint capability suites

Implements sync and async BaseCheckpointSaver for multi-agent graphs with idempotent superstep writes, atomic thread branching, and bounded history pruning.

Go · Official Datastore Suite

OpenFGA

Complete storage/test.RunAllTests pass

Replaces race-prone SQL tuple checks with compiler-sealed Zanzibar tuple decisions (observe_or_initialize + decide) and bytewise UTF-8 changelog pagination.

TypeScript · Compiled Profile

Better Auth

Atomic signup, consume-once tokens & secret redaction

Compiles configured auth models into atomic user/account creation commands, transaction-time token expiry refusal, and secret-classified fields excluded from MCP.

The application changed

Code is abundant.
Correctness isn’t.

Coding agents can assemble routes, handlers, and background workers in minutes. They can also reproduce every concurrency bug, duplicate retry, and scattered invariant we spent decades learning to avoid.

×2

Retries become duplicate effects

The write committed. The response vanished. When the caller retries, a naive handler charges or mutates twice.

↯

Read, check, write becomes a race

Each line looks reasonable in code review. Concurrent execution breaks the balance, quota, or tuple invariant.

•••

Invariants scatter across services

Web handlers, queue workers, and agent tools each remember a different fragment of what must remain true.

RiffDB’s thesis

The safest operation is the one an application cannot express incorrectly.

See RiffDB in action

Declare once. Call with types. Commit with proof.

Instead of scattering SQL transactions and ETL sync jobs across your codebase, you declare the command and its derived analytics in a contract. RiffDB generates the client and enforces the guarantees on every call.

01 · budget.riff
command AllocateBudget {
  input request_key: string<128>
  input organization_id: uuid
  input amount: money<USD>
  service now: transaction_time
  idempotency_key request_key

  mutate Budget(organization_id) as b
    else BudgetMissing {}
  require Enough: b.remaining >= amount
    else InsufficientFunds {}

  set b.remaining = b.remaining - amount
  emit BudgetAllocated {
    organization_id: organization_id,
    amount: amount,
    allocated_at: now,
  }
  return Allocated {
    remaining: b.remaining
  }
}

// Zero-ETL daily OLAP rollup
projection SpendByDay {
  source event BudgetAllocated
  key (organization_id, day(allocated_at))
  measure spend = sum(amount)
  frontier transactionally_ordered
}
Compiled command + zero-ETL rollup
02 · allocate.ts
// Call the generated SDK
const outcome =
  await client.allocateBudget({
    requestKey: "alloc-2026-0042",
    organizationId,
    amount: "250.00",
  });

// Exhaustive closed outcome union
switch (outcome.tag) {
  case "Allocated":
    console.log(outcome.remaining);
    break;
  case "InsufficientFunds":
  case "BudgetMissing":
    break;
}

// Query the live OLAP rollup
const spend = await client.spendByDay(
  { organizationId },
  { freshness: "causal" }
);
Same semantics in TS, Python, Go, Rust & MCP
03 · Protected by construction
  • No duplicate deduction on retryIf the network drops after commit, retrying with requestKey replays the exact stored Allocated outcome at sequence 0042 without deducting twice.
  • No concurrent overdraftCompeting calls on the same organization_id serialize on the declared conflict key. One succeeds; the other observes the updated balance.
  • Atomic event & OLAP rollupState, BudgetAllocated event, provenance, and the SpendByDay rollup share one commit sequence. With freshness: "causal", your dashboard immediately reflects the write.
  • Safe for AI agents via MCPExposing this database over riffdb-mcp gives an agent the AllocateBudget tool and its schema, never raw table mutation.
Zero raw SQL · zero dual writes · zero ETL glue

One database, three workloads

Agents make assembly cheap.
They do not make seams correct.

Stitching together an OLTP database, an analytics warehouse, a search cluster, a vector store, and CDC pipelines does not create one transaction, one freshness contract, or one coherent backup. RiffDB builds OLTP, OLAP, and search into one ordered engine.

Wired together

  • OLTP Database
  • OLAP Warehouse
  • Search & Vectors
  • CDC & ETL Glue

Dual writes · fragile ETL · stale dashboards · fractured recovery

Built in, not bolted on

OLTP, OLAP, and search in one ACID engine

  • Zero-ETL projectionsScalar columnar OLAP tables (quantiles, stddev, UTC time buckets), event rollups, stemmed/fuzzy BM25 indexes, and Partitioned HNSW vector indexes derive automatically from the commit log.
  • Typed freshness watermarksEvery RiffQL query states whether it requires causal, bounded, or available freshness against the commit sequence it needs to observe.
  • One operational unitTransactions, multi-step sagas, analytics, hybrid vector + BM25 search, quorum replication, and online backups operate as a single coherent system.

Honest tradeoff comparison

Why not a traditional SQL database?

Traditional SQL databases can implement every pattern below when paired with disciplined application code, manual row locking, idempotency tables, outbox workers, and external search or analytics pipelines. RiffDB is built for teams who want those safety properties enforced by the database interface itself.

DimensionTraditional SQL + Application GlueRiffDB (v0.2.5)
Data mutationArbitrary SQL (INSERT, UPDATE, DELETE) and open client-managed transactionsCompiled domain commands and durable cross-partition sagas; no generic CRUD surface
Business invariantsSplit across SQL constraints, triggers, isolation levels, and application codeDeclared in .riff contracts, proven by the compiler, and revalidated at commit
Retry & timeout safetyHand-rolled idempotency tables, unique keys, and background cleanup jobsCommand-level idempotency_key with durable typed outcome replay built into the protocol
Analytics & rollupsMaterialized views, read replicas, or CDC/ETL pipelines to a separate warehouseContract-declared scalar columnar projections and event rollups with freshness watermarks
Search & vectorsBolt-on full-text/vector extensions or external search clusters synced via CDCNative stemmed/fuzzy BM25 with snippets, Partitioned HNSW vectors, and single-query hybrid RRF
AI agent accessCustom MCP wrappers or risky read/write database credentialsNative capability-filtered MCP (riffdb-mcp) with automatic secret-field redaction
Ecosystem maturityDecades of production hardening, universal tooling, and ad-hoc multi-table SQL joinsOpen-source v0.2.5 focused on bounded, contract-first multi-tenant SaaS workloads

Running an existing relational SaaS stack? You do not need to rewrite your system of record. See the SQL safety comparison & brownfield adoption guide ↗ for carving out high-contention workflows without dual writes.

Reproducible evidence & v0.2.5 maturity

Measured workloads.
Transparent boundaries.

Database claims should come with hardware specs, durability settings, and honest boundaries. Below are reproducible results from the checked benchmark harnesses on an 8 vCPU AMD EPYC 9B14 host (32 GB RAM, ext4, full redb fsync durability), where every run verifies exact semantic parity before timing.

5,544 /s

Durable ACID commits (32 clients)

Full redb fsync durability, provenance, and idempotency outcome persistence on 8 vCPU AMD EPYC 9B14.

~3.3%

Live OLAP projection write overhead

5,363 vs. 5,544 commits/s at 32 clients while maintaining a transactionally ordered projection with sub-second catch-up.

56-122 µs

Compiled search & vector p50 latency

56 µs Partitioned HNSW vector join, 119 µs stemmed/fuzzy BM25 with snippets, and 122 µs hybrid RRF (327-684 µs over gRPC).

60,247 QPS

Concurrent search, cursor & vector mix

32-client compiled plan throughput (8,162 QPS end-to-end over public client gRPC vs. 10,393 QPS on PostgreSQL safe-app).

Shipping in v0.2.5 today

Production-grade semantic kernel

  • ACID command runtime with init_or_mutate, decide, mutate any pool claims, partial-update coalesce, deferred-pipeline idempotency disjointness (ADR-0349), and storage-verified cross-partition sagas (ADR-0334)
  • Zero-ETL scalar columnar OLAP projections, temporal event rollups, and reactive event streams
  • Stemmed & typo-tolerant fuzzy BM25 with highlighted snippets, trigram regex, Partitioned HNSW vectors, composable EAV candidate search with joined sorting, runtime byte-budgeted cursor pagination, and single-query hybrid RRF (ADR-0339)
  • Single-primary replication with quorum commit durability, automatic failover (ADR-0337), online snapshot backups, online scrub, and online staged restore
  • Lock-time role scan-budget verification, structured authorization_diagnostic classifications (ADR-0348), multi-database HostedHttp /mcp routing, native Rust Python Unix driver socket (cp311-abi3), and 7-surface remote conformance (ADR-0350)

Deliberate v0.2.x boundaries

What RiffDB does not claim yet

  • Single-primary writes: Followers serve read queries under Causal, Bounded, and Available freshness and support automatic failover, but multi-primary writes and cascading followers are outside 0.2.x.
  • Bounded RiffQL, not ad-hoc SQL: Every query must prove a bounded index, projection, or key plan at compile time. Arbitrary multi-table SQL joins and unbounded scans are refused by design.
  • Offline non-additive migrations: Additive schema changes deploy online; structural renames, type conversions, and repartitioning run through the offline riffdb migrate workflow with pre-migration backup.
  • Linux & Apple Silicon macOS: Signed native binaries target x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, and aarch64-apple-darwin (no native Windows or Intel macOS builds).
  • Data authority, not userland auth: RiffDB enforces capabilities and row policies; end-user sign-in, sessions, and OAuth stay in your app (or @riffdb/better-auth).

Start in 60 seconds

Try RiffDB locally today.

Scaffold a complete runnable starter or initialize RiffDB inside an existing TypeScript, Python, Go, or Rust repository. riffdb dev launches an isolated local database, compiles your contract, generates the typed SDK, seeds initial command data, and runs your application with zero manual key or certificate setup.

Path 01 · Open Source (v0.2.5)

Run locally or self-host

Install the signed CLI and daemon binaries or language packages and build locally today under MIT / Apache-2.0.

Path 02 · RiffDB Cloud

Managed RiffDB

Want replicated, zero-maintenance RiffDB hosting without operating your own cluster? Join the early-access list below.

terminal · quickstart
# 1. Scaffold a runnable starter app
# (typescript | python | go | rust)
riffdb new task-tracker \
  --language typescript
cd task-tracker

# 2. Start local DB, seed & run
riffdb dev --seed --run

# Or add RiffDB to an existing repo:
riffdb init my-app \
  --generator typescript \
  --generator mcp \
  --starter
riffdb generate
Ephemeral local DB · auto-provisioned keys · zero Docker required

Managed RiffDB

Be first in line.

We’re working toward a managed service. Join the early-access list for material project updates and the first invitations.

Confirm by email. No spam, tracking, or surprise launch promises. Privacy details.