System Design Atlas

Waste collection routes and disposal records

06 / 10Worked example

The overall architecture

How are responsibility for the collection route and external processing divided between modules and processes?

The local consistency rule determines the boundary of the collection route API. Device synchronisation runs separately to handle deferred work. Route assignment, bin-emptying records, mass reconciliation and record completion are modules within the API. Route planning uses this API and its relational assignment store. The vehicle keeps a local event journal during coverage gaps; device synchronisation accepts reports durably and deduplicates them. Separately, the receiving facility supplies weighing and handover records. Record completion joins the collection and receiving paths once the mass discrepancy and every bin outcome have been resolved. Route recommendations remain a read model and create no emptying records. The architecture thus has two converging chains of evidence.

Starting point Each route-and-bin work order records one effective emptying.

Assumptions for the example case

Original fictional example design. A municipal collection service for non-hazardous waste uses its own operational records and confirmed handovers. The illustrative load limit is 10000 kg; additional planned loading is allowed only if total mass remains ≤ 10000 kg. All figures and test targets are illustrative assumptions.

Runtime components and datastores

Runtime topology

Vehicle with local journalOffline bin-emptying events
Receiving facilityWeighing and handover record

Route and records system

Collection route APIAssignment and evidence
Relational assignment storeRoute and bin
Device synchronisationDurable deduplication
Record completionJoin collection and receiving paths
Route read modelRecommendations create no emptying records
Vehicle with local journal → Device synchronisationSigned event sequence
Device synchronisation → Collection route APIDeduplicated emptying
Collection route API → Relational assignment storeBin outcome
Receiving facility → Record completionWeighing and handover record
Relational assignment store → Record completionCollection evidence chain
Relational assignment store → Route read modelRebuildable recommendation

Each emptying takes effect once per bin and route. Completion requires a handover record and resolved discrepancies.

Route planning uses the collection route API and its relational assignment store. The vehicle keeps a local event journal during coverage gaps; device synchronisation accepts reports durably and deduplicates them. Separately, the receiving facility supplies weighing and handover records. Record completion joins the collection and receiving paths once the mass discrepancy and every bin outcome have been resolved. Route recommendations remain a read model and create no emptying records. The architecture thus has two converging chains of evidence.

Domain responsibilities within the API

Inner modules

Route assignmentAssign bins and a vehicle to a route
Emptying deduplicationDeduplicate using the device key and content together
Handover recordLink weighing and receiving records
Discrepancy resolutionResolve mass discrepancies and bin exceptions

Modules group responsibilities within the API process.

The collection route API contains route assignment, bin-emptying records, mass reconciliation and record completion. Show the domain call relationships; modules have no separate server icons.

Map responsibilities to runtime components

Domain taskRuntimeResponsibility
Route assignmentCollection route APILinks the bin, vehicle and collection work order.
Bin-emptying recordsCollection route APIRecords actual emptying, its source and its time.
Mass reconciliationCollection route APICompares planned, reported and confirmed masses.
Record completionCollection route APIChecks the handover record and resolved discrepancies.
Device synchronisationSeparate background processProcesses stored work and external feedback.
Receiving facilityExternal boundaryProvides or confirms the evidence agreed for this case.

Route assignment

Runtime
Collection route API
Responsibility
Links the bin, vehicle and collection work order.

Bin-emptying records

Runtime
Collection route API
Responsibility
Records actual emptying, its source and its time.

Mass reconciliation

Runtime
Collection route API
Responsibility
Compares planned, reported and confirmed masses.

Record completion

Runtime
Collection route API
Responsibility
Checks the handover record and resolved discrepancies.

Device synchronisation

Runtime
Separate background process
Responsibility
Processes stored work and external feedback.

Receiving facility

Runtime
External boundary
Responsibility
Provides or confirms the evidence agreed for this case.

Synchronisation is separate from finalising the evidence

Synchronisation is separate from finalising the evidence

Synchronisation is separate from finalising the evidence.

Each confirmed emptying takes effect once for the same bin and route work order. Completing a route requires documented handover status and resolved discrepancies.

Route assignments, bin-emptying events and handover records must express the same valid state. The exercise specifies the input and expected result.

Alternative considered
A separate service for every module spreads the business guarantee across additional network boundaries: each confirmed emptying takes effect once for the same bin and route work order, and completing a route requires documented handover status and resolved discrepancies.
Trade-off
Common schema changes require coordinated releases.
Reassess
A substantially different load for device synchronisation, or separate ownership, calls for a new division of runtime components.

Try it yourself

Classify route assignment, device synchronisation and the receiving facility as a module, process or external system. Justify the authoritative datastore.

A hint for your attempt

A domain responsibility becomes a process only when it has its own execution unit.

Compare with a possible solution
Boundaries
Route assignment is a module in the collection route API; device synchronisation is a separate process; the receiving facility is external.
Storage
The datastore for route assignments, bin-emptying events and handover records holds the authoritative evidence. Each confirmed emptying takes effect once for the same bin and route work order. Completing a route requires documented handover status and resolved discrepancies. The shared transaction protects this relationship; external responses remain separate evidence.

Apply to your project

Which planned service boundary would distribute a currently local guarantee across the network?

Next: acknowledge an emptying record after durable acceptance.