Skip to main content

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:

  1. CORS is not optional. Assets come from http://localhost and APIs from http://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.
  2. Frontends cannot bake in their API base URL. The console fetches /config.json from a ConfigMap before it mounts and publishes apiOrigin on window.__WAREHOUSE_CONFIG__. Every remote reads it from there.
  3. "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.

ProcessDatabase accessGuarantee it buys
OLTP binaryRead-write on the OLTP databaseReport queries run against a different database, so they never lock or block operational tables.
ProjectorRead-write on the analytical databaseExactly one writer, so two racing writers can never corrupt the projection.
Reports binarySessions opened with default_transaction_read_only=onA 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​

ContextOLTP binaryMCPProjectorReportsMFE remoteDatabases
order-managementcmd/ordercmd/mcpcmd/order-projectorcmd/order-reportsorder_mgmt_mfe2
inventory-storagecmd/inventorycmd/mcpcmd/inventory-projectorcmd/inventory-reportsinventory_mfe2
wes-work-planningcmd/wescmd/mcpcmd/wes-projectorcmd/wes-reportsplanning_mfe2
fulfillment-executioncmd/execution (plus cmd/sweep, the CronJob entrypoint)cmd/mcpcmd/fulfillment-projectorcmd/fulfillment-reportsfulfillment_mfe2
workforce-managementcmd/workforcecmd/mcpcmd/workforce-projectorcmd/workforce-reportsworkforce_mfe2
facility-layoutcmd/facilitycmd/mcpcmd/facility-projectorcmd/facility-reportsfacility_mfe2
process-path-managementcmd/pathmgmtcmd/mcpcmd/pathmgmt-projectorcmd/pathmgmt-reportsprocess_path_mfe2
labor-performancecmd/laborcmd/mcpcmd/labor-projectorcmd/labor-reportslabor_mfe2
network-fulfillmentcmd/netfulfilcmd/mcpcmd/netfulfil-projectorcmd/netfulfil-reportsnetfulfil_mfe2
warehouse-planningcmd/apicmd/mcpcmd/planning-projectorcmd/planning-reportscapacity_mfe2
product-mastercmd/apicmd/mcpcmd/product-projectorcmd/product-reportsproductmaster_mfe2
network-inventory-planningcmd/network-inventory-planningcmd/mcpcmd/nip-projectorcmd/nip-reportsnip_mfe2
inbound-receivingcmd/apicmd/mcpcmd/inbound-projectorcmd/inbound-reportsinbound_mfe2
slotting-optimizationcmd/apicmd/mcpcmd/slotting-projectorcmd/slotting-reportsslotting_mfe2
pick-face-replenishmentcmd/apicmd/mcpcmd/pfr-projectorcmd/pfr-reportsreplenishment_mfe2
task-interleavingcmd/apicmd/mcpcmd/ti-projectorcmd/ti-reportstask_interleaving_mfe2
returns-processingcmd/apicmd/mcpcmd/returns-projectorcmd/returns-reportsreturns_mfe2
exception-managementcmd/apicmd/mcpcmd/exceptions-projectorcmd/exceptions-reportsexceptions_mfe2
warehouse-ops-agentcmd/agentin-process at /mcpnonenonenone0

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​

WorkloadListen addressEnv varKubernetes Service
OLTP:8080HTTP_ADDR:80 to 8080
MCP:8090MCP_ADDR:8090 to 8090
Projector:8091ADMIN_ADDRnone: admin and health only
Reports:8092HTTP_ADDR<context>-reports, :80 to 8092
Frontend (nginx):8080—:80 to 8080
warehouse-ops-agent:8095AGENT_ADDRREST 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.

TopicProducerIntegration typesConsumers
warehouse.order-management.eventsorder-management4wes-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.eventsinventory-storage15wes-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.eventswes-work-planning11fulfillment-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.eventsfulfillment-execution10wes-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.eventsworkforce-management1wes-work-planning, warehouse-planning (ShiftPlanCommitted)
warehouse.facility.eventsfacility-layout15inventory-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.eventsprocess-path-management4fulfillment-execution, wes-work-planning, workforce-management, order-management, network-fulfillment
warehouse.labor-performance.eventslabor-performance1workforce-management (TaskPerformanceRecorded)
warehouse.warehouse-planning.eventswarehouse-planning6order-management, opt-in; network-inventory-planning (CapacityPlanPublished), opt-in
warehouse.network-fulfillment.eventsnetwork-fulfillment7exception-management (AcknowledgementDeadlineAtRisk, OrphanedHoldCancelled); the networkorder.* types have no consumer
warehouse.network-inventory-planning.eventsnetwork-inventory-planning3inventory-storage (TransferAllocationRequested, opt-in); wes-work-planning (WorkDemandReleased); TransferPlanApproved has no consumer
warehouse.product-master.eventsproduct-master8inventory-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.eventsinbound-receiving11inventory-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.eventsslotting-optimization3wes-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.eventspick-face-replenishment3wes-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.eventstask-interleaving1fulfillment-execution (InterleavingHintIssued, an advisory tie-break inside one claimNext priority band, its ADR 0051; TASK_INTERLEAVING_MODE=kafka)
warehouse.returns-processing.eventsreturns-processing7inventory-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.eventsexception-management7none: no context consumes any of its seven types
warehouse.outbound-shipping.eventsoutbound-shipping (released v0.1.0, registered, applied to k3s since 2026-11-12)13order-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.yaml and warehouse-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.