# watson752/uottahacks7-route-optimizer architecture

> Architecture diagram of the GitHub repository watson752/uottahacks7-route-optimizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/watson752/uottahacks7-route-optimizer
- Repository: https://github.com/watson752/uottahacks7-route-optimizer

## Overview

This is a React route-planning map application with live traffic and route updates, plus user-triggered AI route recommendations and a chatbot. The main workflow renders the map and route panel, receives traffic/route events over Solace, and lets users submit route and traffic data for optimization. The graph focuses on these domain components and the Supabase/ Solace integration layer; several map, chatbot, and edge-function implementations were not excerpted, so their internal links are omitted where not evidenced.

Main entry points: [`src/components/Map.tsx`](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/Map.tsx) (Interactive map), [`src/utils/solaceClient.ts`](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/utils/solaceClient.ts) (Solace client), [`src/components/SolaceHandler.tsx`](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/SolaceHandler.tsx) (Update handler), [`src/integrations/supabase/client.ts`](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/integrations/supabase/client.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Application experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_page["Map page<br/>[Index.tsx]"]
  node_routepanel["Route panel<br/>[RoutePanel.tsx]"]
  node_chatbot["Chatbot widget<br/>[ChatBotWidget.tsx]"]
end

subgraph group_mapping["Map and routing"]
  node_map["Interactive map<br/>[Map.tsx]"]
  node_markers["Route markers<br/>[RouteMarkers.tsx]"]
  node_trafficmarker["Traffic markers<br/>[TrafficMarker.tsx]"]
  node_routecalc["Route calculator"]
  node_markercreator["Marker creator<br/>[MarkerCreator.tsx]"]
  node_maptypes["Map data types<br/>[map.ts]"]
end

subgraph group_realtime["Live updates"]
  node_solacehandler["Update handler<br/>[SolaceHandler.tsx]"]
  node_solaceconnection["Connection hook"]
  node_solaceclient["Solace client<br/>[solaceClient.ts]"]
  node_solaceconfig["Solace config<br/>[config.ts]"]
  node_connectionmanager["Connection manager"]
end

subgraph group_services["Backend services"]
  node_supabaseclient["Supabase client<br/>[client.ts]"]
  node_optimizefunction["Route optimizer<br/>[index.ts]"]
  node_configfunction["Solace config function<br/>[index.ts]"]
  node_chatfunction["Chatbot function<br/>[index.ts]"]
end

node_user(("User"))
node_solaceservice(("Solace PubSub+"))
node_supabaseservice[("Supabase")]

node_user -->|"opens app"| node_app
node_app -->|"routes to"| node_page
node_app -->|"renders"| node_chatbot
node_page -->|"renders"| node_map
node_page -->|"renders"| node_routepanel
node_map -->|"renders"| node_markers
node_map -->|"renders"| node_trafficmarker
node_map -->|"renders"| node_solacehandler
node_map -->|"delegates"| node_routecalc
node_map -->|"accesses"| node_supabaseclient
node_map -->|"uses"| node_solaceclient
node_solacehandler -->|"connects with"| node_solaceconnection
node_solacehandler -->|"subscribes"| node_solaceclient
node_solacehandler -->|"sends updates"| node_map
node_solaceconnection -->|"connects via"| node_solaceclient
node_solaceclient -->|"fetches config"| node_supabaseclient
node_solaceclient -->|"configures session"| node_solaceconfig
node_solaceclient -.->|"publishes/subscribes"| node_solaceservice
node_connectionmanager -->|"uses settings"| node_solaceconfig
node_connectionmanager -.->|"manages session"| node_solaceservice
node_routepanel -->|"reads traffic"| node_supabaseclient
node_routepanel -->|"invokes"| node_optimizefunction
node_supabaseclient -->|"connects to"| node_supabaseservice
node_solaceclient -->|"invokes"| node_configfunction
node_configfunction -.->|"serves config"| node_supabaseservice
node_optimizefunction -.->|"processes request"| node_supabaseservice
node_chatbot -.->|"requests chat"| node_chatfunction

click node_app "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/App.tsx"
click node_page "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/pages/Index.tsx"
click node_routepanel "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/RoutePanel.tsx"
click node_chatbot "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/ui/ChatBotWidget.tsx"
click node_map "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/Map.tsx"
click node_markers "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/RouteMarkers.tsx"
click node_trafficmarker "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/TrafficMarker.tsx"
click node_routecalc "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/map/RouteCalculator.tsx"
click node_markercreator "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/map/MarkerCreator.tsx"
click node_maptypes "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/types/map.ts"
click node_solacehandler "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/SolaceHandler.tsx"
click node_solaceconnection "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/solace/SolaceConnection.tsx"
click node_solaceclient "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/utils/solaceClient.ts"
click node_solaceconfig "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/utils/solace/config.ts"
click node_connectionmanager "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/utils/solace/connectionManager.ts"
click node_supabaseclient "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/integrations/supabase/client.ts"
click node_optimizefunction "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/supabase/functions/optimize-route/index.ts"
click node_configfunction "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/supabase/functions/get-solace-config/index.ts"
click node_chatfunction "https://github.com/watson752/uottahacks7-route-optimizer/blob/main/supabase/functions/chatbot/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_page,node_routepanel,node_chatbot,node_user toneBlue
class node_map,node_markers,node_trafficmarker,node_routecalc,node_markercreator,node_maptypes,node_supabaseservice toneAmber
class node_solacehandler,node_solaceconnection,node_solaceclient,node_solaceconfig,node_connectionmanager toneMint
class node_supabaseclient,node_optimizefunction,node_configfunction,node_chatfunction toneRose
class node_solaceservice toneIndigo
```

## Components

### Application experience

- [App shell](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/App.tsx): `src/App.tsx`
- [Map page](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Route panel](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/RoutePanel.tsx): `src/components/RoutePanel.tsx`
- [Chatbot widget](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/ui/ChatBotWidget.tsx): `src/components/ui/ChatBotWidget.tsx`

### Map and routing

- [Interactive map](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/Map.tsx): `src/components/Map.tsx`
- [Route markers](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/RouteMarkers.tsx): `src/components/RouteMarkers.tsx`
- [Traffic markers](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/TrafficMarker.tsx): `src/components/TrafficMarker.tsx`
- [Route calculator](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/map/RouteCalculator.tsx): `src/components/map/RouteCalculator.tsx`
- [Marker creator](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/map/MarkerCreator.tsx): `src/components/map/MarkerCreator.tsx`
- [Map data types](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/types/map.ts): `src/types/map.ts`

### Live updates

- [Update handler](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/SolaceHandler.tsx): `src/components/SolaceHandler.tsx`
- [Connection hook](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/components/solace/SolaceConnection.tsx): `src/components/solace/SolaceConnection.tsx`
- [Solace client](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/utils/solaceClient.ts): `src/utils/solaceClient.ts`
- [Solace config](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/utils/solace/config.ts): `src/utils/solace/config.ts`
- [Connection manager](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/utils/solace/connectionManager.ts): `src/utils/solace/connectionManager.ts`

### Backend services

- [Supabase client](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Route optimizer](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/supabase/functions/optimize-route/index.ts): `supabase/functions/optimize-route/index.ts`
- [Solace config function](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/supabase/functions/get-solace-config/index.ts): `supabase/functions/get-solace-config/index.ts`
- [Chatbot function](https://github.com/watson752/uottahacks7-route-optimizer/blob/main/supabase/functions/chatbot/index.ts): `supabase/functions/chatbot/index.ts`

### Other components

- **User**
- **Solace PubSub+**
- **Supabase**

## Connections

- User → App shell: opens app
- App shell → Map page: routes to (evidence: `src/App.tsx`)
- App shell → Chatbot widget: renders (evidence: `src/App.tsx`)
- Map page → Interactive map: renders (evidence: `src/pages/Index.tsx`)
- Map page → Route panel: renders (evidence: `src/pages/Index.tsx`)
- Interactive map → Route markers: renders (evidence: `src/components/Map.tsx`)
- Interactive map → Traffic markers: renders (evidence: `src/components/Map.tsx`)
- Interactive map → Update handler: renders (evidence: `src/components/Map.tsx`)
- Interactive map → Route calculator: delegates (evidence: `src/components/Map.tsx`)
- Interactive map → Supabase client: accesses (evidence: `src/components/Map.tsx`)
- Interactive map → Solace client: uses (evidence: `src/components/Map.tsx`)
- Update handler → Connection hook: connects with (evidence: `src/components/SolaceHandler.tsx`)
- Update handler → Solace client: subscribes (evidence: `src/components/SolaceHandler.tsx`)
- Update handler → Interactive map: sends updates (evidence: `src/components/Map.tsx`)
- Connection hook → Solace client: connects via (evidence: `src/components/solace/SolaceConnection.tsx`)
- Solace client → Supabase client: fetches config (evidence: `src/utils/solaceClient.ts`)
- Solace client → Solace config: configures session (evidence: `src/utils/solaceClient.ts`)
- Solace client → Solace PubSub+: publishes/subscribes
- Connection manager → Solace config: uses settings (evidence: `src/utils/solace/connectionManager.ts`)
- Connection manager → Solace PubSub+: manages session
- Route panel → Supabase client: reads traffic (evidence: `src/components/RoutePanel.tsx`)
- Route panel → Route optimizer: invokes (evidence: `src/components/RoutePanel.tsx`)
- Supabase client → Supabase: connects to (evidence: `src/integrations/supabase/client.ts`)
- Solace client → Solace config function: invokes (evidence: `src/utils/solaceClient.ts`)
- Solace config function → Supabase: serves config
- Route optimizer → Supabase: processes request
- Chatbot widget → Chatbot function: requests chat
