How jorguzman100/weather-dashboard works
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: app.js App controller · server.js Server and API proxy · index.html Dashboard page · .env_example Environment credentials
Components 12
Node Runtime
- Node.js process · Single deployment unit serving the dashboard and API proxy.
- Server and API proxy · Hosts static files and protects provider credentials.
server.js - Environment credentials · Defines OpenWeather, Windy, and port settings.
.env_example
Browser App
- Dashboard page · Static dashboard entry surface.
client/index.html - App controller · Coordinates search, forecast, persistence, UI, and map updates.
client/app.js - Responsive themes
client/style.css - Weather dashboard · Search, conditions, forecast, history, theme, and map surface.
client/index.html - User state · Stores recent searches and theme preference.
- Browser libraries · jQuery, Moment.js, Leaflet, and the Windy SDK.
client/index.html - Interactive map · Renders the selected city's coordinates.
client/app.js
External Services
- OpenWeather · Provides city lookup, current conditions, and forecasts.
- Windy · Provides the interactive weather map SDK.
Connections 15
- 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