# shubh3155/aws-dtu architecture

> Architecture diagram of the GitHub repository shubh3155/aws-dtu, 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/shubh3155/aws-dtu
- Repository: https://github.com/shubh3155/aws-dtu

## Overview

AeroRoute is a walking-route comparison product that estimates PM2.5 exposure against a user-defined time budget. The main workflow is to choose an origin and destination, request genuine route candidates, then compare their exposure and data quality using either current regional forecasts or historical observations. The README also describes Google sign-in, saved recent routes, and opt-in navigation alerts. Several frontend and backend modules are identified by the source index but were not excerpted; their links are shown only where the README documents the relationship.

Main entry points: [`backend/app/api/routes.py`](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/api/routes.py) (Route comparison API), [`frontend/src/components/journey-workspace.tsx`](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/journey-workspace.tsx) (Journey workspace), [`backend/app/services/comparison.py`](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/comparison.py) (Comparison service), [`backend/app/api/navigation.py`](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/api/navigation.py) (Navigation and alerts API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Journey experience"]
  node_journey_ui["Journey workspace"]
  node_map_ui["Route map<br/>[journey-map.tsx]"]
  node_recent_ui["Recent routes<br/>[recent-routes.tsx]"]
  node_frontend_api["API client<br/>[api.ts]"]
  node_auth_ui["Sign-in provider<br/>[auth-provider.tsx]"]
  node_history_lib["Route history<br/>[route-history.ts]"]
  node_firebase_client["Firebase client<br/>[firebase.ts]"]
end

subgraph group_routes["Routing and scoring"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_compare_api["Route comparison API<br/>[routes.py]"]
  node_route_contracts["Route contracts<br/>[routes.py]"]
  node_walking["Walking candidates<br/>[walking.py]"]
  node_comparison["Comparison service<br/>[comparison.py]"]
  node_baseline["Exposure baseline<br/>[baseline.py]"]
  node_route_quality["Route quality<br/>[route_quality.py]"]
end

subgraph group_air["Air-quality data"]
  node_live_air["Live forecasts"]
  node_open_meteo["Open-Meteo / CAMS"]
  node_snapshots["Snapshot reader<br/>[snapshots.py]"]
  node_database[("Supabase database")]
  node_ingestion["OpenAQ ingestion<br/>[ingestion.py]"]
  node_ingestion_entry["Ingestion entry point<br/>[ingest_openaq.py]"]
end

subgraph group_identity["Accounts and alerts"]
  node_firebase["Firebase gateway<br/>[firebase.py]"]
  node_navigation_api["Navigation and alerts API<br/>[navigation.py]"]
  node_alerts["Direction alerts<br/>[notifications.py]"]
  node_firebase_services["Firebase Auth / Firestore / FCM"]
end

node_traveler(("Traveler"))

node_traveler -->|"plans journey"| node_journey_ui
node_journey_ui -.->|"requests comparison"| node_frontend_api
node_frontend_api -->|"calls API"| node_compare_api
node_api_app -->|"routes requests"| node_compare_api
node_compare_api -->|"validates and returns"| node_route_contracts
node_compare_api -->|"fetches candidates"| node_walking
node_walking -->|"screens alternatives"| node_route_quality
node_compare_api -->|"evaluates routes"| node_comparison
node_comparison -->|"scores exposure"| node_baseline
node_comparison -->|"requests live scores"| node_live_air
node_comparison -->|"requests replay scores"| node_snapshots
node_compare_api -->|"loads snapshot"| node_snapshots
node_live_air -->|"fetches forecasts"| node_open_meteo
node_snapshots -->|"reads observations"| node_database
node_ingestion_entry -->|"prepares report"| node_ingestion
node_ingestion -->|"writes snapshot"| node_database
node_compare_api -.->|"returns route results"| node_map_ui
node_map_ui -.->|"shows comparison"| node_journey_ui
node_journey_ui -.->|"shows saved routes"| node_recent_ui
node_auth_ui -.->|"starts sign-in"| node_firebase_client
node_firebase_client -->|"authenticates user"| node_firebase_services
node_recent_ui -.->|"loads route history"| node_history_lib
node_journey_ui -.->|"requests direction alerts"| node_navigation_api
node_api_app -->|"routes requests"| node_navigation_api
node_navigation_api -->|"verifies session"| node_firebase
node_navigation_api -->|"delegates alerts"| node_alerts
node_alerts -.->|"uses cloud gateway"| node_firebase
node_firebase -.->|"accesses cloud services"| node_firebase_services

click node_journey_ui "https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/journey-workspace.tsx"
click node_map_ui "https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/journey-map.tsx"
click node_recent_ui "https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/recent-routes.tsx"
click node_frontend_api "https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/lib/api.ts"
click node_api_app "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/main.py"
click node_compare_api "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/api/routes.py"
click node_route_contracts "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/schemas/routes.py"
click node_walking "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/walking.py"
click node_comparison "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/comparison.py"
click node_baseline "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/model/baseline.py"
click node_route_quality "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/route_quality.py"
click node_live_air "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/live_air_quality.py"
click node_snapshots "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/snapshots.py"
click node_ingestion "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/ingestion.py"
click node_ingestion_entry "https://github.com/shubh3155/aws-dtu/blob/main/backend/scripts/ingest_openaq.py"
click node_firebase "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/core/firebase.py"
click node_navigation_api "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/api/navigation.py"
click node_alerts "https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/notifications.py"
click node_auth_ui "https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/auth-provider.tsx"
click node_history_lib "https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/lib/route-history.ts"
click node_firebase_client "https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/lib/firebase.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_journey_ui,node_map_ui,node_recent_ui,node_frontend_api,node_auth_ui,node_history_lib,node_firebase_client toneBlue
class node_api_app,node_compare_api,node_route_contracts,node_walking,node_comparison,node_baseline,node_route_quality toneAmber
class node_live_air,node_open_meteo,node_snapshots,node_database,node_ingestion,node_ingestion_entry toneMint
class node_firebase,node_navigation_api,node_alerts,node_firebase_services toneRose
class node_traveler toneIndigo
```

## Components

### Journey experience

- [Journey workspace](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/journey-workspace.tsx): `frontend/src/components/journey-workspace.tsx`
- [Route map](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/journey-map.tsx): `frontend/src/components/journey-map.tsx`
- [Recent routes](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/recent-routes.tsx): `frontend/src/components/recent-routes.tsx`
- [API client](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Sign-in provider](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/components/auth-provider.tsx): `frontend/src/components/auth-provider.tsx`
- [Route history](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/lib/route-history.ts): `frontend/src/lib/route-history.ts`
- [Firebase client](https://github.com/shubh3155/aws-dtu/blob/main/frontend/src/lib/firebase.ts): `frontend/src/lib/firebase.ts`

### Routing and scoring

- [FastAPI app](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/main.py): `backend/app/main.py`
- [Route comparison API](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Route contracts](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/schemas/routes.py): `backend/app/schemas/routes.py`
- [Walking candidates](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/walking.py): `backend/app/services/walking.py`
- [Comparison service](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/comparison.py): `backend/app/services/comparison.py`
- [Exposure baseline](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/model/baseline.py): `backend/app/model/baseline.py`
- [Route quality](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/route_quality.py): `backend/app/services/route_quality.py`

### Air-quality data

- [Live forecasts](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/live_air_quality.py): `backend/app/services/live_air_quality.py`
- **Open-Meteo / CAMS**
- [Snapshot reader](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/snapshots.py): `backend/app/services/snapshots.py`
- **Supabase database**
- [OpenAQ ingestion](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/ingestion.py): `backend/app/services/ingestion.py`
- [Ingestion entry point](https://github.com/shubh3155/aws-dtu/blob/main/backend/scripts/ingest_openaq.py): `backend/scripts/ingest_openaq.py`

### Accounts and alerts

- [Firebase gateway](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/core/firebase.py): `backend/app/core/firebase.py`
- [Navigation and alerts API](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/api/navigation.py): `backend/app/api/navigation.py`
- [Direction alerts](https://github.com/shubh3155/aws-dtu/blob/main/backend/app/services/notifications.py): `backend/app/services/notifications.py`
- **Firebase Auth / Firestore / FCM**

### Other components

- **Traveler**

## Connections

- Traveler → Journey workspace: plans journey (evidence: `README.md`)
- Journey workspace → API client: requests comparison
- API client → Route comparison API: calls API (evidence: `README.md`)
- FastAPI app → Route comparison API: routes requests (evidence: `backend/app/main.py`)
- Route comparison API → Route contracts: validates and returns (evidence: `backend/app/api/routes.py`)
- Route comparison API → Walking candidates: fetches candidates (evidence: `backend/app/api/routes.py`)
- Walking candidates → Route quality: screens alternatives (evidence: `backend/app/services/walking.py`)
- Route comparison API → Comparison service: evaluates routes (evidence: `backend/app/api/routes.py`)
- Comparison service → Exposure baseline: scores exposure (evidence: `backend/app/services/comparison.py`)
- Comparison service → Live forecasts: requests live scores (evidence: `backend/app/services/comparison.py`)
- Comparison service → Snapshot reader: requests replay scores (evidence: `backend/app/services/comparison.py`)
- Route comparison API → Snapshot reader: loads snapshot (evidence: `backend/app/api/routes.py`)
- Live forecasts → Open-Meteo / CAMS: fetches forecasts (evidence: `backend/app/services/live_air_quality.py`)
- Snapshot reader → Supabase database: reads observations (evidence: `backend/app/services/snapshots.py`)
- Ingestion entry point → OpenAQ ingestion: prepares report (evidence: `backend/scripts/ingest_openaq.py`)
- OpenAQ ingestion → Supabase database: writes snapshot (evidence: `backend/app/services/ingestion.py`)
- Route comparison API → Route map: returns route results
- Route map → Journey workspace: shows comparison
- Journey workspace → Recent routes: shows saved routes
- Sign-in provider → Firebase client: starts sign-in
- Firebase client → Firebase Auth / Firestore / FCM: authenticates user (evidence: `README.md`)
- Recent routes → Route history: loads route history
- Journey workspace → Navigation and alerts API: requests direction alerts
- FastAPI app → Navigation and alerts API: routes requests (evidence: `backend/app/main.py`)
- Navigation and alerts API → Firebase gateway: verifies session (evidence: `backend/app/api/navigation.py`)
- Navigation and alerts API → Direction alerts: delegates alerts (evidence: `backend/app/api/navigation.py`)
- Direction alerts → Firebase gateway: uses cloud gateway
- Firebase gateway → Firebase Auth / Firestore / FCM: accesses cloud services
