Design an inventory management system for an e-commerce business.
The system must support:
-
Updating stock when inventory is received, adjusted, or sold.
-
Reserving items when a shopper starts checkout (to prevent overselling).
-
A “shopper collects items” workflow (e.g., curbside pickup / warehouse picking): an API call that marks items as collected/picked and updates inventory accordingly.
Focus areas:
-
Database schema design.
-
Achieving high consistency (avoid overselling, correct reservation handling under concurrency).
-
Core APIs and their request/response semantics.
-
Handling race conditions, retries, and idempotency.
-
Reasonable scaling approach (multiple SKUs, multiple warehouses/locations).