Campus Delivery
Order, courier accept, live tracking, and a dispatcher map, built to stay correct under concurrent access and flaky networks.
- Stack
- Java 21, Spring Boot, PostgreSQL, PostGIS, Kafka, Spark, React, TypeScript
A delivery platform for a campus: customers place orders, couriers accept them and share their location, and dispatchers watch everything on a live map. The interesting part is keeping it correct when twenty couriers tap “accept” at once, phones reconnect mid-delivery, and clients retry requests.
Pieces
- Backend. Spring Boot 3.5 with REST and WebSocket APIs. PostGIS finds the nearest available courier, offers expire and get reassigned on timeout, and state changes leave through a transactional outbox to Kafka.
- Live tracking. WebSocket clients get a snapshot, replay what they missed, and then follow live updates, so a client that drops off can catch up when it reconnects.
- Web. React 19 and TypeScript: a customer app, a dispatcher dashboard, and a courier console on Leaflet maps.
- Simulator. TypeScript couriers and customers that drive the public API with out-of-order location pings, ignored offers, and idempotent retries.
- Analytics. PySpark Structured Streaming reads the Kafka topics and writes per-minute metrics as date-partitioned Parquet.
Correctness under concurrency
Concurrent tests pin down the two races that matter most.
CI runs 22 backend integration tests against real PostGIS and Kafka through Testcontainers, 8 analytics tests (six batch, two Kafka streaming), the web build, and simulator type-checking.
Measured
- records processed replaying history (about 120k in 20 s)
- ~6k / s
- p95 completed-order-to-query latency, 17 local test orders
- 5.2 s
- backend and analytics tests in CI
- 30
Replay throughput is a batch measurement, not sustained live traffic, and the latency figure doesn’t apply to the watermarked per-minute aggregates.