C4 Level 2 — Containers
Zooming inside the single box from System Context. A container here is C4's meaning of the word: a separately deployable or runnable unit, whether that is a Go process, a Postgres database or the broker. It is unrelated to Docker specifically.
This site covers twenty backend contexts: nineteen domain contexts and
warehouse-ops-agent. Eighteen of the nineteen domain contexts ship four Go binaries
and two databases each, plus a Module Federation frontend remote, because
the analytical read side is a separate process family from the operational
one. fulfillment-execution also ships cmd/sweep, the entrypoint of its two
sweep CronJobs (expire-leases, sweep-cpt-misses), which POSTs the sweep
endpoints of its own Service. warehouse-ops-agent is one binary with no
database. The nineteenth, outbound-shipping (released v0.1.0, registered in
warehouse-infra, not applied), ships two binaries (cmd/api with its consumers and outbox relay,
and a read-only cmd/mcp), one Postgres database, no analytics read side and no
frontend remote. Its Helm chart is merged (PR 17). All twenty have an entry in
warehouse-infra develop's application registry (terraform/apps.yaml;
outbound-shipping since PR 205, image pinned at 857edfd-arm64, applied to k3s since 2026-11-12). Each registered domain
context's entry declares database: true, an analytics: read side and a
frontend_remote:, except outbound-shipping's, which declares database: true only. The five most recent read sides
(slotting-optimization, pick-face-replenishment, task-interleaving,
returns-processing, exception-management) have mcp.enabled: true and
analytics.enabled: true in their value files; returns-processing and
exception-management were registered on 2026-10-22. That is the wiring in
warehouse-infra develop; this page does not record whether a given
cluster has applied it. Binaries are listed from each repository's cmd/ on
origin/develop, and workloads from its Helm chart's templates/.
The edge: two independent gateways
The most commonly misread part of this architecture, so it is drawn first. There are exactly two host-facing product entrypoints and no proxy relationship between them:
The hard constraint behind this split: Kong must never serve HTML, CSS,
JavaScript, fonts or images. Asset delivery is nginx's job, and
warehouse-infra's exposure-policy test fails any change that adds an /api
location to the web gateway. Kong is exposed through the Kubernetes Gateway
API (HTTPRoute, rendered by each chart's httproute.yaml), with plain
Ingress as the fallback when deploy_gateway_api is off.
Three consequences follow, and all three are load-bearing:
- CORS is not optional. Assets come from
http://localhostand APIs fromhttp://localhost:8000, which are genuinely different origins. Kong grants exactly the web gateway's origin, never*. The endpoints are unauthenticated, so a wildcard would let any page on the internet read the warehouse's data through the user's own browser. - Frontends cannot bake in their API base URL. The console fetches
/config.jsonfrom a ConfigMap before it mounts and publishesapiOriginonwindow.__WAREHOUSE_CONFIG__. Every remote reads it from there. - "All APIs through Kong" is a north-south rule only. Service-to-service calls stay on direct ClusterIP and Kafka and never hairpin through either gateway.
The console registers eighteen WMS and WES remotes, one per domain context
except outbound-shipping, which has none:
order_mgmt_mfe, inventory_mfe,
planning_mfe, fulfillment_mfe, workforce_mfe, facility_mfe,
process_path_mfe, labor_mfe, netfulfil_mfe (keyed
network_fulfillment_mfe in the console's federation config),
capacity_mfe (warehouse-planning), productmaster_mfe
(product-master), nip_mfe (network-inventory-planning), inbound_mfe
(inbound-receiving), slotting_mfe, replenishment_mfe
(pick-face-replenishment), task_interleaving_mfe, returns_mfe
(returns-processing) and exceptions_mfe (exception-management). Each is
served at /mfes/<context>/. The same web gateway also serves the eleven
remotes of the retail network services, which are outside this
section. The console's
cross-cutting screens (the order lifecycle and the WMS and WES dashboards)
do not call every service
from the browser. They call warehouse-ops-agent's BFF routes
/console/orders/{id}/lifecycle, /console/reports/wms and
/console/reports/wes, which fan out server-side.
Inside one bounded context: four binaries, two databases
Every persisting bounded context follows the same internal shape.
labor-performance is drawn here as the representative example. Substitute
the names and the diagram holds for all eighteen.
Why the read side is separate processes
This is the estate-level CQRS split. Each context owns its analytical read model as a data product built from its own analytics stream, rather than every context feeding one central warehouse.
| Process | Database access | Guarantee it buys |
|---|---|---|
| OLTP binary | Read-write on the OLTP database | Report queries run against a different database, so they never lock or block operational tables. |
| Projector | Read-write on the analytical database | Exactly one writer, so two racing writers can never corrupt the projection. |
| Reports binary | Sessions opened with default_transaction_read_only=on | A bug in the reader cannot mutate the read model. |
The report is rebuilt purely from events, with no second write from the
OLTP side. That makes it clean but eventually consistent: the contract
is a freshness lag, not real time, which is why every report has a
/freshness endpoint and the console's dashboard cards show it.
The whole fleet at a glance
| Context | OLTP binary | MCP | Projector | Reports | MFE remote | Databases |
|---|---|---|---|---|---|---|
order-management | cmd/order | cmd/mcp | cmd/order-projector | cmd/order-reports | order_mgmt_mfe | 2 |
inventory-storage | cmd/inventory | cmd/mcp | cmd/inventory-projector | cmd/inventory-reports | inventory_mfe | 2 |
wes-work-planning | cmd/wes | cmd/mcp | cmd/wes-projector | cmd/wes-reports | planning_mfe | 2 |
fulfillment-execution | cmd/execution (plus cmd/sweep, the CronJob entrypoint) | cmd/mcp | cmd/fulfillment-projector | cmd/fulfillment-reports | fulfillment_mfe | 2 |
workforce-management | cmd/workforce | cmd/mcp | cmd/workforce-projector | cmd/workforce-reports | workforce_mfe | 2 |
facility-layout | cmd/facility | cmd/mcp | cmd/facility-projector | cmd/facility-reports | facility_mfe | 2 |
process-path-management | cmd/pathmgmt | cmd/mcp | cmd/pathmgmt-projector | cmd/pathmgmt-reports | process_path_mfe | 2 |
labor-performance | cmd/labor | cmd/mcp | cmd/labor-projector | cmd/labor-reports | labor_mfe | 2 |
network-fulfillment | cmd/netfulfil | cmd/mcp | cmd/netfulfil-projector | cmd/netfulfil-reports | netfulfil_mfe | 2 |
warehouse-planning | cmd/api | cmd/mcp | cmd/planning-projector | cmd/planning-reports | capacity_mfe | 2 |
product-master | cmd/api | cmd/mcp | cmd/product-projector | cmd/product-reports | productmaster_mfe | 2 |
network-inventory-planning | cmd/network-inventory-planning | cmd/mcp | cmd/nip-projector | cmd/nip-reports | nip_mfe | 2 |
inbound-receiving | cmd/api | cmd/mcp | cmd/inbound-projector | cmd/inbound-reports | inbound_mfe | 2 |
slotting-optimization | cmd/api | cmd/mcp | cmd/slotting-projector | cmd/slotting-reports | slotting_mfe | 2 |
pick-face-replenishment | cmd/api | cmd/mcp | cmd/pfr-projector | cmd/pfr-reports | replenishment_mfe | 2 |
task-interleaving | cmd/api | cmd/mcp | cmd/ti-projector | cmd/ti-reports | task_interleaving_mfe | 2 |
returns-processing | cmd/api | cmd/mcp | cmd/returns-projector | cmd/returns-reports | returns_mfe | 2 |
exception-management | cmd/api | cmd/mcp | cmd/exceptions-projector | cmd/exceptions-reports | exceptions_mfe | 2 |
warehouse-ops-agent | cmd/agent | in-process at /mcp | none | none | none | 0 |
Per-context table counts are in Data Models, and aggregate counts are in Domain Model.
warehouse-ops-agent is the deliberate exception on every axis. It has one
binary and no database, and holds no persisted state: every fact it
reasons over is re-derived from upstream MCP and REST reads at request time.
It is a Customer of the other contexts' Open Host Services, with no aggregate
of its own. It is also the only context whose MCP server shares a process and
port with its main binary.
The port convention
| Workload | Listen address | Env var | Kubernetes Service |
|---|---|---|---|
| OLTP | :8080 | HTTP_ADDR | :80 to 8080 |
| MCP | :8090 | MCP_ADDR | :8090 to 8090 |
| Projector | :8091 | ADMIN_ADDR | none: admin and health only |
| Reports | :8092 | HTTP_ADDR | <context>-reports, :80 to 8092 |
| Frontend (nginx) | :8080 | — | :80 to 8080 |
warehouse-ops-agent | :8095 | AGENT_ADDR | REST and /mcp on one port |
Each chart's Services select on app.kubernetes.io/component as well as the
name and instance labels, so the OLTP, MCP, projector and reports pods of one
release are addressed separately.
Where the databases actually live
The logical separation is real, but the physical deployment has less
isolation than the diagram might suggest. One Postgres release
(postgres, in the data namespace) hosts forty-seven databases in
warehouse-infra develop's registry: an OLTP database and a
<service>_analytics database for each of the eighteen domain contexts
(thirty-six), plus the OLTP-only databases of the eleven
retail network services registered in the same
terraform/apps.yaml. Each database has its own generated role. OLTP
connections go through PgBouncer. Analytics connections go to Postgres
directly.
In the local cluster a single generated analytics role serves both the
projector and the reports binary (each chart's reportsUrl falls back to
projectorUrl; the registry entries of network-fulfillment,
pick-face-replenishment, task-interleaving, returns-processing and
exception-management provision only ANALYTICS_DATABASE_URL, which both
binaries read). The read-only guarantee therefore comes from the reports
binary's read-only sessions. A distinct read-only role is the documented
promotion path in warehouse-infra.
MCP servers
Every domain context ships a cmd/mcp binary that serves MCP over
Streamable HTTP on :8090, and warehouse-ops-agent serves its own read-only
tools in-process at /mcp. Like REST, MCP is unauthenticated
fleet-wide.
The main MCP consumer inside the fleet is warehouse-ops-agent, which calls
upstream tools such as get_rebalance_recommendation,
get_backlog_telemetry, get_staffing_gap, diagnose_stuck_tasks,
get_task_type_utilization, check_availability, estimate_travel_distance
get_process_path_capacity, product-master's list_products (for
find_master_data_gaps) and network-inventory-planning's get_transfer,
find_stuck_transfers and simulate_transfer_options (its transfer watch), and inbound-receiving's
list_asns, list_appointments and list_receipts (its inbound outlook). Several more are wired but unused.
labor-performance and process-path-management call no sibling over REST or
MCP. The per-tool status is on each context's
Context Map page.
Kafka: one broker, two topic families
There is exactly one Kafka broker platform-wide: a single combined
controller and broker in KRaft mode. Business topics are auto-created with
eight partitions. Most consumers dead-letter messages they cannot process to
<topic>.dlq. The exception is network-inventory-planning, whose five OLTP
consumers log and commit past deterministic failures and have no dead-letter topic;
only its analytics projector dead-letters.
Two distinct topic families run over it, and conflating them is a common misreading:
- Integration topics are the published language between bounded contexts. They are the edges on the Context Map.
- Analytics topics feed only that context's own projector. They are kept off the integration topics so that adding a report never changes a contract another context depends on.
Both families carry exactly one envelope: CloudEvents 1.0 in structured
content mode, with content-type: application/cloudevents+json; charset=UTF-8 on every message and type of the form
com.warehouse.<wms|wes>.<context>.<entity>.<EventName>. See the
Event Standard.
Integration topics
Who publishes what, and who consumes it, from each context's
apis/asyncapi.yaml and Kafka adapters on origin/develop and its context
map. Each topic is drawn once, on the left, with its producer; its consumers
are on the right. A dashed edge marks an opt-in consumer, one that stays
off unless its mode or consumer group is configured; solid edges are the
rest. Which types travel on each edge is in the table below the diagram, and
the per-edge status (live, wired-but-unused) is on the
Context Map.
| Topic | Producer | Integration types | Consumers |
|---|---|---|---|
warehouse.order-management.events | order-management | 4 | wes-work-planning (OrderAllocated, OrderPartiallyAllocated); warehouse-planning, opt-in; network-inventory-planning (SiteSkuDemandChanged), opt-in; slotting-optimization (SiteSkuDemandChanged, opt-in); returns-processing (OrderAllocated, OrderPartiallyAllocated, into its allocated-lines copy); exception-management (OrderRepromised, correlation only: it auto-resolves an open TaskCPTMissed case) |
warehouse.inventory.events | inventory-storage | 15 | wes-work-planning (StockReserved, ReservationRevoked); slotting-optimization (StockRelocated, opt-in: the plan execution progress); pick-face-replenishment (StockRelocated, acted on only for reason REPLENISHMENT, and BinStockLevelChanged, both opt-in); network-inventory-planning (the two allocation replies and the two destination facts, opt-in); exception-management (DiscrepancyDetected, ItemUnlocated, promoted onto this topic 2026-10-21) |
warehouse.work-planning.events | wes-work-planning | 11 | fulfillment-execution (WorkReleased, including RELOCATE and REPLENISH work); order-management and network-fulfillment (PathCapacityChanged); order-management (WorkUnitCreated, the release confirmation, opt-in and not set in the reference deployment); exception-management (BacklogThresholdBreached) |
warehouse.fulfillment.events | fulfillment-execution | 10 | wes-work-planning and labor-performance (TaskCompleted); warehouse-planning (TaskCompleted, the observed-capacity read model, its ADR 0017); inventory-storage (TaskCompleted, opt-in: confirms picks and applies RELOCATE and REPLENISH moves); task-interleaving (TaskAvailable, TaskClaimed, TaskCompleted, opt-in); order-management (TaskCPTMissed, PackageManifested); network-inventory-planning (the three transfer facts, opt-in); returns-processing (PackageManifested); exception-management (TaskCPTMissed, PackageDiverted, WeightDiscrepancyDetected) |
warehouse.workforce.events | workforce-management | 1 | wes-work-planning, warehouse-planning (ShiftPlanCommitted) |
warehouse.facility.events | facility-layout | 15 | inventory-storage, warehouse-planning, network-inventory-planning (SiteCapabilityChanged, opt-in), inbound-receiving (the two slot events, opt-in); slotting-optimization (zone and slot events, opt-in); pick-face-replenishment (ZoneRegistered, LocationSlotRegistered, LocationSlotDecommissioned, opt-in); task-interleaving (the same three plus LocationGeometryUpdated, opt-in) |
warehouse.process-path-management.events | process-path-management | 4 | fulfillment-execution, wes-work-planning, workforce-management, order-management, network-fulfillment |
warehouse.labor-performance.events | labor-performance | 1 | workforce-management (TaskPerformanceRecorded) |
warehouse.warehouse-planning.events | warehouse-planning | 6 | order-management, opt-in; network-inventory-planning (CapacityPlanPublished), opt-in |
warehouse.network-fulfillment.events | network-fulfillment | 7 | exception-management (AcknowledgementDeadlineAtRisk, OrphanedHoldCancelled); the networkorder.* types have no consumer |
warehouse.network-inventory-planning.events | network-inventory-planning | 3 | inventory-storage (TransferAllocationRequested, opt-in); wes-work-planning (WorkDemandReleased); TransferPlanApproved has no consumer |
warehouse.product-master.events | product-master | 8 | inventory-storage, order-management, wes-work-planning, fulfillment-execution (ProductClassified, into local copies); the pack-level events (ProductPackLevelDeclared, ProductPackLevelRetired), into a local packaging view, have consumers built in seven contexts: inventory-storage, wes-work-planning, fulfillment-execution, inbound-receiving, slotting-optimization, network-inventory-planning and pick-face-replenishment (the per-edge status is on the context map); inbound-receiving (ProductRegistered, opt-in); slotting-optimization (ProductClassified, ProductDimensionsDeclared, ProductMeasured, opt-in); returns-processing (ProductClassified) |
warehouse.inbound-receiving.events | inbound-receiving | 11 | inventory-storage (ReceiptLineReceived, opt-in, its ADR 0037, and ReceiptCartonReceived); warehouse-planning (DockAppointmentBooked, DockAppointmentCancelled, its ADR 0017); network-fulfillment (the receipt events of the ASNs it registered, live mode only, its ADR 0028); exception-management (CartonDiscrepancyRaised) |
warehouse.slotting-optimization.events | slotting-optimization | 3 | wes-work-planning (SlotPlanApproved, plans one RELOCATE work unit per move, its ADR-0040); pick-face-replenishment (SlotPlanApproved, opt-in); SlotPlanGenerated and SlotPlanRejected have no consumer |
warehouse.pick-face-replenishment.events | pick-face-replenishment | 3 | wes-work-planning (ReplenishmentRequested and ReplenishmentCancelled, plans one REPLENISH work unit per request, its ADR-0042; opt-in REPLENISHMENT_MODE=kafka, set in the reference deployment); ReplenishmentCompleted has no consumer (wes-work-planning ignores it) |
warehouse.task-interleaving.events | task-interleaving | 1 | fulfillment-execution (InterleavingHintIssued, an advisory tie-break inside one claimNext priority band, its ADR 0051; TASK_INTERLEAVING_MODE=kafka) |
warehouse.returns-processing.events | returns-processing | 7 | inventory-storage (ReturnLineStaged, once per RESTOCK disposition, into its staged-receipt use case, its ADR 0044); exception-management (UnexpectedReturnReceived, one case per receipt line); the other five types have no consumer |
warehouse.exception-management.events | exception-management | 7 | none: no context consumes any of its seven types |
warehouse.outbound-shipping.events | outbound-shipping (released v0.1.0, registered, applied to k3s since 2026-11-12) | 13 | order-management (ShipmentConfirmed, PackageMissedLoad, its ADR 0051; dark unless OUTBOUND_SHIPPING_CONSUMER_MODE=kafka); exception-management (PackageMissedLoad, its ADR 0011); LoadingStarted, LoadClosed and LoadReopened toward yard-management have no handler, and ShipmentConfirmed toward network-fulfillment is built on its develop (2026-11-12, its PR 165) but not running yet (its image predates the merge); the other eight types are analytics-only by design |
The type counts are the messages each producer's asyncapi.yaml declares on
its integration channel (counted on origin/develop, 2026-10-27; the
outbound-shipping row on 2026-11-09). outbound-shipping is registered in
warehouse-infra develop (PR 205) but not applied, so it
has no pod, no topic in the cluster and none of the diagrams above; it also
consumes five sibling topics (warehouse.fulfillment.events,
warehouse.process-path-management.events, warehouse.facility.events,
warehouse.dock-scheduling.events, warehouse.yard-management.events),
which are not in the consumer columns above (context map K67 to K71). The
consumers come from each consumer's own asyncapi.yaml plus its Kafka
adapters on develop: several consumers' specs omit a type their code
consumes (the pack-level consumers of wes-work-planning, fulfillment-execution,
slotting-optimization and network-inventory-planning, and
network-fulfillment's receipt consumer). Several consumers are themselves behind a mode
switch (for example PATH_CATALOGUE_SOURCE=kafka or
LOCATION_LOOKUP_MODE=kafka). The per-edge status is on each context's
context map page.
Analytics topics
One per domain context, consumed only by that context's own projector:
warehouse.order-management.analytics, warehouse.inventory.analytics,
warehouse.wes.analytics (wes-work-planning), warehouse.fulfillment.analytics,
warehouse.workforce.analytics, warehouse.facility.analytics,
warehouse.process-path-management.analytics,
warehouse.labor-performance.analytics,
warehouse.network-fulfillment.analytics,
warehouse.warehouse-planning.analytics,
warehouse.product-master.analytics,
warehouse.network-inventory-planning.analytics,
warehouse.inbound-receiving.analytics,
warehouse.slotting-optimization.analytics,
warehouse.pick-face-replenishment.analytics (its three request events plus
the analytics-only ReplenishmentPolicyDeclared),
warehouse.task-interleaving.analytics (the hint, its outcomes and the
policy event), warehouse.returns-processing.analytics and
warehouse.exception-management.analytics (seven types each, mirroring
their integration topics). Each of the eighteen has a projector binary on
develop (cmd/<prefix>-projector, see the fleet table above).
What this diagram does not show
- Replica counts and autoscaling. Those live in each chart's
hpa.yamlandwarehouse-infra's values. Drawing them here would go stale immediately. - The observability stack. Every binary exports OTLP traces and metrics to a collector, with Jaeger, Prometheus/Grafana and Loki behind it. It is drawn at level 1 and omitted here to keep the product topology readable.
- Any authentication container, because there is none. Every REST and MCP endpoint in the fleet is unauthenticated.
Zoom in one more level to see inside a single Go process: Components.