2026Active
Pico Travel Expenses
Next.js 16 · Prisma/SQLite · OSRM · Docker
Overview
One paper form, retired: OSRM-routed travel expenses with approvals on the record.
A European healthcare group ran every business trip through one paper form, hand-calculated, hand-approved, then re-typed into spreadsheets. The replacement mirrors it on purpose, with rates that match the template (0.40 €/km, 60 €/night) so finance could trust it, and then automates everything: expense reports with mileage and allowance calculation, director approvals on the record, OSRM route calculation, and CSV export straight into Power BI.
How is it built?
Integer cents everywhere, custom scrypt session-cookie auth with timing-safe comparison, and an append-only audit trail: audit events are written inside the same Prisma transaction as each state change, with immutable ReportVersion snapshots per submission and decision.
How does it fit the client's workflow?
Because Power BI can't hold cookie sessions, the CSV endpoint speaks HTTP Basic. Bilingual PT/EN, shipped in Docker: one volume, one-line backups.
Field notes
- 49 Vitest unit tests on lib/money.ts alone, and the first four runs failed against real behavior: 2026-02-30 was accepted and rolled into March, 1e3 parsed as €1000, "84 km" (what users actually type) failed to parse, and a same-day "overnight" stay silently paid an allowance.
- Public self-registration was built, then removed after concluding admin-managed accounts fit an internal tool, a requirement reversal caught before delivery.
- OSRM/Nominatim calls run with retry + backoff behind a RouteCache table.



Source
github.com/notdezzi/pico-travel-expenses