TruckNest
A multi-tenant SaaS for small trucking companies in the ex-YU market: trucks, drivers, clients and invoices in one place, with alerts before anything expires.
Setup sheet
How the car is built, part by part- Power unit
- Java 21 and Spring Boot 4
- Chassis
- Spring Modulith modular monolith with nine modules
- Bodywork
- Next.js 14 as a backend for frontend, shadcn/ui and Tailwind
- Fuel system
- PostgreSQL 16 with Flyway, Redis cache with a 60s TTL
- Radio
- Kafka in KRaft mode, email alerts through Brevo SMTP
- Safety
- Keycloak 26, tokens kept in encrypted httpOnly cookies
- Telemetry
- Prometheus and Grafana
- Garage
- Oracle Cloud ARM for the backend, Vercel for the frontend
Car layout
Frontend appServiceML or AI modelData storeExternal- Next.js BFF to Keycloak, sign in
- Next.js BFF to Spring Modulith application
- Spring Modulith application to PostgreSQL 16
- Dashboard to Redis
- Invoices to Kafka, overdue
- Kafka to Notifications
Lap breakdown
- Sector 1, Architecture
One database, many companies
Every table carries a company_id. A tenant filter reads it from the Keycloak JWT on each request and every repository query is scoped to it, never to anything the frontend sends.
- Sector 2, Architecture
Boundaries the build enforces
Trucks, drivers, clients, invoices, notifications and the rest are Spring Modulith modules. No module reaches into another's internals; they talk through public query services that return DTOs.
- Sector 3, Delivery and integrations
Alerts before things go wrong
A Kafka pipeline emails owners when a truck is due for service, a licence or visa is about to expire, or an invoice goes overdue. The Next.js backend-for-frontend keeps tokens server-side, so the browser never sees a raw JWT.


