Inventory and Order Management

Reserve stock, place orders, and handle payment and cancellation without overselling.

Medium45 minReservationsOrder state machineIdempotency

Design an inventory and order management system for an e-commerce store: track stock across warehouses, reserve it when orders are placed, and move orders through payment, fulfilment, and cancellation without overselling. The heart of it is a reservation model plus an order state machine.

Requirements

Functional

  • Products (SKUs) with stock per warehouse.
  • Customers place orders with multiple line items; stock is reserved at checkout and committed when payment succeeds.
  • Reservations expire if payment isn't completed within 15 minutes.
  • Order lifecycle: CREATED -> RESERVED -> PAID -> PACKED -> SHIPPED -> DELIVERED, plus CANCELLED and RETURNED.
  • Cancel before shipping releases stock; returns restock after inspection.
  • Low-stock alerts to purchasing; admins can adjust stock (restock, damage write-off).

Non-functional

  • Never oversell, even during a flash sale with heavy contention on one SKU.
  • Idempotent order placement and payment callbacks (clients and gateways retry).
  • Auditable: every stock change recorded with a reason.

Try it first

Set a timer, sketch your own design on paper, then compare it with the reference walkthrough.

45:00

Complete & continue

Defend it out loud

The AI interviewer will probe your design for Inventory and Order Management and score it.

Mock interview