# arthavgonda/coolcommute architecture

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

- Interactive diagram: https://gitdiagram.com/arthavgonda/coolcommute
- Repository: https://github.com/arthavgonda/coolcommute

## Overview

CoolCommute is a cross-platform climate-aware commuting app. Its main flow restores a session and saved profile, guides users through authentication, location and travel-preference onboarding, then lets them search for and compare commute routes. The Home screen also manages profile sync, account actions and optional background location. The graph includes documented profile and route-service integrations; several UI, map and location modules are unsampled, so their internal wiring is shown only where the index or excerpts support it.

Main entry points: [`src/home/Home.tsx`](https://github.com/arthavgonda/coolcommute/blob/main/src/home/Home.tsx) (Home dashboard), [`App.tsx`](https://github.com/arthavgonda/coolcommute/blob/main/App.tsx) (App bootstrap), [`src/data/profile.ts`](https://github.com/arthavgonda/coolcommute/blob/main/src/data/profile.ts) (Profile sync), [`src/dashboard/otpRoutes.ts`](https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/otpRoutes.ts) (Route scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["App bootstrap<br/>[App.tsx]"]
  node_onboarding["Onboarding flow<br/>[Onboarding.tsx]"]
  node_home["Home dashboard<br/>[Home.tsx]"]
  node_preferences["Travel preferences<br/>[questions.ts]"]
end

subgraph group_commute["Commute planning"]
  node_search["Place search<br/>[locationSearch.ts]"]
  node_route_scoring["Route scoring<br/>[otpRoutes.ts]"]
  node_route_service{{"Route service"}}
  node_commute_map["Commute map<br/>[CommuteMap.tsx]"]
  node_map_renderer["Platform map"]
  node_mode_markers["Route mode markers"]
  node_background_location["Background location"]
  node_device_location{{"Device location"}}
end

subgraph group_identity["Identity and profile"]
  node_auth["Cognito auth<br/>[cognito.ts]"]
  node_cognito{{"AWS Cognito"}}
  node_profile["Profile sync<br/>[profile.ts]"]
  node_local_store[("Local persistence<br/>[localStore.ts]")]
  node_api_gateway{{"Profile API"}}
  node_backend_errors["Backend failure state<br/>[backendFailure.ts]"]
end

subgraph group_presentation["UI and platform"]
  node_backdrop["Backdrop<br/>[Backdrop.tsx]"]
  node_backend_error_screen["Backend error screen"]
  node_glass_ui["Glass surfaces<br/>[GlassSurface.ts]"]
  node_lottie["Lottie animations<br/>[Lottie.ts]"]
  node_theme["Theme tokens<br/>[theme.ts]"]
end

node_user(("Commuter"))

node_user -->|"opens"| node_app
node_app -->|"restores session"| node_auth
node_app -->|"loads profile"| node_profile
node_app -->|"routes to"| node_onboarding
node_app -->|"routes to"| node_home
node_app -->|"renders"| node_backdrop
node_app -->|"renders"| node_backend_error_screen
node_app -->|"subscribes to"| node_backend_errors
node_app -->|"reads"| node_theme
node_onboarding -.->|"completes into"| node_home
node_home -->|"searches places"| node_search
node_home -->|"requests routes"| node_route_scoring
node_route_scoring -->|"posts route request"| node_route_service
node_route_scoring -->|"requests fare quote"| node_route_service
node_home -->|"renders"| node_commute_map
node_commute_map -.->|"delegates rendering"| node_map_renderer
node_route_scoring -.->|"provides route modes"| node_mode_markers
node_home -->|"reads preferences"| node_preferences
node_home -->|"uses account actions"| node_auth
node_auth -->|"authenticates"| node_cognito
node_home -->|"syncs profile"| node_profile
node_profile -->|"reads and writes"| node_local_store
node_profile -->|"gets username"| node_auth
node_profile -->|"calls profile API"| node_api_gateway
node_profile -->|"reports failures"| node_backend_errors
node_home -->|"controls tracking"| node_background_location
node_background_location -->|"requests updates"| node_device_location
node_home -->|"uses animations"| node_lottie
node_onboarding -.->|"uses glass cards"| node_glass_ui
node_glass_ui -->|"reads tokens"| node_theme

click node_app "https://github.com/arthavgonda/coolcommute/blob/main/App.tsx"
click node_onboarding "https://github.com/arthavgonda/coolcommute/blob/main/src/onboarding/Onboarding.tsx"
click node_home "https://github.com/arthavgonda/coolcommute/blob/main/src/home/Home.tsx"
click node_preferences "https://github.com/arthavgonda/coolcommute/blob/main/src/data/questions.ts"
click node_search "https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/locationSearch.ts"
click node_route_scoring "https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/otpRoutes.ts"
click node_commute_map "https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/CommuteMap.tsx"
click node_map_renderer "https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/MapboxMap.native.tsx"
click node_mode_markers "https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/RouteModeMarker.tsx"
click node_auth "https://github.com/arthavgonda/coolcommute/blob/main/src/auth/cognito.ts"
click node_profile "https://github.com/arthavgonda/coolcommute/blob/main/src/data/profile.ts"
click node_local_store "https://github.com/arthavgonda/coolcommute/blob/main/src/data/localStore.ts"
click node_backend_errors "https://github.com/arthavgonda/coolcommute/blob/main/src/data/backendFailure.ts"
click node_background_location "https://github.com/arthavgonda/coolcommute/blob/main/src/location/backgroundLocationTask.native.ts"
click node_backdrop "https://github.com/arthavgonda/coolcommute/blob/main/src/components/Backdrop.tsx"
click node_backend_error_screen "https://github.com/arthavgonda/coolcommute/blob/main/src/components/BackendErrorScreen.tsx"
click node_glass_ui "https://github.com/arthavgonda/coolcommute/blob/main/src/components/GlassSurface.ts"
click node_lottie "https://github.com/arthavgonda/coolcommute/blob/main/src/components/Lottie.ts"
click node_theme "https://github.com/arthavgonda/coolcommute/blob/main/src/theme.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_onboarding,node_home,node_preferences toneBlue
class node_search,node_route_scoring,node_route_service,node_commute_map,node_map_renderer,node_mode_markers,node_background_location,node_device_location toneAmber
class node_auth,node_cognito,node_profile,node_local_store,node_api_gateway,node_backend_errors toneMint
class node_backdrop,node_backend_error_screen,node_glass_ui,node_lottie,node_theme toneRose
class node_user toneIndigo
```

## Components

### App experience

- [App bootstrap](https://github.com/arthavgonda/coolcommute/blob/main/App.tsx): `App.tsx`
- [Onboarding flow](https://github.com/arthavgonda/coolcommute/blob/main/src/onboarding/Onboarding.tsx): `src/onboarding/Onboarding.tsx`
- [Home dashboard](https://github.com/arthavgonda/coolcommute/blob/main/src/home/Home.tsx): `src/home/Home.tsx`
- [Travel preferences](https://github.com/arthavgonda/coolcommute/blob/main/src/data/questions.ts): `src/data/questions.ts`

### Commute planning

- [Place search](https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/locationSearch.ts): `src/dashboard/locationSearch.ts`
- [Route scoring](https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/otpRoutes.ts): `src/dashboard/otpRoutes.ts`
- **Route service**
- [Commute map](https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/CommuteMap.tsx): `src/dashboard/CommuteMap.tsx`
- [Platform map](https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/MapboxMap.native.tsx): `src/dashboard/MapboxMap.native.tsx`
- [Route mode markers](https://github.com/arthavgonda/coolcommute/blob/main/src/dashboard/RouteModeMarker.tsx): `src/dashboard/RouteModeMarker.tsx`
- [Background location](https://github.com/arthavgonda/coolcommute/blob/main/src/location/backgroundLocationTask.native.ts): `src/location/backgroundLocationTask.native.ts`
- **Device location**

### Identity and profile

- [Cognito auth](https://github.com/arthavgonda/coolcommute/blob/main/src/auth/cognito.ts): `src/auth/cognito.ts`
- **AWS Cognito**
- [Profile sync](https://github.com/arthavgonda/coolcommute/blob/main/src/data/profile.ts): `src/data/profile.ts`
- [Local persistence](https://github.com/arthavgonda/coolcommute/blob/main/src/data/localStore.ts): `src/data/localStore.ts`
- **Profile API**
- [Backend failure state](https://github.com/arthavgonda/coolcommute/blob/main/src/data/backendFailure.ts): `src/data/backendFailure.ts`

### UI and platform

- [Backdrop](https://github.com/arthavgonda/coolcommute/blob/main/src/components/Backdrop.tsx): `src/components/Backdrop.tsx`
- [Backend error screen](https://github.com/arthavgonda/coolcommute/blob/main/src/components/BackendErrorScreen.tsx): `src/components/BackendErrorScreen.tsx`
- [Glass surfaces](https://github.com/arthavgonda/coolcommute/blob/main/src/components/GlassSurface.ts): `src/components/GlassSurface.ts`
- [Lottie animations](https://github.com/arthavgonda/coolcommute/blob/main/src/components/Lottie.ts): `src/components/Lottie.ts`
- [Theme tokens](https://github.com/arthavgonda/coolcommute/blob/main/src/theme.ts): `src/theme.ts`

### Other components

- **Commuter**

## Connections

- Commuter → App bootstrap: opens
- App bootstrap → Cognito auth: restores session (evidence: `App.tsx`)
- App bootstrap → Profile sync: loads profile (evidence: `App.tsx`)
- App bootstrap → Onboarding flow: routes to (evidence: `App.tsx`)
- App bootstrap → Home dashboard: routes to (evidence: `App.tsx`)
- App bootstrap → Backdrop: renders (evidence: `App.tsx`)
- App bootstrap → Backend error screen: renders (evidence: `App.tsx`)
- App bootstrap → Backend failure state: subscribes to (evidence: `App.tsx`)
- App bootstrap → Theme tokens: reads (evidence: `App.tsx`)
- Onboarding flow → Home dashboard: completes into
- Home dashboard → Place search: searches places (evidence: `src/home/Home.tsx`)
- Home dashboard → Route scoring: requests routes (evidence: `src/home/Home.tsx`)
- Route scoring → Route service: posts route request (evidence: `src/dashboard/otpRoutes.ts`)
- Route scoring → Route service: requests fare quote (evidence: `src/dashboard/otpRoutes.ts`)
- Home dashboard → Commute map: renders (evidence: `src/home/Home.tsx`)
- Commute map → Platform map: delegates rendering
- Route scoring → Route mode markers: provides route modes
- Home dashboard → Travel preferences: reads preferences (evidence: `src/home/Home.tsx`)
- Home dashboard → Cognito auth: uses account actions (evidence: `src/home/Home.tsx`)
- Cognito auth → AWS Cognito: authenticates (evidence: `src/auth/cognito.ts`)
- Home dashboard → Profile sync: syncs profile (evidence: `src/home/Home.tsx`)
- Profile sync → Local persistence: reads and writes (evidence: `src/data/profile.ts`)
- Profile sync → Cognito auth: gets username (evidence: `src/data/profile.ts`)
- Profile sync → Profile API: calls profile API (evidence: `src/data/profile.ts`)
- Profile sync → Backend failure state: reports failures (evidence: `src/data/profile.ts`)
- Home dashboard → Background location: controls tracking (evidence: `src/home/Home.tsx`)
- Background location → Device location: requests updates (evidence: `src/location/backgroundLocationTask.native.ts`)
- Home dashboard → Lottie animations: uses animations (evidence: `src/home/Home.tsx`)
- Onboarding flow → Glass surfaces: uses glass cards
- Glass surfaces → Theme tokens: reads tokens (evidence: `src/components/GlassCard.tsx`)
