Overview
A route optimization app built at Uottahacks7: a live map interface showing routes and traffic markers, an LLM-backed recommendation engine (Groq) that reasons about a route's traffic conditions, and a Solace PubSub+ connection that keeps the client aware of its real-time connection status for live updates.
Problem
Standard route-planning UIs show a route but not why it's a good one, and they don't adapt cleanly to live traffic conditions changing mid-trip. The goal was a route optimizer that treats traffic as a live signal driving the route, not a one-time input, and gives the user a conversational way to ask about it.
What I built
- An interactive map (Leaflet) rendering routes and live traffic markers (
Map.tsx,RouteMarkers.tsx,TrafficMarker.tsx) - A route panel presenting the optimized path and its details (
RoutePanel.tsx) - An embedded chatbot widget for conversational trip assistance (
ChatBotWidget.css,chatbotedge function) - A
useSolaceConnectionhook (SolaceConnection.tsx) that manages the Solace PubSub+ connection lifecycle client-side and surfaces connect/error state via toast notifications, backed by aget-solace-configedge function that hands the client its connection config - A Supabase edge function (
optimize-route) that sends the current route and traffic data to Groq'smixtral-8x7b-32768model and returns structured recommendations (alternative routes, expected delay severity, weather impact), with a safe default response if the Groq call fails
Architecture
React (Vite + TypeScript) frontend, styled with Tailwind and shadcn-ui, rendering the
map via Leaflet. Three Supabase edge functions provide the backend: optimize-route
builds a prompt from the route/traffic payload and calls the Groq chat completions API
for recommendations, get-solace-config hands the client its Solace connection config,
and chatbot serves the AI assistant. On the client, useSolaceConnection establishes
and monitors the Solace connection so the UI can reflect real-time connectivity state.

generated by gitdiagram · click to explore interactively ↗ · full size
Decisions
- Supabase Edge Functions over a standalone backend: kept the whole stack deployable from one place under hackathon time pressure, without standing up separate backend infrastructure.
- An LLM (Groq) for route recommendations instead of a hand-written optimization algorithm: turns route/traffic data into natural-language-derived recommendations (alternatives, delay severity, weather impact) without building a routing/optimization engine from scratch, at the cost of recommendations being only as reliable as the model's parsing of its own prompt response.
- A safe fallback response when the Groq call fails or times out: the edge function always returns a 200 with a default recommendation rather than surfacing an error to the user, prioritizing a working demo over surfacing failures.
Results
Shipped as a working demo for Uottahacks7 combining live map routing, an LLM-driven recommendation engine, and Solace-backed real-time connectivity in one app.
What I learned
- Prompting an LLM for structured output (route alternatives, delay severity, weather impact) and then parsing that back out of free text is fragile. The edge function's fallback logic exists because that parsing can't be fully trusted; asking the model for strict JSON and validating it against a schema would be the sturdier approach.
- A silent fallback keeps a demo alive but hides failures. When the Groq call fails, the user gets a generic recommendation with no sign anything went wrong. Returning the fallback with a flag the UI can show would keep the demo working and stay honest.
- Wiring a pub/sub layer (Solace) into a frontend app was new territory compared to typical request/response APIs. The UI had to react to connection-state changes (connecting, connected, dropped) rather than just waiting on fetch results.
- Serverless edge functions are a fast way to stand up a backend at a hackathon: three small functions covered route recommendations, the chatbot and Solace config, with no server to deploy or keep running.