# jorguzman100/weather-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/jorguzman100/weather-dashboard
- Repository: https://github.com/jorguzman100/weather-dashboard

## Overview

#### Purpose and Entry Points
AeroPulse is a single-process weather dashboard: a Node.js server serves a static browser client and proxies weather-provider calls. Runtime starts through the package start script and `server.js`; the browser entry document is `client/index.html`.

#### Server / API Boundary
`server.js` is the backend boundary for secrets and third-party requests. It exposes:
- `GET /api/weather?q=city` for city lookup/current-weather coordinates.
- `GET /api/onecall?lat=...&lon=...` for current and daily forecast data.
- `GET /api/config` to provide the Windy browser-SDK key.

The frontend calls only same-origin API routes; the server uses environment-supplied OpenWeather and Windy credentials. `.env_example` defines `OPENWEATHER_API_KEY`, `WINDY_API_KEY`, and `PORT`.

#### Browser Application Controller
`client/app.js` owns client-side control flow: user city search triggers the weather lookup, then coordinate-based forecast retrieval, followed by UI and map updates. It also restores and persists user state—recent city searches (maximum 10) and light/dark theme preference—via browser `localStorage`.

#### Weather Presentation
`client/index.html` defines the dashboard surface for search, current conditions, forecast, history, theme controls, and the map container. `client/style.css` provides the responsive visual system and theme styling. `client/app.js` transforms API payloads into current-condition and five-day forecast cards, including weather metrics and status presentation.

#### Interactive Map Integration
The selected city’s coordinates flow from the OpenWeather lookup into the Windy map integration in `client/app.js`. The client loads the Windy SDK and receives its runtime key from `/api/config`; this is distinct from OpenWeather calls, which remain server-proxied.

#### Runtime and External Dependencies
The deployment unit is Node.js with static-client hosting and API proxying in `server.js`. The browser depends on CDN-loaded jQuery, Moment.js, Leaflet, and the Windy SDK, as declared by the frontend entry page `client/index.html`. External services are OpenWeather for location/current/forecast data and Windy for the interactive map.

Main entry points: [`client/app.js`](https://github.com/jorguzman100/weather-dashboard/blob/main/client/app.js) (App controller), [`server.js`](https://github.com/jorguzman100/weather-dashboard/blob/main/server.js) (Server and API proxy), [`client/index.html`](https://github.com/jorguzman100/weather-dashboard/blob/main/client/index.html) (Dashboard page), [`.env_example`](https://github.com/jorguzman100/weather-dashboard/blob/main/.env_example) (Environment credentials)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Node Runtime"]
  node_node_runtime{{"Node.js process<br/>runtime"}}
  node_server["Server and API proxy<br/>Node server<br/>[server.js]"]
  node_env["Environment credentials<br/>[.env_example]"]
end

subgraph group_browser["Browser App"]
  node_browser["Dashboard page<br/>browser entry<br/>[index.html]"]
  node_controller["App controller<br/>client controller<br/>[app.js]"]
  node_styles["Responsive themes<br/>stylesheet<br/>[style.css]"]
  node_dashboard_ui["Weather dashboard<br/>presentation<br/>[index.html]"]
  node_local_storage[("User state<br/>browser storage")]
  node_cdn_libs{{"Browser libraries<br/>CDN dependencies<br/>[index.html]"}}
  node_windy_map["Interactive map<br/>map integration<br/>[app.js]"]
end

subgraph group_external["External Services"]
  node_openweather{{"OpenWeather<br/>weather provider"}}
  node_windy{{"Windy<br/>map provider"}}
end

node_node_runtime -->|"runs"| node_server
node_env -.->|"credentials and port"| node_server
node_server -->|"serves static client"| node_browser
node_browser -->|"loads"| node_controller
node_browser -->|"applies"| node_styles
node_browser -->|"loads from CDN"| node_cdn_libs
node_controller -->|"updates conditions and forecast"| node_dashboard_ui
node_controller -->|"restores and persists"| node_local_storage
node_controller -->|"same-origin weather API"| node_server
node_server -->|"proxies weather requests"| node_openweather
node_controller -->|"gets Windy SDK key"| node_server
node_controller -->|"passes selected coordinates"| node_windy_map
node_cdn_libs -->|"supplies map SDK"| node_windy_map
node_windy -->|"map service"| node_windy_map
node_env -.->|"SDK credential"| node_windy

click node_server "https://github.com/jorguzman100/weather-dashboard/blob/main/server.js"
click node_env "https://github.com/jorguzman100/weather-dashboard/blob/main/.env_example"
click node_browser "https://github.com/jorguzman100/weather-dashboard/blob/main/client/index.html"
click node_controller "https://github.com/jorguzman100/weather-dashboard/blob/main/client/app.js"
click node_styles "https://github.com/jorguzman100/weather-dashboard/blob/main/client/style.css"
click node_dashboard_ui "https://github.com/jorguzman100/weather-dashboard/blob/main/client/index.html"
click node_cdn_libs "https://github.com/jorguzman100/weather-dashboard/blob/main/client/index.html"
click node_windy_map "https://github.com/jorguzman100/weather-dashboard/blob/main/client/app.js"

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_node_runtime,node_server,node_env toneBlue
class node_browser,node_controller,node_styles,node_dashboard_ui,node_local_storage,node_cdn_libs,node_windy_map toneAmber
class node_openweather,node_windy toneMint
```

## Components

### Node Runtime

- **Node.js process**: runtime · Single deployment unit serving the dashboard and API proxy.
- [Server and API proxy](https://github.com/jorguzman100/weather-dashboard/blob/main/server.js): Node server · Hosts static files and protects provider credentials. · `server.js`
- [Environment credentials](https://github.com/jorguzman100/weather-dashboard/blob/main/.env_example): environment · Defines OpenWeather, Windy, and port settings. · `.env_example`

### Browser App

- [Dashboard page](https://github.com/jorguzman100/weather-dashboard/blob/main/client/index.html): browser entry · Static dashboard entry surface. · `client/index.html`
- [App controller](https://github.com/jorguzman100/weather-dashboard/blob/main/client/app.js): client controller · Coordinates search, forecast, persistence, UI, and map updates. · `client/app.js`
- [Responsive themes](https://github.com/jorguzman100/weather-dashboard/blob/main/client/style.css): stylesheet · `client/style.css`
- [Weather dashboard](https://github.com/jorguzman100/weather-dashboard/blob/main/client/index.html): presentation · Search, conditions, forecast, history, theme, and map surface. · `client/index.html`
- **User state**: browser storage · Stores recent searches and theme preference.
- [Browser libraries](https://github.com/jorguzman100/weather-dashboard/blob/main/client/index.html): CDN dependencies · jQuery, Moment.js, Leaflet, and the Windy SDK. · `client/index.html`
- [Interactive map](https://github.com/jorguzman100/weather-dashboard/blob/main/client/app.js): map integration · Renders the selected city's coordinates. · `client/app.js`

### External Services

- **OpenWeather**: weather provider · Provides city lookup, current conditions, and forecasts.
- **Windy**: map provider · Provides the interactive weather map SDK.

## Connections

- Node.js process → Server and API proxy: runs
- Environment credentials → Server and API proxy: credentials and port
- Server and API proxy → Dashboard page: serves static client
- Dashboard page → App controller: loads
- Dashboard page → Responsive themes: applies
- Dashboard page → Browser libraries: loads from CDN
- App controller → Weather dashboard: updates conditions and forecast
- App controller → User state: restores and persists
- App controller → Server and API proxy: same-origin weather API · Calls weather lookup and coordinate forecast routes.
- Server and API proxy → OpenWeather: proxies weather requests
- App controller → Server and API proxy: gets Windy SDK key · Uses GET /api/config.
- App controller → Interactive map: passes selected coordinates
- Browser libraries → Interactive map: supplies map SDK
- Windy → Interactive map: map service
- Environment credentials → Windy: SDK credential
