Preparing your design workspace

Loading the problem and your saved attempt…

Design an Order and Inventory Coordination Domain

Model order placement, all-or-nothing stock reservation, cancellation, and fulfillment while preserving inventory invariants under retries and races.

For this exercise, assume one sales channel and one authoritative stock pool. A customer places an order containing one or more unique SKU quantities. Placement must reserve every requested quantity atomically or reject the whole order without changing stock.

A reserved order may be cancelled, which releases its reservation, or fulfilled, which commits the reserved units as removed from on-hand stock. Each command carries a stable request ID: an exact retry returns the original outcome, while reuse with a different payload is rejected.

Concurrent commands must never oversell stock or let cancellation and fulfillment both consume the same reservation. Design the objects, interfaces, transaction boundaries, and interaction flows. Exclude pricing, payment, shipping, supplier procurement, returns, and multiple warehouses.