System Design: Inventory Management with Real-Time Stock and Ordering
Context
You are designing an inventory management service for a retail/marketplace platform with multiple merchants and locations (stores, dark stores, warehouses). Inventory must stay accurate across web/app ordering and in-store sales, with real-time updates to shoppers and partner systems. Assume high read volume (availability checks) and moderate write volume (stock changes, orders).
Task
Design an inventory management system that supports:
-
Stock tracking (on-hand, reserved, available) across multiple locations and merchants.
-
Ordering flows with reservation/commit/release semantics to prevent overselling.
-
Real-time updates to clients and partner integrations when availability changes.
-
Discussion of:
-
Key components/services and their responsibilities.
-
Core data model and relationships.
-
External and internal APIs (including idempotency and error handling).
-
Scalability strategies for reads/writes and hot SKUs.
-
Consistency and concurrency control (isolation levels, conflicts, eventual vs strong consistency).
State any assumptions you make and justify trade-offs where relevant.