Coffee please
Prevent double-charges and duplicate orders during peak demand and retries.
Kata overview
You do not need to be an expert to start. This kata keeps the stakes low so you can explore trade-offs, adjust the diagram, and see how the system responds.
Context for this system design kata
Prevent double-charges and duplicate orders during peak demand and retries. This system design kata keeps the stakes low so you can rehearse trade-offs before taking ideas into production reviews.
Scenario and practice focus
During morning rush, customers place order-ahead purchases and repeatedly check status. When downstream payment processing becomes slow or flaky, customers retry and refresh. The platform must preserve correctness: no double-charge, no duplicate orders, and a status view that converges to the truth — while keeping checkout responsive.
Difficulty: Beginner–Intermediate. Estimated time: 45–75 min. Domain: Retail Technology.
Constraints to balance
Operational pressure
- No manual steps in the loop
- Payment provider latency and error rates can degrade unpredictably
Customer and product constraints
- Must prevent double-charge and duplicate order creation under retries
- Keep estimated monthly cost at peak demand within budget
Scenarios to explore in the simulator
- Prevent double-charges and duplicate orders under retries.
- Keep checkout acknowledgement responsive during peak.
- Ensure order status converges reliably after temporary downstream slowdowns.
- Award loyalty points exactly once per completed purchase.
- Maintain predictable cost at peak without over-provisioning the entire stack.
Learning outcomes
- Design idempotent order creation and payment confirmation under retries.
- Choose a consistency stance that preserves customer trust during brownouts.
- Separate acknowledgement from confirmation while keeping UX predictable.
- Evaluate duplicate rates, confirmation lag, and read-model convergence over time.
Give it a try!