Case study
Logistics Management Platform
A full logistics system for a transportation business — LR generation, billing, payment tracking, PDF caching, and P&L reporting.
- Next.js
- PostgreSQL
- Puppeteer
- Cloudflare R2
Problem it solved
A transportation business was managing lorry receipts, bills, and payments manually across spreadsheets and paper records. Generating documents took time, tracking payments was error-prone, and there was no clear view of profit and loss across the operation.
What I built
A complete logistics management platform that handles the full workflow from customer onboarding to final P&L reporting.
The system covers:
- Customer and consignment management — structured records replacing scattered spreadsheets
- LR (Lorry Receipt) generation — automated document creation with all required fields
- Bill generation and tracking — invoicing tied to deliveries with payment status
- Payment processing — recording and reconciling payments against outstanding bills
- Expense tracking — capturing operational costs for accurate margin calculation
- P&L reporting — real-time profit and loss visibility across the business
- CSV/JSON import-export — bulk data operations for migration and reporting
Technical decisions
PDF generation with caching
Documents like LRs and bills need to be generated as PDFs for printing and sharing. I used Puppeteer for server-side PDF rendering and cached the output on Cloudflare R2. Once a document is generated, subsequent requests serve the cached version, keeping response times fast and server load low.
Serverless with extended timeouts
The app runs on Vercel with serverless functions. PDF generation can be slow, so the relevant API routes use extended timeouts (60s) and increased memory allocation (2GB) to handle Puppeteer's requirements without failing under load.
PostgreSQL with Drizzle ORM
All business data lives in PostgreSQL with Drizzle as the type-safe ORM. The schema was designed around the real business workflow — not a generic CRUD structure — so queries map directly to the operations the client actually performs.
Outcome
The client uses this system daily. Document generation that used to take manual effort now happens in seconds. Payment tracking that was previously scattered across files is now centralized with clear visibility into what's owed and what's been paid.