Retail network · Generic domain · EventStorming board
shipping-and-tracking
Issues shipping labels and keeps one timeline per package, from handover to delivery, return or loss.
- events published
- 13
- commands
- 14
- policies
- 42
- read models
- 4
- hot spots
- 5
The story in 5 key events
The pivotal events: the few that matter most, in the order they happen.
- Pivotal eventLabel
Issued - Pivotal eventPackage
Handed Over - Pivotal eventPackage
Delivered - Pivotal eventPackage
Exception Raised - Pivotal eventPackage
Lost
Listens to (5): contexts whose events this one reacts to
Tells (7): contexts that react to its events
The board, row by row
20 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
-
Issue a label for a package
A vendor asks for a label for one package of a purchase order. The shipping address is fetched live and checked; if it looks like a placeholder the label is refused. Otherwise the label and the package's journey start together.
ActorVendor (through partner connectivity)Read modelShipping address of the orderCommandIssueLabel POST /labelsAggregateShippingLabel EventLabelIssued Systemlinehaul-transportation PolicyAdds the tracking number to the booking's expected volumeSystemcustomer-ordering PolicyCreates the package row that the order's tracking view readsSystemlast-mile- delivery PolicyKeeps the opaque stop id and postal prefix so it can group packages into stopsSource: application/usecases/labels.go · domain/label/label.go · domain/journey/journey.go
-
Void a label
An operator voids a label that should not be used. It only works while the package is still waiting for pickup; once it is handed over the void is refused.
ActorOperatorCommandVoidLabel POST /labels/{labelRef}/voidsAggregateShippingLabel EventLabelVoided Systemcustomer-ordering PolicyMarks the package as voidedSystemlinehaul-transportation PolicyDrops the tracking number from the expected volume; the booking staysSource: application/usecases/labels.go · domain/label/label.go · domain/journey/journey.go
-
Record a scan by hand
An operator adds a scan to a package's journey. It follows the same rules as scans from partners: an old, repeated or impossible scan is refused, and a handover or delivery scan also announces that milestone.
ActorOperatorCommandRecordScan POST /journeys/{trackingNumber}/scansAggregateJourneyEventPackageScanned EventPackageHanded Over EventPackageDelivered Systemcustomer-ordering PolicyAdds the scan to the order's tracking timelineSystemnode-performance PolicyJudges a handover against the purchase order's ship-by dateSystemdelivery-promise PolicyRecords a delivery and judges the promise when it was the last packageSystemorder-sourcing PolicyRecords a delivered package; the last one delivers the assignmentSource: application/usecases/scans.go · domain/journey/journey.go
-
Note the vendor's shipment confirmation
The vendor says a shipment has left. Each package on it gets a 'shipment confirmed' scan, but its journey does not move: the handover waits for the carrier's pickup.
Systemvendor-connectivity EventVendorShipment Confirmed PolicyWhenever a vendor confirms a shipment, add one scan per tracking numberCommandApplyScans started by the policyAggregateJourneyEventPackageScanned Systemcustomer-ordering PolicyAdds the scan to the order's tracking timelineSource: adapters/inbound/kafka/handlers.go · application/usecases/scans.go · domain/journey/journey.go
-
Hand the package over at pickup
A load leaves its origin. The first pickup departure of a labelled package hands it over to the carrier; any later departure is just a movement.
Systemlinehaul-transportation EventLoadDeparted PolicyWhenever a load departs, add one scan per package; the first pickup hands it overCommandApplyScans started by the policyAggregateJourneyEventPackageScanned EventPackageHanded Over Systemnode-performance PolicyJudges the handover against the purchase order's ship-by dateSystemcustomer-ordering PolicyAdds the scan to the order's tracking timelineSource: adapters/inbound/kafka/handlers.go · application/usecases/scans.go · domain/journey/journey.go
-
Follow the package through the middle mile
A load arrives. At a delivery station the package becomes ready to go out; at any other hub it stays in transit.
Systemlinehaul-transportation EventLoadArrived PolicyWhenever a load arrives, add one scan per package: station arrival or transit arrivalCommandApplyScans started by the policyAggregateJourneyEventPackageScanned Systemcustomer-ordering PolicyAdds the scan to the order's tracking timelineSource: adapters/inbound/kafka/handlers.go · application/usecases/scans.go · domain/journey/journey.go
-
Hand the package to an outside carrier
In a service area served by an outside carrier, the carrier reports that it picked the package up. The journey moves from at the station to with the carrier, and the handoff is announced once. A repeated report is refused as a duplicate.
ActorOutside carrierCommandReportCarrier POST /carrier-eventsEvent AggregateJourneyEventPackageScanned EventPackageHanded To Carrier Source: application/usecases/carrier_events.go · domain/journey/journey.go
-
Show the package out for delivery
The delivery station sends the package out on a route. The journey moves to out for delivery.
Systemlast-mile- delivery EventPackageOut For Delivery PolicyWhenever a package goes out for delivery, add an out-for-delivery scanCommandApplyScans started by the policyAggregateJourneyEventPackageScanned Systemcustomer-ordering PolicyAdds the scan to the order's tracking timelineSource: adapters/inbound/kafka/handlers_lastmile.go · application/usecases/scans.go · domain/journey/journey.go
-
Close the journey on delivery
A delivery attempt ends. A successful one delivers the package and closes the journey; a failed one sends it back to the station and the journey stays open.
Systemlast-mile- delivery EventDeliveryAttempted PolicyWhenever an attempt is made, add a delivered or failed scan to the journeyCommandApplyScans started by the policyAggregateJourneyEventPackageScanned EventPackageDelivered Systemdelivery-promise PolicyRecords the delivery and judges the promise when it was the last packageSystemorder-sourcing PolicyRecords a delivered package; the last one delivers the assignmentSystemcustomer-ordering PolicyMarks the package and its order group deliveredSource: adapters/inbound/kafka/handlers_lastmile.go · application/usecases/scans.go · domain/journey/journey.go
-
Deposit the package at a pickup point
A delivery attempt succeeds at a pickup point. The package is not delivered to a doorstep: it is deposited at the point and waits there until the shopper collects it, with a hold deadline.
Systemlast-mile- delivery EventDeliveryAttempted PolicyWhenever a delivery attempt succeeds at a pickup point, deposit the package there instead of delivering itCommandApplyScans started by the policyAggregateJourneyEventPackageScanned EventPackageReady For Collection Source: adapters/inbound/kafka/handlers_lastmile.go · application/usecases/scans.go · domain/journey/journey.go
-
Collect the package at the pickup point
The shopper collects a waiting package and, when a proof code was taken, it is kept with the scan. Collected is the end of the journey.
ActorOperatorCommandRecordScan POST /journeys/{trackingNumber}/scansAggregateJourneyEventPackageScanned EventPackageCollected Source: application/usecases/scans.go · domain/journey/journey.go
-
Return a package to the sender
After repeated failed attempts, last-mile-delivery starts a return. A package waiting at the station becomes returned, which ends its journey.
Systemlast-mile- delivery EventPackageReturn Initiated PolicyWhenever a return is started, mark the package at the station as returnedCommandReturnTo started by the policySender AggregateJourneyEventPackageReturned Systemdelivery-promise PolicyRecords the return and judges the promise brokenSystemcustomer-ordering PolicyMarks the package and its order group returnedSystemcustomer-payments PolicyRefunds the order, or waits until its payment existsSource: adapters/inbound/kafka/handlers_lastmile.go · application/usecases/scans.go · domain/journey/journey.go
-
Store the day-of delivery window
When a route starts, last-mile-delivery gives each stop a time window. Every package of the stop keeps it; the window shows only while the package is out for delivery.
Systemlast-mile- delivery EventStopEta Window Assigned PolicyWhenever a stop gets a time window, store it on each package of the stopCommandApplyEta started by the policyWindows AggregateJourneyEventPackageEta Window Assigned Systemcustomer-ordering PolicyKeeps the window for the order's tracking view unless a newer one existsSource: application/usecases/eta.go · domain/journey/journey_eta.go · 0013-day-of-eta-window-on-the-journey.md
-
Relay a delivery-point warning
last-mile-delivery flags a delivery point after two failed attempts. It knows the stop, not the order, so this context passes the warning on for each package of the stop, without any address.
Systemlast-mile- delivery EventDeliveryPoint Flagged PolicyWhenever a delivery point is flagged, store the flag on each open package of the stopCommandRelayDelivery started by the policyPoint Flag AggregateJourneyEventPackageDelivery Point Flagged Systemcustomer-ordering PolicyKeeps the flag on the package's tracking view so the shopper can be advisedSource: application/usecases/point_flag.go · domain/journey/journey_point_flag.go · 0014-relay-the-delivery-point-flag-by-order-id.md
-
Raise an exception on silence
A periodic sweep looks for open packages with no new scan for longer than their service tier allows. Each silent package gets one exception until a new scan arrives.
TimeSilence sweepPolicyEvery sweep, any package silent past its window raises one exceptionCommandRaiseException started by the clockAggregateJourneyEventPackageException Raised Systemdelivery-promise PolicyTreats the exception as a risk to the promise and may re-promiseSystemcustomer-ordering PolicyRecords the exception on the order's tracking viewSource: application/usecases/sweep.go · domain/journey/types.go · 0002-aggregates-and-invariants.md
-
Declare a silent package lost
If a package in transit stays silent for 48 hours after its exception, the same sweep declares it lost and closes its journey.
TimeSilence sweepPolicyEvery sweep, an in-transit package with an unanswered exception for 48 hours is lostCommandDeclareLost started by the clockAggregateJourneyEventPackageLost Systemdelivery-promise PolicyRecords the loss and judges the promise brokenSystemcustomer-ordering PolicyMarks the package and its order group lostSystemcustomer-payments PolicyRefunds the order, or waits until its payment existsSource: application/usecases/sweep.go · domain/journey/types.go · 0002-aggregates-and-invariants.md
-
Keep the delivery mode of each postal area
node-topology assigns a postal prefix to a delivery station. This context keeps only the delivery mode, any carrier options and the version; an older version is ignored.
Systemnode-topology EventServiceArea Assigned PolicyWhenever a postal prefix is assigned, keep its delivery mode and carrier optionsCommandApplyArea started by the policyAssignment Read model · kept up to datePostal area copySource: adapters/inbound/kafka/handlers_nodetopology.go · application/usecases/areas.go
-
Keep the pickup points and node states
A newly registered node that is a pickup point is noted with the station that serves it. Activated, suspended and retired events keep the node's state in the same copy.
Systemnode-topology EventNodeRegistered PolicyWhenever a node is registered, note it if it is a pickup pointCommandNotePickup started by the policyPoint Read model · kept up to datePickup point copySource: adapters/inbound/kafka/handlers_nodetopology.go · application/usecases/points.go
-
Keep the product dimensions copy
Every product that offer-availability creates leaves its size, weight and handling flags here. Nothing reads them yet.
Systemoffer-availability EventCatalogItem Created PolicyWhenever a catalogue item is created, store its dimensions and handling flagsCommandRecordCatalog started by the policyItem Read model · kept up to dateProduct dimensionsSource: application/usecases/housekeeping.go · adapters/inbound/kafka/handlers.go · 0002-aggregates-and-invariants.md
-
Delete old delivery addresses
The saved, encrypted delivery address is deleted 30 days after its journey closes, whether delivered, returned, lost or voided.
TimeHousekeeping sweepPolicyEvery housekeeping run, delete addresses of journeys closed over 30 days agoCommandPurgeShip started by the clockTo Source: application/usecases/housekeeping.go · 0002-aggregates-and-invariants.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 spotVoiding a label and recording a scan by hand have no named caller: the routes are unauthenticated and the contracts name nobody.
Source: docs/ddd/eventstorming.md
- Hot spotA placeholder-looking address refuses the label, but no loop asks the shopper to fix it. That is deliberately left out.
- Hot spotNews about a package this context never labelled is counted and dropped. Nothing keeps it for a later look.
Source: docs/ddd/domain-events.md
- Hot spotA delivery-point warning is never cleared by an event. It ends only when the package's journey ends.
Source: adr/0014-relay-the-delivery-point-flag-by-order-id.md
- Hot spotA restricted route through which partners could resolve the delivery address is not built.
Opportunities
- OpportunityThe product dimensions copy has no reader yet. It is kept so a printable label can use it later.
This board is a reconstruction from the code and documentation of shipping-and-tracking at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.