Skip to main content
This page describes how to start from an empty environment and reach a running order service. Each step includes a verification check. Complete the check before proceeding to the next step.

Prerequisites

CockroachDB is compatible with the PostgreSQL wire protocol. Existing drivers and ORMs work with minimal change.

1. Start a cluster

Local, single node (development):
✅ Verify: cockroach sql --insecure -e "SELECT 1" prints 1. The DB Console is at http://localhost:8080.
[!NOTE] Other targets cockroach demo starts a temporary in-memory cluster for evaluating SQL. For a managed cluster, set DATABASE_URL to a CockroachDB Cloud connection string. The schema and application are identical.

2. Create the database

✅ Verify: SHOW DATABASES; lists ordermgmt.

3. Apply the schema

The reference implementation defines the schema in reference/schema.sql, which is the authoritative contract for the data model (see Data model). It includes Row-Level TTL on the reservations, idempotency, and outbox tables.
✅ Verify:

4. Seed data

✅ Verify: SELECT count(*) FROM inventory; returns the seeded SKUs. SKU-HOT is seeded with on_hand = 1 for the oversell test.

5. Run the reference implementation

The reference handlers and tests read one environment variable:
✅ Verify: the suite passes, including the 50-concurrent-buyers oversell test. See Reference app for what each handler does.

6. Check the accounting invariants

✅ Verify: every check returns zero rows. See Verification. For an interactive walkthrough that connects a cluster from the browser and runs the same scenarios, use the agent-demo/ app (cd agent-demo && npm install && npm start).