Inspiration
Damm's distribution network runs on decades of dispatcher intuition. Routes are planned manually, truck loading is tribal knowledge, and every suboptimal delivery costs time and fuel. We asked: what if a dispatcher could just talk to their system and get a smarter plan in seconds?
What We Built
SmartTruck is a full-stack logistics intelligence platform with two parts working in sync:
Backend: A FastAPI service that runs a CVRPTW (Capacitated Vehicle Routing Problem with Time Windows) solver using Google OR-Tools, with a Haversine-based distance matrix as the default and real road routing via OpenRouteService as a drop-in upgrade. The optimizer also runs a layer-based 3D bin-packing algorithm that packs pallets respecting product stacking rules, and truck geometry, generating an exact spatial load plan for each vehicle. Orders can be imported via CSV, geocoding runs automatically, and results are persisted to a MongoDB database.
Frontend: A Next.js dashboard where dispatchers browse warehouses, select dates, and review AI-generated routes. Each route surfaces in a live 3D truck wireframe (React Three Fiber + WebGL) showing exactly how pallets are loaded, and a real-time animated route map simulating the delivery sequence with per-stop timing. An embedded AI chat assistant (powered by Gemini 2.5 Flash) acts as a calm dispatcher copilot, grounded in exactly what's visible on screen and answering questions about stops, loads, and timing without ever making things up.
How We Built It
- Route optimization: OR-Tools CVRPTW + Guided Local Search solvers. Fallback to nearest-neighbor + 2-opt when solver times out.
- Load planning: Column-stacking bin packing with product type classification (barrels, crates, cases, small boxes) and lateral unloading client priorization.
- AI assistant: Open-AI SDK streaming chat with a context-injection system that snapshots the current visible UI state (selected route, stop list, truck load) into the Gemini system prompt on every message.
- Data: Real Damm delivery data, warehouses, customers, materials, historical transports, stored in a normalized MongoDB database with a full generic CRUD API.
Challenges We Faced
Getting the bin-packing and route optimization to co-evolve was the trickiest part, pallet load order is the reverse of route order, so the two algorithms have to share state carefully. Geocoding 200+ Catalan addresses reliably under Nominatim rate limits required batching and caching. And building a 3D truck that actually looks like a truck in 24 hours is its own kind of challenge.
What We Learned
Real logistics data is messier than any textbook example. Time windows overlap, addresses are ambiguous, and customers have variable demands that don't fit neat formulas. The AI assistant was most useful not for optimization itself but for explaining what the optimizer decided, bridging the gap between algorithmic output and human trust.
What's Next
Real-time ORS road routing for all legs, driver mobile app for stop-by-stop navigation, multi-warehouse cross-docking support, and training the AI agent on Damm's historical dispatch decisions to learn house-style routing preferences.
Built With
- fastapi
- google-gemini-2.5-flash
- mongodb
- next.js
- nominatim
- openai-sdk
- openrouteservice
- or-tools
- pydantic
- python
- react
- react-three-fiber-(webgl)
- tailwind-css
- typescript
- vercel-ai-sdk
Log in or sign up for Devpost to join the conversation.