Web consoles
Next.js dispatch and tenant apps on Cloud Run.

Project · June 2026
Next.js consoles and an Expo driver app sit on a FastAPI and PostgreSQL backend. Road times come from OSRM. OR-Tools runs on GCE workers behind a job queue, so the web API and the CPU-heavy solver scale independently.

Architecture
Cloud Run hosts the UIs and FastAPI. PostgreSQL holds operational state. OSRM and OR-Tools run separately so a heavy solve does not take down dispatch.
Next.js dispatch and tenant apps on Cloud Run.
FastAPI + PostgreSQL: orders, trips, auth, and dispatch.
Expo app: offers, maps, GPS, and proof of delivery.
OSRM matrices and OR-Tools workers that scale with the queue.
Expo · iOS & Android
Swipe to explore
Original
10 routes
Optimized
4 routes
System behavior
Shipment changes are batched inside a moving planning window.
An advisory lock prevents overlapping plans, and near-start trips are frozen before the request is built.
OSRM supplies travel matrices and OR-Tools builds constrained routes.
Geographic groups run independently on GCE workers, keeping CPU-heavy solves away from the API.
The backend checks solver output against current database state.
Stale results are discarded, while accepted work stays pinned to an immutable trip revision.
Workers claim leased groups from a PostgreSQL queue and report heartbeats while solving.
SKIP LOCKED, lease expiry, and 0 → N → 0 GCE autoscaling handle interruptions and bursts.