How would you design an e-commerce platform?
Practice this questionShort explanation:
An e-commerce system coordinates browsing, stock, orders and payments, which have different consistency needs. Catalog reads can often be cached, while stock reservation and order/payment transitions need stronger protection. External payments introduce uncertain outcomes that require durable state and reconciliation.
Key points:
-
Separate catalog, cart, order, inventory and payment responsibilities.
-
Reserve stock safely and make checkout/payment requests idempotent.
-
Verify payment events and reconcile partial failures; do not trust only the browser's success page.
-
Model order state transitions explicitly and give checkout/payment attempts stable idempotency keys.
-
Release expired reservations safely, and verify provider events before changing an order to paid.
Interview point:
- Walk through successful payment followed by a lost callback; the design should recover without charging the customer twice.