← Back to list

Backend Systems · 11/3/2025

Courier Tracking System

Processes courier location updates, records arrivals within a store’s 100-metre geofence, and tracks each courier’s total distance travelled.

Courier Tracking System

This service turns a stream of courier coordinates into useful delivery activity. It records when a courier enters a store’s 100-metre radius, ignores repeat entries to the same store for one minute, and keeps a running travel distance.

How it works

The Spring Boot API receives location updates and exposes endpoints for querying distances and store-entry logs. A Haversine strategy calculates distance, while Redis keeps the latest location and per-store entry state available for fast checks.

The code follows a ports-and-adapters structure: delivery rules sit in the application and domain layers, with persistence, caching, and web endpoints implemented around them. Flyway manages database setup; the demo uses an in-memory H2 database.

Outcome

The project demonstrates geofence events, distance tracking, and replaceable infrastructure behind a clear domain model.

View the source code on GitHub.

javaspring-bootredislocationhexagonal-architecture