Course
Distributed Systems: What Happens When Things Fail?
Partial failure, timeouts, backoff, idempotency, consistency and compensation, from first principles, in TypeScript, with every failure simulated on your own machine.
Final challenge
Implement and test a checkout flow that never charges or ships twice, while the network loses messages, replies arrive late, the provider is overloaded, customers double-click and your own process crashes. A chaos test checks it against ground truth across many seeded worlds. Passing it unlocks No duplicates. The brief and pass criteria are in Final: a checkout that never charges twice.
Reference
- Partial failure: the fault table, what a caller can know, vocabulary
- Timeouts and deadlines: choosing from percentiles,
withTimeout, deadline propagation - Retries, backoff and jitter: what to retry, the formula, budgets, amplification
- Idempotency keys: the state machine, the table, status codes
- Consistency and the outbox: dual writes, outbox, inbox, delivery guarantees
- The whole flow: the checkout, its invariants, the chaos test
- Compensation and sagas: refunds through the outbox, webhooks, the saga invariant
The lab is one project, labs/payflow/, that grows across all seven lessons into the final deliverable. Start with its README.md. No install needed: Node 22.18 or newer runs it directly.