# siddhesh-k7/breathewise-ai architecture

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

- Interactive diagram: https://gitdiagram.com/siddhesh-k7/breathewise-ai
- Repository: https://github.com/siddhesh-k7/breathewise-ai

## Overview

AirWise is a web air-quality assistant whose main workflow takes a household’s location and profile, gathers atmospheric and fire telemetry, calculates quantified impact, then returns a tailored smog action plan for display. The product also supports live AQI monitoring, ground-station cross-checks, fire context, conversational chat, city comparison, geocoding, and community sharing. Edges follow the README, indexed references, and excerpts; unsampled UI and API wiring is not inferred beyond documented relationships.

Main entry points: [`src/app/page.tsx`](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/page.tsx) (AirWise dashboard), [`src/app/api/recommendations/route.ts`](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/api/recommendations/route.ts) (Plan endpoint), [`src/app/api`](https://github.com/siddhesh-k7/breathewise-ai/tree/main/src/app/api) (Other product APIs), [`src/app/api/aqi/route.ts`](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/api/aqi/route.ts) (AQI endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["AirWise dashboard<br/>[page.tsx]"]
  node_aqi_ui["AQI insights"]
  node_profile["Household profile<br/>[ProfileForm.tsx]"]
  node_plan_ui["Plan display<br/>[PlanDisplay.tsx]"]
  node_simulator["Impact simulator"]
  node_chat_ui["Streaming chat<br/>[StreamingChat.tsx]"]
  node_community_ui["Community bulletin<br/>[CommunityCard.tsx]"]
  node_aqi_hook["Telemetry hook<br/>[useAqi.ts]"]
  node_plan_hook["Plan hook<br/>[usePlan.ts]"]
end

subgraph group_telemetry["Air telemetry"]
  node_aqi_api["AQI endpoint<br/>[route.ts]"]
  node_aqi_service["Open-Meteo telemetry<br/>[aqi-service.ts]"]
  node_waqi["Station cross-check<br/>[waqi-service.ts]"]
  node_firms["Fire detections<br/>[firms-service.ts]"]
  node_geocoding["Geocoding service"]
end

subgraph group_planning["Plans and impact"]
  node_recommendations["Plan endpoint<br/>[route.ts]"]
  node_impact["Impact calculator"]
  node_gemini["Plan and chat AI<br/>[gemini-service.ts]"]
  node_fallback["Fallback plan<br/>[fallback-plan.ts]"]
end

subgraph group_platform["API and state"]
  node_validation["Request schemas<br/>[schemas.ts]"]
  node_cache[("Memory cache<br/>[cache.ts]")]
  node_api_response["Response utilities<br/>[api-response.ts]"]
  node_other_api["Other product APIs"]
  node_db[("Application data store<br/>[db.ts]")]
  node_models["Data models<br/>[models.ts]"]
end

node_user(("Household user"))
node_external_meteo["Open-Meteo"]
node_external_waqi["WAQI"]
node_external_firms["NASA FIRMS"]

node_user -->|"uses"| node_home
node_home -->|"loads telemetry"| node_aqi_hook
node_home -->|"requests plan"| node_plan_hook
node_home -->|"renders"| node_aqi_ui
node_home -->|"renders"| node_profile
node_home -->|"renders"| node_plan_ui
node_home -->|"renders"| node_simulator
node_home -->|"renders"| node_chat_ui
node_home -.->|"renders"| node_community_ui
node_aqi_hook -->|"fetches"| node_aqi_api
node_plan_hook -.->|"submits plan"| node_recommendations
node_aqi_api -->|"fetches telemetry"| node_aqi_service
node_aqi_api -->|"cross-checks"| node_waqi
node_aqi_api -->|"loads fires"| node_firms
node_aqi_service -->|"fetches"| node_external_meteo
node_waqi -->|"fetches"| node_external_waqi
node_firms -->|"fetches"| node_external_firms
node_aqi_service -->|"reads and writes"| node_cache
node_waqi -->|"reads and writes"| node_cache
node_firms -->|"reads and writes"| node_cache
node_recommendations -->|"validates request"| node_validation
node_recommendations -->|"fetches telemetry"| node_aqi_service
node_recommendations -->|"cross-checks"| node_waqi
node_recommendations -->|"loads fire context"| node_firms
node_recommendations -->|"calculates impact"| node_impact
node_recommendations -->|"generates plan"| node_gemini
node_gemini -->|"falls back"| node_fallback
node_gemini -->|"caches plans"| node_cache
node_simulator -->|"calculates scenarios"| node_impact
node_chat_ui -.->|"streams chat"| node_other_api
node_other_api -->|"uses AI"| node_gemini
node_recommendations -->|"formats response"| node_api_response
node_other_api -->|"uses storage"| node_db
node_other_api -->|"uses models"| node_models
node_other_api -->|"serves search"| node_geocoding
node_geocoding -.->|"queries places"| node_external_meteo

click node_home "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/page.tsx"
click node_aqi_ui "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/aqi/SmartFamilyDashboard.tsx"
click node_profile "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/profile/ProfileForm.tsx"
click node_plan_ui "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/plan/PlanDisplay.tsx"
click node_simulator "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/simulator/WhatIfSimulator.tsx"
click node_chat_ui "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/chat/StreamingChat.tsx"
click node_community_ui "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/community/CommunityCard.tsx"
click node_aqi_hook "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/hooks/useAqi.ts"
click node_plan_hook "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/hooks/usePlan.ts"
click node_aqi_api "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/api/aqi/route.ts"
click node_aqi_service "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/aqi-service.ts"
click node_waqi "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/waqi-service.ts"
click node_firms "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/firms-service.ts"
click node_recommendations "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/api/recommendations/route.ts"
click node_impact "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/impact-calculator.ts"
click node_gemini "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/gemini-service.ts"
click node_fallback "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/fallback-plan.ts"
click node_validation "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/validators/schemas.ts"
click node_cache "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/cache.ts"
click node_api_response "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/api-response.ts"
click node_other_api "https://github.com/siddhesh-k7/breathewise-ai/tree/main/src/app/api"
click node_db "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/db.ts"
click node_models "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/models.ts"
click node_geocoding "https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/geocoding-service.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_home,node_aqi_ui,node_profile,node_plan_ui,node_simulator,node_chat_ui,node_community_ui,node_aqi_hook,node_plan_hook,node_user toneBlue
class node_aqi_api,node_aqi_service,node_waqi,node_firms,node_geocoding toneAmber
class node_recommendations,node_impact,node_gemini,node_fallback toneMint
class node_validation,node_cache,node_api_response,node_other_api,node_db,node_models toneRose
class node_external_meteo,node_external_waqi,node_external_firms toneIndigo
```

## Components

### User experience

- [AirWise dashboard](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [AQI insights](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/aqi/SmartFamilyDashboard.tsx): `src/components/aqi/SmartFamilyDashboard.tsx`
- [Household profile](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/profile/ProfileForm.tsx): `src/components/profile/ProfileForm.tsx`
- [Plan display](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/plan/PlanDisplay.tsx): `src/components/plan/PlanDisplay.tsx`
- [Impact simulator](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/simulator/WhatIfSimulator.tsx): `src/components/simulator/WhatIfSimulator.tsx`
- [Streaming chat](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/chat/StreamingChat.tsx): `src/components/chat/StreamingChat.tsx`
- [Community bulletin](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/components/community/CommunityCard.tsx): `src/components/community/CommunityCard.tsx`
- [Telemetry hook](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/hooks/useAqi.ts): `src/hooks/useAqi.ts`
- [Plan hook](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/hooks/usePlan.ts): `src/hooks/usePlan.ts`

### Air telemetry

- [AQI endpoint](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/api/aqi/route.ts): `src/app/api/aqi/route.ts`
- [Open-Meteo telemetry](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/aqi-service.ts): `src/services/aqi-service.ts`
- [Station cross-check](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/waqi-service.ts): `src/services/waqi-service.ts`
- [Fire detections](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/firms-service.ts): `src/services/firms-service.ts`
- [Geocoding service](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/geocoding-service.ts): `src/services/geocoding-service.ts`

### Plans and impact

- [Plan endpoint](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/app/api/recommendations/route.ts): `src/app/api/recommendations/route.ts`
- [Impact calculator](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/impact-calculator.ts): `src/services/impact-calculator.ts`
- [Plan and chat AI](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/gemini-service.ts): `src/services/gemini-service.ts`
- [Fallback plan](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/fallback-plan.ts): `src/services/fallback-plan.ts`

### API and state

- [Request schemas](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/validators/schemas.ts): `src/validators/schemas.ts`
- [Memory cache](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/cache.ts): `src/services/cache.ts`
- [Response utilities](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/api-response.ts): `src/services/api-response.ts`
- [Other product APIs](https://github.com/siddhesh-k7/breathewise-ai/tree/main/src/app/api): `src/app/api`
- [Application data store](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/db.ts): `src/services/db.ts`
- [Data models](https://github.com/siddhesh-k7/breathewise-ai/blob/main/src/services/models.ts): `src/services/models.ts`

### Other components

- **Household user**
- **Open-Meteo**
- **WAQI**
- **NASA FIRMS**

## Connections

- Household user → AirWise dashboard: uses (evidence: `README.md`)
- AirWise dashboard → Telemetry hook: loads telemetry (evidence: `src/app/page.tsx`)
- AirWise dashboard → Plan hook: requests plan (evidence: `src/app/page.tsx`)
- AirWise dashboard → AQI insights: renders (evidence: `src/app/page.tsx`)
- AirWise dashboard → Household profile: renders (evidence: `src/app/page.tsx`)
- AirWise dashboard → Plan display: renders (evidence: `src/app/page.tsx`)
- AirWise dashboard → Impact simulator: renders (evidence: `src/app/page.tsx`)
- AirWise dashboard → Streaming chat: renders (evidence: `src/app/page.tsx`)
- AirWise dashboard → Community bulletin: renders (evidence: `src/app/page.tsx`)
- Telemetry hook → AQI endpoint: fetches (evidence: `src/hooks/useAqi.ts`)
- Plan hook → Plan endpoint: submits plan
- AQI endpoint → Open-Meteo telemetry: fetches telemetry (evidence: `src/app/api/aqi/route.ts`)
- AQI endpoint → Station cross-check: cross-checks (evidence: `src/app/api/aqi/route.ts`)
- AQI endpoint → Fire detections: loads fires (evidence: `src/app/api/aqi/route.ts`)
- Open-Meteo telemetry → Open-Meteo: fetches (evidence: `src/services/aqi-service.ts`)
- Station cross-check → WAQI: fetches (evidence: `src/services/waqi-service.ts`)
- Fire detections → NASA FIRMS: fetches (evidence: `src/services/firms-service.ts`)
- Open-Meteo telemetry → Memory cache: reads and writes (evidence: `src/services/aqi-service.ts`)
- Station cross-check → Memory cache: reads and writes (evidence: `src/services/waqi-service.ts`)
- Fire detections → Memory cache: reads and writes (evidence: `src/services/firms-service.ts`)
- Plan endpoint → Request schemas: validates request (evidence: `src/app/api/recommendations/route.ts`)
- Plan endpoint → Open-Meteo telemetry: fetches telemetry (evidence: `src/app/api/recommendations/route.ts`)
- Plan endpoint → Station cross-check: cross-checks (evidence: `src/app/api/recommendations/route.ts`)
- Plan endpoint → Fire detections: loads fire context (evidence: `src/app/api/recommendations/route.ts`)
- Plan endpoint → Impact calculator: calculates impact (evidence: `src/app/api/recommendations/route.ts`)
- Plan endpoint → Plan and chat AI: generates plan (evidence: `src/app/api/recommendations/route.ts`)
- Plan and chat AI → Fallback plan: falls back (evidence: `src/services/gemini-service.ts`)
- Plan and chat AI → Memory cache: caches plans (evidence: `src/services/gemini-service.ts`)
- Impact simulator → Impact calculator: calculates scenarios (evidence: `src/components/simulator/WhatIfSimulator.tsx`)
- Streaming chat → Other product APIs: streams chat
- Other product APIs → Plan and chat AI: uses AI (evidence: `src/app/api/chat/route.ts`)
- Plan endpoint → Response utilities: formats response (evidence: `src/app/api/recommendations/route.ts`)
- Other product APIs → Application data store: uses storage (evidence: `src/app/api/profile/route.ts`)
- Other product APIs → Data models: uses models (evidence: `src/app/api/profile/route.ts`)
- Other product APIs → Geocoding service: serves search (evidence: `src/app/api/geocoding/route.ts`)
- Geocoding service → Open-Meteo: queries places
