# roshni-07/weathergpt architecture

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

- Interactive diagram: https://gitdiagram.com/roshni-07/weathergpt
- Repository: https://github.com/roshni-07/weathergpt

## Overview

WeatherGPT combines a web weather interface with a FastAPI backend for conversational, location-aware weather guidance. The main flow sends a user question and location from the interface to the query API, where chat logic loads forecast data and produces an answer; separate API branches serve advisories, alerts, maps, routing, and sky features. The README documents those product capabilities, while sampled source confirms the query, deterministic weather analysis, Gemini integration, and alert-engine behavior. Some subsystem wiring is not shown in the excerpts, so uncertain links are omitted.

Main entry points: [`backend/app/main.py`](https://github.com/roshni-07/weathergpt/blob/main/backend/app/main.py) (API Application), [`src/services/api.js`](https://github.com/roshni-07/weathergpt/blob/main/src/services/api.js) (API Client), [`backend/app/services/chat_engine.py`](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/chat_engine.py) (Chat Orchestrator), [`backend/app/routers/query.py`](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/query.py) (Query Endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Weather Interface"]
  node_webapp["Weather UI<br/>[app.js]"]
  node_webapi["API Client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_fastapi["API Application<br/>[main.py]"]
  node_queryrouter["Query Endpoint<br/>[query.py]"]
  node_weatherrouters["Weather Endpoints"]
  node_auth["Google Sign-In<br/>[auth.py]"]
end

subgraph group_weather["Weather Intelligence"]
  node_chat["Chat Orchestrator<br/>[chat_engine.py]"]
  node_snapshot["Forecast Snapshot<br/>[snapshot.py]"]
  node_engine["Weather Decision Engine<br/>[engine.py]"]
  node_advisory["Persona Advisories<br/>[advisory.py]"]
  node_confidence["Confidence Scoring"]
  node_alertsengine["Alert Engine<br/>[alerts_engine.py]"]
end

subgraph group_locations["Location And Maps"]
  node_locationapi["Location Endpoints<br/>[places.py]"]
  node_geocoderouter["Geocoding Endpoint<br/>[geocode.py]"]
  node_geocode["Geocoding Service<br/>[geocode_service.py]"]
  node_maprouter["Weather Map Endpoint<br/>[map.py]"]
  node_route["Route Endpoint<br/>[route.py]"]
  node_sky["Sky Endpoint<br/>[sky.py]"]
end

subgraph group_integrations["External Data"]
  node_openmeteo["Forecast Data Service<br/>[openmeteo.py]"]
  node_owmservice["Weather Service<br/>[weather_service.py]"]
  node_gemini["Gemini Adapter<br/>[gemini_service.py]"]
  node_ndma["NDMA Alert Feed"]
end

node_user(("User"))
node_google["Google Identity"]

node_user -->|"asks weather"| node_webapp
node_webapp -->|"submits queries"| node_webapi
node_webapi -->|"posts query"| node_queryrouter
node_webapi -->|"requests features"| node_weatherrouters
node_webapi -->|"searches places"| node_locationapi
node_webapi -->|"loads map"| node_maprouter
node_webapi -->|"verifies token"| node_auth
node_fastapi -->|"registers routes"| node_queryrouter
node_fastapi -->|"registers routes"| node_weatherrouters
node_fastapi -->|"registers routes"| node_locationapi
node_fastapi -->|"registers routes"| node_geocoderouter
node_fastapi -->|"registers routes"| node_maprouter
node_fastapi -->|"registers routes"| node_route
node_fastapi -->|"registers routes"| node_sky
node_fastapi -->|"registers routes"| node_auth
node_queryrouter -->|"dispatches query"| node_chat
node_chat -->|"loads forecast"| node_snapshot
node_chat -->|"analyzes conditions"| node_engine
node_chat -->|"builds guidance"| node_advisory
node_chat -.->|"requests language help"| node_gemini
node_snapshot -->|"fetches weather"| node_openmeteo
node_alertsengine -.->|"fetches official alerts"| node_ndma
node_geocoderouter -->|"resolves locations"| node_geocode
node_auth -->|"validates identity"| node_google

click node_webapp "https://github.com/roshni-07/weathergpt/blob/main/src/app.js"
click node_webapi "https://github.com/roshni-07/weathergpt/blob/main/src/services/api.js"
click node_fastapi "https://github.com/roshni-07/weathergpt/blob/main/backend/app/main.py"
click node_queryrouter "https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/query.py"
click node_weatherrouters "https://github.com/roshni-07/weathergpt/tree/main/backend/app/routers"
click node_chat "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/chat_engine.py"
click node_snapshot "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/snapshot.py"
click node_engine "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/engine.py"
click node_advisory "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/advisory.py"
click node_confidence "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/confidence_engine.py"
click node_alertsengine "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/alerts_engine.py"
click node_openmeteo "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/openmeteo.py"
click node_owmservice "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/weather_service.py"
click node_gemini "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/gemini_service.py"
click node_locationapi "https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/places.py"
click node_geocoderouter "https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/geocode.py"
click node_geocode "https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/geocode_service.py"
click node_maprouter "https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/map.py"
click node_route "https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/route.py"
click node_sky "https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/sky.py"
click node_auth "https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/auth.py"

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_webapp,node_webapi,node_user toneBlue
class node_fastapi,node_queryrouter,node_weatherrouters,node_auth toneAmber
class node_chat,node_snapshot,node_engine,node_advisory,node_confidence,node_alertsengine toneMint
class node_locationapi,node_geocoderouter,node_geocode,node_maprouter,node_route,node_sky toneRose
class node_openmeteo,node_owmservice,node_gemini,node_ndma,node_google toneIndigo
```

## Components

### Weather Interface

- [Weather UI](https://github.com/roshni-07/weathergpt/blob/main/src/app.js): `src/app.js`
- [API Client](https://github.com/roshni-07/weathergpt/blob/main/src/services/api.js): `src/services/api.js`

### Backend API

- [API Application](https://github.com/roshni-07/weathergpt/blob/main/backend/app/main.py): `backend/app/main.py`
- [Query Endpoint](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/query.py): `backend/app/routers/query.py`
- [Weather Endpoints](https://github.com/roshni-07/weathergpt/tree/main/backend/app/routers): `backend/app/routers`
- [Google Sign-In](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`

### Weather Intelligence

- [Chat Orchestrator](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/chat_engine.py): `backend/app/services/chat_engine.py`
- [Forecast Snapshot](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/snapshot.py): `backend/app/services/snapshot.py`
- [Weather Decision Engine](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/engine.py): `backend/app/services/engine.py`
- [Persona Advisories](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/advisory.py): `backend/app/services/advisory.py`
- [Confidence Scoring](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/confidence_engine.py): `backend/app/services/confidence_engine.py`
- [Alert Engine](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/alerts_engine.py): `backend/app/services/alerts_engine.py`

### Location And Maps

- [Location Endpoints](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/places.py): `backend/app/routers/places.py`
- [Geocoding Endpoint](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/geocode.py): `backend/app/routers/geocode.py`
- [Geocoding Service](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/geocode_service.py): `backend/app/services/geocode_service.py`
- [Weather Map Endpoint](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/map.py): `backend/app/routers/map.py`
- [Route Endpoint](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/route.py): `backend/app/routers/route.py`
- [Sky Endpoint](https://github.com/roshni-07/weathergpt/blob/main/backend/app/routers/sky.py): `backend/app/routers/sky.py`

### External Data

- [Forecast Data Service](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/openmeteo.py): `backend/app/services/openmeteo.py`
- [Weather Service](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/weather_service.py): `backend/app/services/weather_service.py`
- [Gemini Adapter](https://github.com/roshni-07/weathergpt/blob/main/backend/app/services/gemini_service.py): `backend/app/services/gemini_service.py`
- **NDMA Alert Feed**

### Other components

- **User**
- **Google Identity**

## Connections

- User → Weather UI: asks weather
- Weather UI → API Client: submits queries
- API Client → Query Endpoint: posts query
- API Client → Weather Endpoints: requests features
- API Client → Location Endpoints: searches places
- API Client → Weather Map Endpoint: loads map
- API Client → Google Sign-In: verifies token
- API Application → Query Endpoint: registers routes
- API Application → Weather Endpoints: registers routes
- API Application → Location Endpoints: registers routes
- API Application → Geocoding Endpoint: registers routes
- API Application → Weather Map Endpoint: registers routes
- API Application → Route Endpoint: registers routes
- API Application → Sky Endpoint: registers routes
- API Application → Google Sign-In: registers routes
- Query Endpoint → Chat Orchestrator: dispatches query
- Chat Orchestrator → Forecast Snapshot: loads forecast
- Chat Orchestrator → Weather Decision Engine: analyzes conditions
- Chat Orchestrator → Persona Advisories: builds guidance
- Chat Orchestrator → Gemini Adapter: requests language help
- Forecast Snapshot → Forecast Data Service: fetches weather
- Alert Engine → NDMA Alert Feed: fetches official alerts
- Geocoding Endpoint → Geocoding Service: resolves locations
- Google Sign-In → Google Identity: validates identity
