Design an inventory management system for a large retailer or e-commerce company operating multiple warehouses. The system must track real-time stock levels across all locations, process order fulfillment with accurate inventory deductions, support receiving and adjusting stock, trigger automated reordering when quantities drop below thresholds, and generate inventory reports. Warehouse staff, e-commerce platforms, and supply-chain systems all interact with inventory data concurrently.
The core engineering challenges are preventing overselling under high concurrency (the classic double-booking problem applied to stock units), orchestrating multi-step order fulfillment workflows that span reservation, payment, picking, and shipping, separating heavy analytical queries from the transactional write path, and providing real-time visibility into inventory movements. You will need to reason about contention management, saga-based workflows, event-driven architecture, and CQRS patterns.
Based on real interview experiences at Blue Origin, these are the areas interviewers probe most deeply:
The defining challenge. Hundreds of concurrent order-fulfillment operations, receiving events, and cycle counts all modify the same inventory records. Interviewers want to see explicit strategies for preventing race conditions without killing throughput.
Hints to consider:
An order moves through reservation, payment authorization, picking, packing, shipping, and potentially returns. Each step can fail independently. Interviewers expect saga-based orchestration with compensation.
Hints to consider:
Operators, dashboards, and downstream systems need immediate visibility into every inventory movement. Interviewers evaluate how you propagate changes without coupling producers to consumers.
Hints to consider:
Running heavy reports (inventory valuation, turnover analysis, demand forecasting) against the primary transactional database degrades order-processing performance. Interviewers look for explicit read/write separation.
Hints to consider:
When an order can be fulfilled from multiple warehouses, the system must select the optimal source based on inventory availability, proximity to the shipping destination, and warehouse capacity.
Hints to consider:
Confirm the number of warehouses, SKU count, and peak transaction volume. Ask whether the system serves a single e-commerce platform or multiple sales channels (marketplace, retail stores, wholesale). Clarify the fulfillment model: does the warehouse do picking and packing, or is it drop-ship? Determine reporting SLAs: are real-time dashboards required, or are hourly batch reports sufficient? Verify whether the system integrates with external ERP or warehouse-management hardware (barcode scanners, conveyor systems).
Sketch the main components. Inventory service: owns stock levels, handles reservations, adjustments, and transfers; backed by PostgreSQL sharded by warehouse ID. Order fulfillment service: orchestrates the saga from reservation through shipping. Routing service: selects the optimal warehouse for each order. Reorder service: monitors stock levels and creates purchase orders when thresholds are breached. Event stream (Kafka): carries inventory-movement events for downstream consumers. Cache layer (Redis): caches available quantities for fast reads and routing decisions. Analytics database (ClickHouse): receives CDC from PostgreSQL for reporting and demand forecasting. API gateway: routes requests from e-commerce platforms, warehouse devices, and admin dashboards.
Walk through the reservation path. An order arrives from the e-commerce platform. The routing service queries Redis for per-warehouse availability and selects the best warehouse. The inventory service starts a PostgreSQL transaction: it executes UPDATE inventory SET available_qty = available_qty - :requested, reserved_qty = reserved_qty + :requested WHERE sku_id = :sku AND warehouse_id = :wh AND available_qty >= :requested. If the update affects one row, the reservation succeeds; the service inserts a reservation record with an expiration timestamp, writes an inventory-movement event to the outbox table, and commits the transaction. A background process publishes the outbox event to Kafka. If the update affects zero rows (insufficient stock), the service returns an error and the router retries with the next warehouse. Discuss how this single atomic UPDATE prevents overselling without explicit locks, and how the reservation TTL ensures abandoned orders release stock.
Cover the fulfillment saga: payment authorization, picking assignment, packing confirmation, shipping label generation, and carrier handoff, with compensation at each step. Discuss reordering: a Kafka consumer tracks inventory levels and triggers purchase orders when available quantity minus reserved quantity falls below the reorder point, factoring in lead time and demand velocity. Address analytics: CDC from PostgreSQL to ClickHouse for inventory valuation, turnover rates, and demand forecasting. Mention monitoring: track reservation latency, saga completion rate, stock discrepancy alerts, and Kafka consumer lag. Discuss scaling: shard PostgreSQL by warehouse ID, scale the inventory service horizontally, and use read replicas for non-critical queries.