# badalbharti3/weather_forecast architecture

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

- Interactive diagram: https://gitdiagram.com/badalbharti3/weather_forecast
- Repository: https://github.com/badalbharti3/weather_forecast

## Overview

This is a small Spring Boot weather dashboard. The visitor can allow browser geolocation or search for a city; the browser requests the backend, which obtains weather data from OpenWeatherMap and returns a typed payload for the dashboard and forecast cards. The README also documents responsive presentation and consistent JSON error responses. Backend call relationships are based on the README’s architecture description; frontend request and rendering behavior is visible in the sampled JavaScript. Other source files were not sampled.

Main entry points: [`src/main/resources/static/js/app.js`](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/resources/static/js/app.js) (Dashboard logic), [`src/main/java/com/example/weatherforecast/service/WeatherService.java`](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/service/WeatherService.java) (Weather service), [`src/main/java/com/example/weatherforecast/controller/WeatherController.java`](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/controller/WeatherController.java) (Weather endpoints), [`src/main/java/com/example/weatherforecast/dto`](https://github.com/badalbharti3/weather_forecast/tree/main/src/main/java/com/example/weatherforecast/dto) (Weather DTOs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser dashboard"]
  node_dashboard["Dashboard logic<br/>[app.js]"]
  node_page["Dashboard page<br/>[index.html]"]
  node_styles["Responsive styles<br/>[style.css]"]
end

subgraph group_backend["Weather API"]
  node_controller["Weather endpoints"]
  node_service["Weather service"]
  node_dto["Weather DTOs"]
end

subgraph group_integration["Provider integration"]
  node_clientconfig["REST client config"]
  node_provider["OpenWeatherMap"]
end

subgraph group_errors["Error handling"]
  node_exceptions["API error handling"]
end

node_visitor(("Visitor"))
node_browser["Browser location"]

node_visitor -->|"uses"| node_dashboard
node_browser -->|"provides coordinates"| node_dashboard
node_dashboard -->|"requests weather"| node_controller
node_controller -->|"delegates to"| node_service
node_service -->|"fetches weather"| node_provider
node_service -->|"maps responses"| node_dto
node_dashboard -->|"renders forecast"| node_dashboard

click node_dashboard "https://github.com/badalbharti3/weather_forecast/blob/main/src/main/resources/static/js/app.js"
click node_page "https://github.com/badalbharti3/weather_forecast/blob/main/src/main/resources/static/index.html"
click node_styles "https://github.com/badalbharti3/weather_forecast/blob/main/src/main/resources/static/css/style.css"
click node_controller "https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/controller/WeatherController.java"
click node_service "https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/service/WeatherService.java"
click node_dto "https://github.com/badalbharti3/weather_forecast/tree/main/src/main/java/com/example/weatherforecast/dto"
click node_clientconfig "https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/config/RestClientConfig.java"
click node_exceptions "https://github.com/badalbharti3/weather_forecast/tree/main/src/main/java/com/example/weatherforecast/exception"

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_dashboard,node_page,node_styles,node_browser toneBlue
class node_controller,node_service,node_dto toneAmber
class node_clientconfig,node_provider toneMint
class node_exceptions toneRose
class node_visitor toneIndigo
```

## Components

### Browser dashboard

- [Dashboard logic](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/resources/static/js/app.js): `src/main/resources/static/js/app.js`
- [Dashboard page](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/resources/static/index.html): `src/main/resources/static/index.html`
- [Responsive styles](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/resources/static/css/style.css): `src/main/resources/static/css/style.css`

### Weather API

- [Weather endpoints](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/controller/WeatherController.java): `src/main/java/com/example/weatherforecast/controller/WeatherController.java`
- [Weather service](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/service/WeatherService.java): `src/main/java/com/example/weatherforecast/service/WeatherService.java`
- [Weather DTOs](https://github.com/badalbharti3/weather_forecast/tree/main/src/main/java/com/example/weatherforecast/dto): `src/main/java/com/example/weatherforecast/dto`

### Provider integration

- [REST client config](https://github.com/badalbharti3/weather_forecast/blob/main/src/main/java/com/example/weatherforecast/config/RestClientConfig.java): `src/main/java/com/example/weatherforecast/config/RestClientConfig.java`
- **OpenWeatherMap**

### Error handling

- [API error handling](https://github.com/badalbharti3/weather_forecast/tree/main/src/main/java/com/example/weatherforecast/exception): `src/main/java/com/example/weatherforecast/exception`

### Other components

- **Visitor**
- **Browser location**

## Connections

- Visitor → Dashboard logic: uses (evidence: `README.md`)
- Browser location → Dashboard logic: provides coordinates (evidence: `src/main/resources/static/js/app.js`)
- Dashboard logic → Weather endpoints: requests weather (evidence: `src/main/resources/static/js/app.js`)
- Weather endpoints → Weather service: delegates to (evidence: `README.md`)
- Weather service → OpenWeatherMap: fetches weather (evidence: `README.md`)
- Weather service → Weather DTOs: maps responses (evidence: `README.md`)
- Dashboard logic → Dashboard logic: renders forecast (evidence: `src/main/resources/static/js/app.js`)
