Relay — parcel network

c4

C4 level 2: the containers inside Relay. Open Dispatch to go a level deeper.

RelaySYSTEM BOUNDARYCore servicesDEPLOYMENT BOUNDARYUploads scan batches to [REST/JSON over mTLS]Hands off out-of-area parcels to [HTTPS]Reads tracking history from [REST/JSON]Scans parcels with [Bluetooth scanner]Requests a sequenced route from [gRPC]Books and cancels via [REST/JSON]Validates addresses with [HTTPS]Books shipments in [HTTPS]Tracks a parcel on [HTTPS]Creates parcels in [gRPC]Sends SMS through [HTTPS]Reads / writes [SQL]Publishes [Kafka]Consumes [Kafka]Consumes [Kafka]Writes [SQL]Reads [SQL]Merchant — Books shipments and watches them until they landMerchant[Person]Books shipments and watchesthem until they landRecipient — Tracks a parcel and reschedules when they will not be inRecipient[Person]Tracks a parcel andreschedules when they willnot be inCourier — Scans parcels at every handover and records delivery attemptsCourier[Person]Scans parcels at everyhandover and recordsdelivery attemptsMerchant portal — [Next.js] — Booking, labels, invoices and shipment historyMerchant portal[Container: Next.js]Booking, labels, invoices andshipment historyDrill down ↗Tracking page — [React] — The public page a recipient opens from an SMS. No login.Tracking page[Container: React]The public page a recipient opensfrom an SMS. No login.Courier handheld — [Kotlin / Android] — Scans barcodes offline and syncs when it finds signalCourier handheld[Container: Kotlin / Android]Scans barcodes offline and syncswhen it finds signalShipment API — [Go] — Booking, cancellation and the merchant-facing read modelShipment API[Container: Go]Booking, cancellation and themerchant-facing read modelDrill down ↗Scan ingest — [Go] — Accepts batched, out-of-order scans from handhelds and makes them idempotentScan ingest[Container: Go]Accepts batched, out-of-orderscans from handhelds and makesthem idempotentDispatch — [Java / Spring] — Owns parcel state and decides which route a parcel joinsDispatch[Container: Java / Spring]Owns parcel state and decideswhich route a parcel joinsDrill down ↗Routing engine — [Python] — Sequences stops for a van under time windows and vehicle capacityRouting engine[Container: Python]Sequences stops for a van undertime windows and vehicle capacityNotifier — [Node.js] — Sends the SMS and email a recipient actually readsNotifier[Container: Node.js]Sends the SMS and email arecipient actually readsRelay DB — [PostgreSQL 15] — Shipments, parcels, routes and every scan ever takenRelay DB[Database: PostgreSQL 15]Shipments, parcels, routes andevery scan ever takenParcel events — [Kafka] — parcel.scanned, parcel.delivered, parcel.attempt-failedParcel events[Queue: Kafka]parcel.scanned, parcel.delivered,parcel.attempt-failedLoqate — Address validation and geocodingLoqate[System, external]Address validation and geocodingTwilio — SMS delivery to recipientsTwilio[System, external]SMS delivery to recipientsPartner carriers — Final mile in postcodes Relay does not serve itselfPartner carriers[System, external]Final mile in postcodes Relay doesnot serve itselfUploads scan batches to [REST/JSON over mTLS]Uploads scan batches to[REST/JSON over mTLS]Hands off out-of-area parcels to [HTTPS]Hands off out-of-area parcels to[HTTPS]Reads tracking history from [REST/JSON]Reads tracking history from[REST/JSON]Scans parcels with [Bluetooth scanner]Scans parcels with[Bluetooth scanner]Requests a sequenced route from [gRPC]Requests a sequenced route from[gRPC]Books and cancels via [REST/JSON]Books and cancels via[REST/JSON]Validates addresses with [HTTPS]Validates addresses with[HTTPS]Books shipments in [HTTPS]Books shipments in[HTTPS]Tracks a parcel on [HTTPS]Tracks a parcel on[HTTPS]Creates parcels in [gRPC]Creates parcels in[gRPC]Sends SMS through [HTTPS]Sends SMS through[HTTPS]Reads / writes [SQL]Reads / writes[SQL]Publishes [Kafka]Publishes[Kafka]Consumes [Kafka]Consumes[Kafka]Consumes [Kafka]Consumes[Kafka]Writes [SQL]Writes[SQL]Reads [SQL]Reads[SQL]
drag to pan · wheel to zoom · click a node · Esc clears

Ownership

  • Merchant-facing: platform team
  • Dispatch, routing and scans: network team
  • Handheld app: field systems team

Watch out

  • Scan ingest must stay available when depots are busiest; it is the only write path for parcel movement
  • Handhelds go offline for hours, so scans arrive late and out of order