Retail network · Generic domain · EventStorming board
customer-ordering
Takes a shopper's order at checkout with a confirmed delivery promise for every shipment group, and follows each group until it is delivered, lost, returned or cancelled.
- events published
- 3
- commands
- 18
- policies
- 27
- read models
- 4
- hot spots
- 5
The story in 2 key events
The pivotal events: the few that matter most, in the order they happen.
Listens to (3): contexts whose events this one reacts to
Tells (3): contexts that react to its events
The board, row by row
18 rows, in the order the business story happens: the main path first, then how this context reacts to the others, then the clock. Rows are small stories; read each one left to right.
- Event
- Command
- Actor
- Aggregate
- Policy
- Read model
- External system
- Hot spot
- Opportunity
-
Register a shopper
A shopper is registered with an e-mail, which can be used only once, and may start with saved delivery addresses. This is a test shopper, with no real account behind it.
ActorShopperCommandRegisterShopper POST /shoppersAggregateShopperSource: application/usecases/shopper.go · domain/shopper/shopper.go
-
Save a delivery address
A shopper saves an address to reuse at checkout, up to twenty. At checkout the address is copied into the order, so later edits never change a placed order.
ActorShopperCommandAddSaved POST /shoppers/{shopperId}/addressesAddress AggregateShopperSource: application/usecases/shopper.go · domain/shopper/shopper.go
-
Place an order
Checkout makes and confirms a delivery promise for each shipment group, and only then stores the order. If an offer is stale, nothing is placed and fresh offers come back. Nothing is placed if delivery-promise is down.
ActorShopperRead modelSaved addresses of the shopperCommandPlaceOrder POST /checkoutAggregateCustomerOrder EventCustomerOrder Placed Systemorder-sourcing PolicyQueues one assignment for each shipment groupSystemdelivery-promise PolicyConfirms any promise still provisionalSource: application/usecases/checkout.go · domain/customerorder/place.go · adapters/outbound/deliverypromise/gateway.go
-
Release holds a failed checkout left behind
If a later group fails to confirm, the promises already confirmed are cancelled. A cancel that itself fails is queued and retried until delivery-promise lets the capacity go.
TimeCompensation workerPolicyEvery pass, retry the promise cancels a failed checkout could not performRead modelQueue of failed cancelsCommandCancelPromise a background jobSystemdelivery-promise PolicyCancels the confirmed promise and returns its capacitySource: adapters/outbound/compensation/worker.go · application/compensation/compensation.go · application/usecases/checkout.go
-
Ask to cancel an order
The shopper asks to cancel every group not yet locked. It is a request: the group waits until order-sourcing answers, and a vendor that ships first wins.
ActorShopperCommandCancelOrder POST /orders/{orderId}/cancellationsAggregateCustomerOrder EventCustomerOrder Cancelled Systemorder-sourcing PolicyCancels each group not yet locked, or refuses itSystemdelivery-promise PolicyCancels the promises of the cancelled groupsSource: application/usecases/cancel.go · domain/customerorder/cancel.go
-
Cancel a group whose promise cannot be kept
When delivery-promise finds no route that can still deliver, the group is cancelled at once rather than left open.
Systemdelivery-promise EventPromiseUnkeepable PolicyWhenever a promise is unkeepable, cancel its shipment groupCommandCancelUnkeepable started by the policyGroup AggregateCustomerOrder EventCustomerOrder Cancelled Systemorder-sourcing PolicyCancels the group's assignment, or refuses it if already lockedSystemdelivery-promise PolicyCancels the group's promiseSource: application/usecases/consume_promise.go · domain/customerorder/cancel.go
-
Accept a cancellation
order-sourcing confirms it cancelled the group. The group, and the order if nothing else remains, becomes Cancelled.
Systemorder-sourcing EventFulfillmentCancelled PolicyWhenever order-sourcing cancels a group, mark the group cancelledCommandConfirmGroup started by the policyCancelled AggregateCustomerOrder Source: application/usecases/consume_sourcing.go · domain/customerorder/cancel.go
-
Accept a refusal to cancel
If the group was already locked, order-sourcing refuses. The group goes back to Locked and the vendor ships.
Systemorder-sourcing EventFulfillmentCancel Refused PolicyWhenever order-sourcing refuses a cancel, put the group back to lockedCommandRefuseGroup started by the policyCancellation AggregateCustomerOrder Source: application/usecases/consume_sourcing.go · domain/customerorder/cancel.go
-
Follow a revised promise
When delivery-promise moves a promise to a later window, the group's delivery window, ship-by and node move with it. A revision no newer than the stored one changes nothing. A later delivery date also decides a delay notice.
Systemdelivery-promise EventPromiseRevised PolicyWhenever a promise is revised, move the group's window to the new oneCommandUpdateGroup started by the policyPromise AggregateCustomerOrder EventShopperNotice Decided System · outsideStorefrontPolicyTells the shopper when the notice policy names the marketplace or the sellerSource: application/usecases/consume_promise.go · domain/customerorder/commands.go
-
Record the promise verdict
The tracking view shows whether the promise was kept or broken, and by how many minutes. An at-risk promise shows its reason the same way.
Systemdelivery-promise EventPromiseBroken PolicyWhenever a promise is kept or broken, record the verdict on the groupCommandApplyPromise started by the policyBroken Read model · kept up to dateTracking viewSource: application/usecases/consume_promise.go · adapters/inbound/kafka/handlers.go
-
Mark a group in fulfilment
order-sourcing locks the group to a node. The group moves from Promised to Locked and the assignment is linked to it.
Systemorder-sourcing EventFulfillmentLocked PolicyWhenever a group is locked at a node, mark it in fulfilmentCommandMarkIn started by the policyFulfillment AggregateCustomerOrder Read model · kept up to dateAssignment linksSource: application/usecases/consume_sourcing.go · domain/customerorder/commands.go
-
Mark a group shipped
order-sourcing reports the packages. The group becomes Shipped, and deliveries that arrived early are replayed so the group can close at once. The shopper notice for shipped is decided too.
Systemorder-sourcing EventFulfillmentShipped PolicyWhenever a group ships, mark it shipped and replay early deliveriesCommandMarkGroup started by the policyShipped AggregateCustomerOrder EventShopperNotice Decided Read model · kept up to dateTracking viewSystem · outsideStorefrontPolicyTells the shopper when the notice policy names the marketplace or the sellerSource: application/usecases/consume_sourcing.go · domain/customerorder/commands.go
-
Close a group on delivery
A package is delivered. A group is Delivered once every package it announced is delivered. A package shared by merged groups closes all of them. The shopper notice for delivered is decided too.
Systemshipping-and- tracking EventPackageDelivered PolicyWhenever a package is delivered, mark it for every group that names itCommandMarkGroup started by the policyDelivered AggregateCustomerOrder EventShopperNotice Decided Read model · kept up to dateTracking viewSystem · outsideStorefrontPolicyTells the shopper when the notice policy names the marketplace or the sellerSource: application/usecases/consume_tracking.go · domain/customerorder/commands.go
-
Mark a group lost or returned
One lost package loses the group, and one returned package returns it. Both are final. The shopper notice for lost or returned is decided too.
Systemshipping-and- tracking EventPackageLost PolicyWhenever a package is lost or returned, mark its group lost or returnedCommandMarkGroup started by the policyLost AggregateCustomerOrder EventShopperNotice Decided Read model · kept up to dateTracking viewSystem · outsideStorefrontPolicyTells the shopper when the notice policy names the marketplace or the sellerSource: application/usecases/consume_tracking.go · domain/customerorder/commands.go
-
Show the delivery window of the day
The carrier narrows a package to a time window on the day. It shows on the tracking view only; the promise and the order are untouched. A notice for the shopper is decided too, by the same policy.
Systemshipping-and- tracking EventPackageEta Window Assigned PolicyWhenever a package gets a day-of window, show it unless a newer one is storedCommandApplyPackage started by the policyEta AggregatePolicyEventShopperNotice Decided Read model · kept up to dateTracking viewSystem · outsideStorefrontPolicyTells the shopper when the notice policy names the marketplace or the sellerSource: application/usecases/consume_eta.go · application/usecases/notice.go · 0017-notification-policy-and-shopper-notice-decided.md
-
Warn about a delivery point that keeps failing
The carrier flags a drop-off point after repeated failures. The warning shows on the tracking view and a notice for the shopper is decided; the promise and the order are untouched.
Systemshipping-and- tracking EventPackageDelivery Point Flagged PolicyWhenever a delivery point is flagged, show the warning and decide who tells the shopperCommandApplyDelivery started by the policyPoint Flag AggregatePolicyEventShopperNotice Decided Read model · kept up to dateTracking viewSystem · outsideStorefrontPolicyTells the shopper when the notice policy names the marketplace or the sellerSource: application/usecases/consume_point_flag.go · application/usecases/notice.go · 0015-delivery-point-advisory-on-the-tracking-view.md
-
Show that a pickup package is waiting
A package sent to a pickup point reaches it. The tracking view shows where it waits and until when. The order keeps moving on the shipment events and nothing else changes.
Systemshipping-and- tracking EventPackageReady For Collection PolicyWhenever a pickup package reaches its point, show where it waits and until whenCommandApplyPackage started by the policyReady For Collection Read model · kept up to dateTracking viewSource: application/usecases/consume_pickup.go · 0016-checkout-to-a-pickup-point.md
-
Show that a pickup package was collected
The shopper collects the package at the pickup point. The tracking view shows the collection and its proof code. Like the deposit, it changes no order.
Systemshipping-and- tracking EventPackageCollected PolicyWhenever a pickup package is collected, show the collection with its proof codeCommandApplyPackage started by the policyCollected Read model · kept up to dateTracking viewSource: application/usecases/consume_pickup.go · 0016-checkout-to-a-pickup-point.md
Hot spots and opportunities
Open questions and known gaps, each taken from a decision record or a document in the repository, never invented. Opportunities are improvements the documentation already names.
- Hot spotIf delivery-promise is slow or down, checkout answers 503. There is no fallback promise, so the shopper must retry.
Source: docs/ddd/eventstorming.md
- Hot spotThe cancel check is advisory. A lock this context has not yet consumed is invisible, so order-sourcing's answer decides.
Source: docs/ddd/eventstorming.md
- Hot spotA delivery can arrive before the shipment it belongs to. It is stored and replayed later; an unknown order is skipped, not retried.
Source: docs/ddd/eventstorming.md
- Hot spotA shopper whose consolidated offer expired is re-quoted without that tier. This is an accepted limitation.
Source: adr/0013-consolidated-tier-and-chosen-delivery-day.md
- Hot spotThe ship-to route is called restricted, but the fleet has no authentication and none is planned here.
Opportunities
- OpportunityStorefront callers must accept the fifth (consolidated) tier before any shopper can be offered it.
Source: adr/0013-consolidated-tier-and-chosen-delivery-day.md
- OpportunityThe MCP tools and agent skills could later show the window's time zone, as the REST API does.
This board is a reconstruction from the code and documentation of customer-ordering at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.