KatInterview

Live Courier Fleet Tracking and ETA Platform Design

System DesignModel answer
HardModel answerSystem Designsystem-designstreamingkafka

Last updated

Design an end-to-end platform that streams courier GPS, computes routes and ETAs, manages order assignment, and powers live maps for dispatchers and customers.

Problem

A logistics company wants a platform that shows dispatchers, operations staff, and end customers where each courier is, which route they are following, and when they will arrive. Design the whole system, from the phone in the courier's hand to the pixels on a map.

Scope

Walk through these areas and explain the trade-offs you choose:

  1. Architecture. Clients, gateway, core services, event bus, and datastores. Justify an event-driven approach and say where a split between write and read models (CQRS) helps.
  2. Courier app publishing. Sampling policy, batching, compression, sequence numbers, authentication, and defenses against fake locations.
  3. Ingestion and stream processing. Validation, deduplication, ordering, map matching, smoothing, geofence events, and fan-out.
  4. Routes and ETAs. Incremental updates for the current leg, estimates for later stops, and multi-stop planning with time windows (VRP/TSP variants).
  5. Orders and assignment. Data model, state transitions, and how to prevent one order from being given to two couriers.
  6. Map delivery. Live and historical views for dispatcher consoles and customer pages: push transport, tiles, path simplification, throttling by zoom level.
  7. Storage. Latest position, time-series traces, and cold archive for playback.
  8. APIs. At least: create order, assign order, post courier locations, fetch courier trace, fetch order ETA, subscribe to live order updates.
  9. Capacity. Estimate request rates, storage, and connection counts, scaling from tens of thousands of concurrent couriers to millions of deliveries per day.
  10. Consistency vs. latency. Where you require strong consistency and where eventual consistency is acceptable.
  11. Mobile constraints. Offline operation and battery use.
  12. Privacy and access control. Data minimization, role- and attribute-based access, expiring tracking links, location blurring, retention.
  13. Reliability. Failure modes, disaster recovery, SLOs, alerting, and synthetic checks.

What to deliver

A structured design with a diagram or data-flow description, concrete numbers for your estimates, and explicit reasoning for each major decision. State any assumptions you make up front.

Hints

Hint 1

Start with numbers. Concurrent couriers times sampling rate gives ingest rate, but order writes are tiny by comparison. Work out which part (fan-out, freshness, correctness) is actually hard before choosing components.

Hint 2

Treat location as an append-only stream keyed by courier ID so per-courier ordering is preserved, and let separate consumers handle map, ETA, geofencing, archive, and fraud. Keep orders and assignments in a transactional store and build read views from events.

Hint 3

For double-assignment, use a conditional update (status and version check) in one transaction rather than distributed locks. For the live map, accept eventual consistency, send only the latest position per courier, and throttle by viewport and zoom.