CairnDB¶
A serverless database engine on blob storage — the bucket is the only server.
A cairn is a stack of stones raised one by one, by many independent hands, with no custodian — and it stands for centuries. CairnDB works the same way: all state lives in an object-storage bucket, every writer is just a library call, and the bucket itself arbitrates concurrency through conditional writes. No database server, no coordinator, no idle compute.
from cairndb import CairnDB
db = CairnDB.configure({"storage": {"type": "s3", "bucket": "myapp"}})
await db.objects.put("config/app.json", data) # conditional KV
result = await db.claim("dispatch/etl:2026-08-10", {"run": 1}) # exactly-one winner
lease = await db.lease("state/run-1", ttl=120) # fenced ownership
seq = await db.log("orders").append(event) # durable, ordered
async with db.transact() as tx: # multi-key atomicity
tx.put("accounts/alice", alice_bytes)
tx.put("accounts/bob", bob_bytes)
proj = db.projection("orders_view", log="orders") # SQL over the log
What you get¶
Layer |
You get |
Engine analogy |
|---|---|---|
etag-guarded key-value documents (CAS, put-if-absent) |
atomic page writes |
|
|
locks & constraints |
|
named, append-only commit logs — dense, totally ordered, durable on ack |
write-ahead log |
|
optimistic multi-key atomicity, coordinated by a system log |
transaction manager |
|
deterministic replay into local read-only SQLite, snapshots, time travel |
indexes & materialized views |
When to use it¶
CairnDB fits low-to-medium write workloads that tolerate latency in exchange for near-zero operating cost:
Small to medium datasets (up to ~10 GB per projection) with rich read queries and modest write volume.
Strong auditability and determinism requirements: event sourcing, time-travel reads, rebuild-anywhere recovery.
Coordination state for serverless and scale-to-zero systems: workflow ownership, exactly-once dispatch, checkpoints.
“I want a database, but I refuse to run or rent a database server.”
It is not a high-throughput OLTP database, a low-latency replication engine, a general-purpose event bus, or a multi-region active-active system. See Guarantees and limits.
Where to go next¶
New to CairnDB? Install it, then follow the Quickstart — ten minutes, no cloud account needed.
Understand the model — Concepts explains how a bucket can be a database, layer by layer.
Solve a problem — Guides collect recipes for coordination, operations, and the lower-level API.
Ship it — Deployment covers local setups and AWS, Google Cloud, and Azure.
Look something up — the Reference is generated from the source docstrings.