Skip to content
ANVILATECH
All work
CASE — LOGISTICS · 2025CLIENT UNDER NDA3PL courier (Lagos)

Event-sourced TMS for a 3PL courier

Rebuilt dispatch and tracking as an event-sourced platform — cutting dispatch time and making every state change replayable and auditable.

-38%
dispatch time
12k
events/day
99.98%
uptime

// CONTEXT

A regional third-party logistics courier ran dispatch on a mutable CRUD database. Order state was overwritten in place, so nobody could answer "what happened to this parcel, and when?" Reconciliation was manual, disputes were unwinnable, and the system buckled during peak.

// PROBLEM

The team needed an auditable, resilient dispatch platform: every state transition traceable, integrations idempotent, and route assignment able to survive partial failures without double-dispatching a driver.

// ARCHITECTURE

FIG.01 — SYSTEM TOPOLOGY▬ CRITICAL PATH
API Gatewayingress · auth
Command Busvalidate · route
Aggregate · Event Storeappend-only · replayable
Transactional Outboxexactly-once · idempotent
EventBridgefan-out bus
Read Modelsprojections
Sagasorchestration
Integrationswebhooks · S3

ILLUSTRATIVE TOPOLOGY — NOT A CLIENT SYSTEM DIAGRAM

// DECISIONS

  • Chose Event sourcing over a mutable status column

    Order history is the product. Storing events instead of current state made every dispatch replayable, auditable, and debuggable in production.

  • Chose Transactional outbox + idempotency keys over direct broker publishes

    Network calls fail. The outbox guarantees events reach EventBridge exactly once, and idempotency keys make retries safe end-to-end.

  • Chose Sagas for route assignment over a synchronous orchestration service

    Assignment spans several bounded contexts. A saga coordinates them with compensations, so a failed leg rolls back cleanly instead of stranding a parcel.

// OUTCOME

Dispatch time fell 38%. Every state change is now replayable and auditable, and no order has been lost since launch.

-38%
dispatch time
12,480
events / day
99.98%
uptime
0
lost orders since launch

// STACK

PHP 8.4SymfonyEcotonePostgreSQLRedisEventBridgeS3Docker

Building something like this?

Start a project
Event-sourced TMS for a 3PL courier — AnvilaTech