orders-api
Owns the order lifecycle from cart submission to fulfilment handoff.
At a glance
The facts you need at 3am
What it does
Accepts a submitted cart, prices it, reserves stock, takes payment through the
payments service, and hands a confirmed order to fulfilment. It owns order
state; nothing else writes the orders table. Everything downstream reacts to
the order.confirmed event rather than calling back in.
What it talks to
Service levels
What we promise, and where we are
Non-5xx on POST /orders
p95 end to end
order.confirmed published within 5s
Dependencies
| Dependency | Kind | If it is down |
|---|---|---|
| payments | Sync, blocking | Submission fails — this is a hard dependency |
| inventory | Sync, blocking | Falls back to optimistic reservation for 10 minutes |
| Postgres | Sync, blocking | Total outage — fail fast and page |
| Redis | Sync, degraded | Retries lose idempotency; we fail closed |
| fulfilment.jobs (SQS) | Async | Orders confirm and queue locally; handoff catches up |
Common operations
The three things people ask for
- 1Find one order end to end
The order id is in every log line and every span.
bashkubectl logs -n orders -l app=orders-api --since=1h | grep ord_01H… - 2Replay a stuck fulfilment handoff
Safe to run twice — the consumer is idempotent on order id.
bash./bin/orders replay-handoff --order ord_01H… --dry-run=false - 3Roll back a bad releasebash
kubectl -n orders rollout undo deploy/orders-apiSchema changes are expand-only, so a rollback never needs a database change.
Questions we answer weekly
Can I write to the orders table from my service?
No. Order state has one owner. Subscribe to order.confirmed, or ask us for an endpoint.
Why did an order confirm but never ship?
Almost always a stuck handoff — check the fulfilment.jobs DLQ, then replay it with the command above.
How do I test against it locally?
docker compose up in the repo root brings up the API, Postgres and a fake payments service seeded with test cards.
What is the retention on orders?
Seven years, legally required. Deletion requests redact PII in place and keep the financial record.
Service overview
The page you want at 3am — owner, architecture, SLOs, dependencies, and common operations.
specblockslotablesteps+1