Skip to main content
The Cookbook shows how to build on CockroachDB. Every entry runs, says how it fails, and states what its choices cost.
  • Blueprints are complete workload designs: the data model, the transactions, and what happens when things fail, as a working application with tests.
  • Recipes are single patterns you can run in 15 to 20 minutes.
  • Migrations move an existing application to CockroachDB and show each change it needed.
All the code is in one place, the Cockroach Cookbook repository. Each project there has its own README and tests, and CI runs those tests against the latest CockroachDB every week.

Blueprints

Order management

Stock, idempotency keys, payment callbacks, and the outbox stay correct under concurrent orders and retries. A 21-page design guide, a Python reference implementation, and a live demo.

Payments ledger

A double-entry ledger that stays correct under concurrent transfers, with no overdrafts and no double moves. FastAPI and SQLAlchemy.

Multi-tenant SaaS

Row-level security keeps each tenant’s data apart, then the same app grows to three regions. Next.js and Prisma.

Coming soon

Wallets

Coming soon. Spends with idempotency keys, holds and captures, refunds and transfers, shared wallets, and wallets kept in their home region.

Per-tenant estates

Coming soon. Many small, isolated databases, one per tenant, with agent state management and agent sandboxes built on top.

Recipes

Migrations

How the Cookbook works

  • Every entry runs. Recipes name the release their SQL was run on. Blueprints and migrations are tested in CI against the latest CockroachDB.
  • Every entry says how it fails. Each one covers what happens on retries and failures, and what its choices cost.
  • Every entry works with agents. Every project in the repository has an AGENTS.md for coding agents, and the Order management Blueprint ships an agent skill.
  • Versions are pinned. Each project is tagged in the repository, and each page links to the tag it describes.

Learn it hands-on in Cockroach University

Several Cookbook projects go with free courses.