v2.1.12 · Apache-2.0 · Limits stated plainly

A transactional database whose only state is a bucket.

One static Rust binary serving strictly serializable transactions and ordered JSON scans over HTTP. Give every user, tenant, or agent its own database—an idle one is a 146-byte object in Backblaze B2 or S3. Servers hold no durable state: add them, remove them, or kill every one, and nothing is lost.

curl -fsSL https://ericflo.github.io/durable-db-site/install.sh | sh
  • ~8 MB static binary
  • B2, S3-compatible, or local directory
  • No locks, leases, or conditional writes
  • Modelled in TLA+

TypeScript SDK

import { Database } from '@durable-db/client';

const db = new Database({ url, database: 'demo', token });

await db.set('users/ada', { name: 'Ada', logins: 1 });
const ada = await db.get<{ name: string }>('users/ada');

// Atomic. If anything read changes first, nothing is
// written and the callback runs again.
await db.transaction(async (tx) => {
  const from = (await tx.get<number>('accounts/a')) ?? 0;
  const to = (await tx.get<number>('accounts/b')) ?? 0;
  if (from < 30) throw new Error('insufficient funds');
  tx.set('accounts/a', from - 30);
  tx.set('accounts/b', to + 30);
});

// Ordered prefix scan, paginated at one revision.
const page = await db.list({ prefix: 'accounts/', limit: 20 });

HTTP / curl

export URL=http://127.0.0.1:7654/v1/databases/demo
export AUTH="Authorization: Bearer $(durable-db create demo)"

# Two keys written in one atomic transaction.
curl $URL/commit -H "$AUTH" -d '{"writes": [
  {"key": "accounts/a", "value": {"balance": 100}},
  {"key": "accounts/b", "value": {"balance": 100}}]}'
# {"revision":1}

# Transfer 30 only if accounts/a is still at version 1.
# Retried with the same key, it applies once.
curl $URL/commit -H "$AUTH" -d '{
  "checks": [{"key": "accounts/a", "version": 1}],
  "writes": [
    {"key": "accounts/a", "value": {"balance": 70}},
    {"key": "accounts/b", "value": {"balance": 130}}],
  "idempotency_key": "transfer-7f3a"}'
# {"revision":2}

# Ordered prefix scan read at one revision.
curl $URL/read -H "$AUTH" \
  -d '{"scans": [{"prefix": "accounts/"}]}'

Explainer film · 14 min

Watch how a bucket with no locks gives you transactions

Why running a database server per agent or tenant is a chore, how the write-then-check protocol works, what happens when every server is killed mid-transaction, and how group commit keeps it fast.

1080p60 · Captions Standard stream · 186 MB
Default stream uses the smaller 186 MB encode; switch to High quality any time without losing your place.

Architecture

One writer per database, fenced by a claim object

Storage needs only PUT, GET, HEAD, LIST, and DELETE with read-after-write consistency. No conditional writes, no leases, no synchronized clocks, and no consensus cluster. Backblaze B2 and S3 run the exact same algorithm.

Your application or agentTypeScript SDK, pi-durable adapter, or plain HTTP · one bearer token per database
Server 1holds DBs A & B
Server 2holds DB C
N serversdisposable caches
Authoritative bucketBackblaze B2, S3-compatible, or local directory

Objects of one database (app). Every key is written by one epoch and never overwritten.

db/app/c/<epoch>
Claim. The active writer's permit; deleted to revoke it.
db/app/l/<epoch>/<n>
Frame. One group of committed transactions.
db/app/t/<epoch>/<id>
Table. Sorted, LZ4-compressed, CRC-checked blocks + index.
db/app/m/<epoch>/<gen>
Manifest. The tables and revision making up current state.
db/app/m/~
Tombstone. Written once after deletion is final.
Any server accepts a request and relays it to the database's owner. Kill every server, start one fresh, and it reopens each database from the bucket on first use.
Core safety invariant Write, then check — never check, then write
Owner A New B Revocation boundary 1. PUT frame 2. HEAD claim 1. DELETE claim 2. LIST frames If B deletes after A's HEAD, B lists A's frame. If before, A's HEAD fails and A says nothing.
  1. Every object is immutable

    Frames, tables, manifests, and claims live under an epoch combining a monotonic number with fresh random hex digits. Two servers never write the same key, so no write ever needs to be conditional.

  2. One server holds the claim

    To open a database, a server lists claims and manifests, chooses a higher epoch number, and PUTs its own claim once. If a listing then reveals a higher claim, it deletes its own and steps aside.

  3. A successor revokes before it reads

    Before reading any manifest or frame, the new owner deletes every lower claim. Nothing the previous owner acknowledges afterwards can slip past the recovery listing.

  4. Every commit waits for a HEAD on the claim

    A commit is one frame upload followed by one HEAD. If the claim still stands, the frame was stored before any successor began reading. If it is gone, nothing is acknowledged and the client retries safely with its idempotency key.

  5. Strong reads, cleanup, and deletion obey the same rule

    Linearizable reads, garbage collection, and final database deletion each wait for a claim check that started after the state they depend on was stored. A replaced server fails the check—acknowledging nothing and deleting nothing.

On a laptop or single host, the same binary runs the same protocol over a local directory. See the architecture page for every edge case and the table of what happens when things fail.

Performance

Measured on Backblaze B2 and a local NVMe disk

Every commit waits for one upload and one HEAD, so storage latency is the floor. One database has one writer; throughput comes from group commit—every transaction arriving while an upload is in flight joins the next frame.

Group commit · Backblaze B2 1,881 commits/s

256 clients on one database (128 ms median). On local NVMe with fsync: 16,541 /s.

Session reads · From memory 276,223 reads/s

0.10 ms median on a B2-backed server. Linearizable reads: 6,480 /s on B2 (37 ms median).

Bounded memory · Up to 16 GiB ≤ 534 MiB RAM

Peak server memory under a 1 GiB limit at 1–16 GiB. Reopened a 16 GiB DB after a kill in 50 ms (local).

Workload (256-byte JSON values, 1 server) Local NVMe · fsync on Backblaze B2 · 22 ms Wi-Fi
One commit, 1 client 6.0 ms 161 /s 77 ms 12 /s
Commits, 32 clients on one database 2,105 /s 15.0 ms p50 183 /s 128 ms p50
Commits, 256 clients on one database 16,541 /s 15.3 ms p50 1,881 /s 128 ms p50
Commits, 64 clients across 64 databases 4,936 /s 12.0 ms p50 534 /s 88 ms p50
Linearizable reads, 256 clients 378,213 /s 0.64 ms p50 6,480 /s 37 ms p50
Linearizable scans of 20 keys, 32 clients 246,678 /s 0.11 ms p50 845 /s 37 ms p50
Session reads, 32 clients 297,289 /s 0.09 ms p50 276,223 /s 0.10 ms p50

Measured 2026-11-14 with durable-db bench (release 2.1.1 static binary) on one 32-core desktop with a consumer NVMe drive and a Backblaze B2 bucket in us-west-002 reached over residential Wi-Fi, 22 ms away; large-database figures measured with release 2.1.8. B2 upload latency moves roughly 2× between hours (the same single-client commit took 118 ms earlier that day), and brief Wi-Fi stalls drove the highest tail latencies. A server in a data centre on a wired link has not been measured.

Full benchmark tables, large-database runs, and commands to reproduce them →

Capabilities

Transactions, scans, and tenant isolation over plain HTTP

One stateless deployment serves thousands of independent databases. Give each user, project, or agent its own database, token, and budget.

Read the details in HTTP API, TypeScript SDK, tokens and tenants, and Kubernetes.

Verification

Modelled in TLA+, tested with chaos and real kills

One TLA+ specification models ownership, commits, linearizable reads, retries, checkpoints, collection, late deletes, and database deletion. The Rust engine mirrors it step for step and is tested under fault injection, container S3 stores, and Kubernetes failover.

Bounded model checking is evidence about a model—not a proof of the Rust implementation or of every deployment. The verification page records every assumption, what the model leaves out, all 47 defects these tests and reviews found, and the obligations that remain.

Trade-offs & status

Limits, stated plainly

Read these before you choose durable-db.

By design

  • One writer per database at a time. Scale throughput by spreading work across more databases, not more servers on one database.
  • Storage latency is the floor. A commit costs one upload and one HEAD; a strong read shares one HEAD; session reads hit memory only.
  • Single-database transactions, current state only. Transactions do not span databases, and there are no historical reads or point-in-time restore.
  • Deleted database names cannot be reused. A permanent tombstone ensures a late upload from a prior owner can never revive deleted data.
  • Full rewrites on growth and quota pressure. Merging the oldest table rewrites the database each time it grows by half, and once more when it reaches quota holding overwritten data. Default quota is 1 GiB; databases up to 16 GiB have been measured locally, 4 GiB on MinIO, and 1 GiB on B2.
  • Reads beyond both caches hit the bucket per run. Size --cache-dir-bytes to the working set for reads (2× for zero-download merges). Writes wait with 503 while a merge would leave more than 24 runs.
  • Servers trust each other. Cluster peers relay over plain HTTP on a private network and share bucket credentials. Per-tenant CPU accounting and billing are not provided.
Limits of this design →

Not done yet

  • Only Backblaze B2 has been exercised among cloud stores. Amazon S3, Google Cloud Storage, and Cloudflare R2 share the S3 code path (except B2's native upload) but have not been run live. MinIO, RustFS, and Garage pass in single-machine containers.
  • No soak of many hours on a real multi-node cluster. Kubernetes failover ran on kind. Memory was level through 10-minute local loads and 20-minute and 1-hour MinIO runs of 256 databases, and still rising within flag budgets after 5–11 minutes on B2—not yet measured for many hours.
  • B2 was measured from one desktop over Wi-Fi. That link stalled briefly about once a minute, driving the slowest commits in the tables. A server in a data centre on a wired link has not been measured.
  • No self-imposed provider rate cap. Servers back off after eight consecutive refusals of a request kind (tested on stand-ins and a proxy, not yet observed live on B2), and collection falls behind if a store takes over two minutes to answer purges.
  • Prebuilt binary is Linux x86_64 only. Other platforms build from source (requires a C compiler and make for jemalloc).
  • No independent external review yet. Reviews so far were automated and commissioned by the project. The TLA+ model checks safety at small bounds, not liveness, receipt-window expiry, or exact check predicates.
Remaining obligations →

Quick start

Run it on one machine, then point it at a bucket

The first three steps need no bucket, container, or external service.

  1. Install the binary

    Downloads the Linux x86_64 release, verifies its SHA-256 checksum, and installs durable-db in ~/.local/bin.

    curl -fsSL https://ericflo.github.io/durable-db-site/install.sh | sh
  2. Start a local server

    Listens on 127.0.0.1:7654 and stores objects in ./data. First start generates ./data/admin.key for signing tokens.

    durable-db serve --data ./data
  3. Create a database, write, and read

    From a second terminal in the same directory. durable-db create creates the database and prints its write token.

    export URL=http://127.0.0.1:7654/v1/databases/demo
    export AUTH="Authorization: Bearer $(durable-db create demo)"
    
    curl -X PUT $URL/keys/greeting -H "$AUTH" -d '"hello"'  # {"revision":1}
    curl $URL/keys/greeting -H "$AUTH"                       # "hello"
  4. Serve from a bucket

    On Backblaze B2, create a private bucket and a key scoped to it. Share one signing key across every server; at startup, each server probes storage and refuses to start if its contract is not met.

    openssl rand -hex 32 > admin.key && chmod 600 admin.key
    
    export AWS_ACCESS_KEY_ID=<keyID> AWS_SECRET_ACCESS_KEY=<applicationKey>
    durable-db serve \
      --bucket my-bucket \
      --endpoint https://s3.us-west-002.backblazeb2.com \
      --key-file admin.key

Next: deploy on Kubernetes, use the TypeScript SDK, explore the Hono task-board example, or read the HTTP API.

Documentation

Every page

Generated directly from the Markdown files in the repository.