Inventory & Storage
This documentation site is an educational Domain-Driven Design exercise. It follows real industry-standard patterns and terminology, but it is not a production system and is not affiliated with, endorsed by, or representative of any real-world company.
Inventory & Storage is the WMS-tier authoritative record of what is held where, and what portion of it is usable.
It is one of the Go services that make up the warehouse-systems platform.
This one sits in the WMS tier (the "what and where" layer) and is a Core
subdomain: it owns inventory truth. Everything else on the platform — work
planning, labour, task execution — asks this service what stock reality is,
and none of them are allowed to write to its aggregates.
The one sentence that explains the design
Every physical item has exactly one known bin, or it is flagged
Unlocated.
That is the invariant the whole bounded context exists to protect. Chaotic
stow, the item-scan + location-scan rule, cycle counting, and the Unlocated
state are all consequences of taking that sentence literally.
What it owns
| Capability | What that means here |
|---|---|
| Stock ledger | StockUnit aggregates — a quantity of a SKU at a specific bin, with a lifecycle state. |
| Bin-accurate location | Chaotic (random) stow: any SKU may occupy any free bin; the system records the exact bin it landed in. |
| Capacity enforcement | A Bin has a capacity; the sum of stock stowed into it may never exceed that capacity. |
| Revocable reservations | Allocation is a Reservation with a timeout that can always be revoked and re-satisfied from a different physical holding. |
| Usable inventory | The read model that actually constrains release: on-hand minus active reservations minus held/unlocated stock. |
| Cycle counting | Verifying a bin's physical contents against system records, reconciling shortfalls by flagging stock Unlocated. |
What it deliberately does not own
Naming the boundary is as important as naming the capability. This service:
- does not pick, pack, ship, or route associates — that is
fulfillment-execution(task lifecycle) andwes-work-planning(release and flow balance); - does not plan labour or headcount — that is
workforce-management; - does not own product master data — SKU handling classification (hazmat,
temperature class, DOT hazard class) belongs to
product-master; this service keeps a local copy of it for its stow placement and DOT segregation rules (ADR 0034); - does not model the physical building (site, area, zone, aisle, bay,
level, position) — that is
facility-layout, a separate Generic subdomain; - does not decide what to buy or forecast demand — that is upstream of the whole platform;
- does not decide what a bin physically is —
PUT /bins/{binId}(ADR 0025) only registers a bin id and its capacity so this service can enforce occupancy; the slot's place in the building staysfacility-layout's.
Per warehouse-systems-ddd.md, keeping worker identity, real-time floor
conditions and task sequencing out of the inventory system of record is what
lets that record stay stable and auditable while labour policy changes weekly.
How it fits with its neighbours
Source: internal/adapters/outbound/kafka/publisher.go, internal/adapters/outbound/facilitycache/consumer.go, internal/adapters/inbound/kafka/product_master_consumer.go; sibling edges from the context map.
Solid edges are Kafka topics; the dotted edge is a synchronous REST call
into this service (order-management is the only command caller among the
sibling contexts; network-fulfillment and warehouse-ops-agent only
read). Two topics feed this service's stow rules: facility-layout's, cached
for zone attributes (ADR 0013), and product-master's, kept as the local
product classification copy (ADR 0034). See
the context map for every wire, including the
other consumed topics (TaskCompleted, ADR 0035; network-inventory-planning's
transfer commands, ADR 0030) and the synchronous callers.
Where to go next
- Architecture — the hexagonal layering and the strict dependency rule, enforced by executable fitness tests.
- Quickstart — run the service and exercise every
endpoint with
curl. - Domain vision — why this service exists in this shape.
- API Reference — generated from the real,
Spectral-linted
apis/openapi.yaml. - DDD artifacts (ddd-crew) — core domain chart, bounded context canvas, aggregate design canvas, EventStorming, message flows, UML/ER/sequence diagrams, all derived from the code.
- ADRs — the consequential decisions, in Nygard format.
- Configuration — every environment variable of the four binaries.
- Runbook, Observability and Troubleshooting — deploying, watching and fixing it.
- Testing — the test pyramid,
maketargets and CI jobs. - Integration and MCP tools — every upstream, downstream and agent-facing contract.
- Use cases and Subdomain classification.
This project is a domain-driven design study. It is not associated with, endorsed by or affiliated with any company, and it uses no company's code, data, logos or trademarks. All names, figures and examples are illustrative or synthetic.