Case study
Route Optimization Planner
Turns client visits into optimized weekly routes for a field-service company. Built solo.
Weekly plan
Weekly planning modeled as a Vehicle Routing Problem: each day is a vehicle, each client a visit, with arrival times and daily distance.
(opens full-size image in a new tab) Week map
All routes of the week on one map, with per-day client count, distance and drive time.
(opens full-size image in a new tab) Day route
Day view with manual adjustments, pinned visits and a one-click navigation deep link to Google Maps.
(opens full-size image in a new tab) Under the hood
- Vehicle Routing Problem solved on Cloudflare Workers with the Google Route Optimization API
- When the owner reported shorter manual routes, built a result-explanation panel and a route comparison; the diagnosis pinpointed a solver penalty that added 11% distance in a test
- Server-side roles with Cloudflare Access JWTs and an employee panel synced with Access
- Workbox PWA with offline field preview and data clearing on logout
- API cost guards below free-tier limits, a pnpm monorepo with 168 tests and GitHub Actions running migrations before deploy
Technical details
Modeling the week as a routing problem
Each working day is a vehicle and each client is a visit, so one solver call plans the whole week: it assigns visits to days and orders them into routes. Pinned visits keep their day and time, and the planner UI (React 19, TanStack Query, Google Maps, Hono RPC) lets the owner adjust the result by hand.
Explaining the solver instead of trusting it
The owner reported that his manual routes were shorter. Instead of tuning blindly, I built a result-explanation panel and a side-by-side route comparison. That made the cause visible: a solver penalty that added 11% distance in a test.
Access, offline use and costs
Roles are enforced server-side from Cloudflare Access JWTs, with an employee panel synced with Access. A Workbox PWA gives field staff an offline preview and clears data on logout. Custom guards keep API usage below free-tier limits (D1, Cloud Monitoring).