Notes and small code sketches from Designing Data-Intensive Applications, framed around payment scenarios. Each folder pairs a "legacy / broken" version with a "modern / fixed" version so you can read them side-by-side.
Implementations are intentionally toy / mocked — in-memory dicts,
time.sleep()for replication lag, an in-process queue standing in for Kafka. The goal is to make the pattern legible, not to ship production code.
| Showcase | Problem it solves | DDIA |
|---|---|---|
immediate-balance-refresh/ |
User pays, dashboard still shows old balance (replication lag) | Ch. 5 — Read-your-writes |
payrun-batch-to-stream/ |
Cron-polled batch payments → real-time stream processing | Ch. 11 — Stream Processing |
offline-transactions/ |
Tap-to-pay on a plane with no internet (edge computing + EMV) | — |
high-volume-customers/ |
Hot-shard behavior when one merchant dominates traffic | Ch. 6 — Partitioning |
Python files are plain stdlib — run any with python <file>.py. The simulator is high-volume-customers/index.html; open it in a browser.