# hhari1234/weather-app architecture

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

- Interactive diagram: https://gitdiagram.com/hhari1234/weather-app
- Repository: https://github.com/hhari1234/weather-app

## Overview

This is a single Spring Boot weather dashboard: a browser loads the Thymeleaf page, searches or selects a location, and requests current conditions and forecasts through the JSON API. Services call OpenWeather and map its responses into client-facing DTOs; the browser renders conditions, forecasts and charts. Location autocomplete and browser geolocation provide alternate search paths. The README documents caching, validation and clean API errors. Some service internals and UI template details were not sampled, so those links rely on README statements rather than inspected implementations.

Main entry points: [`src/main/java/com/chimtu/Weather/client/WeatherApiClient.java`](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/client/WeatherApiClient.java) (Weather HTTP client), [`src/main/java/com/chimtu/Weather/controller/WeatherApiController.java`](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/controller/WeatherApiController.java) (Weather REST API), [`src/main/java/com/chimtu/Weather/service/WeatherService.java`](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/service/WeatherService.java) (Weather mapping and forecasts), [`src/main/java/com/chimtu/Weather/service/LocationService.java`](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/service/LocationService.java) (Location search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_dashboard["Dashboard page<br/>[index.html]"]
  node_browser_ui["Dashboard interactions<br/>[weather.js]"]
  node_styles["Responsive themes<br/>[style.css]"]
end

subgraph group_api["Application API"]
  node_page_controller["Page controller"]
  node_weather_api["Weather REST API"]
end

subgraph group_domain["Weather domain"]
  node_weather_service["Weather mapping and forecasts"]
  node_location_service["Location search"]
  node_weather_dtos["Weather API DTOs"]
  node_location_dto["Location result DTO<br/>[LocationDto.java]"]
end

subgraph group_integration["OpenWeather integration"]
  node_weather_client["Weather HTTP client"]
  node_weather_payloads["Upstream payload models"]
end

subgraph group_support["Configuration and errors"]
  node_api_properties["API settings"]
  node_http_config["HTTP client timeouts"]
  node_cache_config[("Caffeine cache")]
  node_error_handler["API error mapping"]
end

node_browser(("Browser user"))
node_openweather["OpenWeather API"]

node_browser -->|"opens"| node_dashboard
node_page_controller -->|"renders"| node_dashboard
node_dashboard -->|"loads scripts"| node_browser_ui
node_dashboard -->|"uses styles"| node_styles
node_browser_ui -->|"requests JSON"| node_weather_api
node_weather_api -->|"dispatches weather"| node_weather_service
node_weather_api -->|"dispatches search"| node_location_service
node_weather_service -->|"maps results"| node_weather_dtos
node_weather_api -->|"returns"| node_weather_dtos
node_location_service -->|"searches locations"| node_weather_client
node_location_service -->|"builds results"| node_location_dto
node_weather_service -->|"fetches weather"| node_weather_client
node_weather_client -->|"calls REST API"| node_openweather
node_weather_client -->|"decodes responses"| node_weather_payloads
node_weather_client -->|"reads settings"| node_api_properties
node_http_config -->|"sets timeouts"| node_api_properties
node_weather_client -.->|"uses configured client"| node_http_config
node_weather_service -->|"caches lookups"| node_cache_config
node_location_service -->|"caches searches"| node_cache_config
node_weather_api -->|"maps API errors"| node_error_handler

click node_dashboard "https://github.com/hhari1234/weather-app/blob/main/src/main/resources/templates/index.html"
click node_browser_ui "https://github.com/hhari1234/weather-app/blob/main/src/main/resources/static/js/weather.js"
click node_styles "https://github.com/hhari1234/weather-app/blob/main/src/main/resources/static/css/style.css"
click node_page_controller "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/controller/WeatherPageController.java"
click node_weather_api "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/controller/WeatherApiController.java"
click node_weather_service "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/service/WeatherService.java"
click node_location_service "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/service/LocationService.java"
click node_weather_dtos "https://github.com/hhari1234/weather-app/tree/main/src/main/java/com/chimtu/Weather/dto"
click node_location_dto "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/dto/LocationDto.java"
click node_weather_client "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/client/WeatherApiClient.java"
click node_weather_payloads "https://github.com/hhari1234/weather-app/tree/main/src/main/java/com/chimtu/Weather/client"
click node_api_properties "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/config/WeatherApiProperties.java"
click node_http_config "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/config/WeatherClientConfig.java"
click node_cache_config "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/config/WeatherCacheConfig.java"
click node_error_handler "https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/exception/GlobalExceptionHandler.java"

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_browser_ui,node_styles,node_browser toneBlue
class node_page_controller,node_weather_api toneAmber
class node_weather_service,node_location_service,node_weather_dtos,node_location_dto,node_openweather toneMint
class node_weather_client,node_weather_payloads toneRose
class node_api_properties,node_http_config,node_cache_config,node_error_handler toneIndigo
```

## Components

### Browser experience

- [Dashboard page](https://github.com/hhari1234/weather-app/blob/main/src/main/resources/templates/index.html): `src/main/resources/templates/index.html`
- [Dashboard interactions](https://github.com/hhari1234/weather-app/blob/main/src/main/resources/static/js/weather.js): `src/main/resources/static/js/weather.js`
- [Responsive themes](https://github.com/hhari1234/weather-app/blob/main/src/main/resources/static/css/style.css): `src/main/resources/static/css/style.css`

### Application API

- [Page controller](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/controller/WeatherPageController.java): `src/main/java/com/chimtu/Weather/controller/WeatherPageController.java`
- [Weather REST API](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/controller/WeatherApiController.java): `src/main/java/com/chimtu/Weather/controller/WeatherApiController.java`

### Weather domain

- [Weather mapping and forecasts](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/service/WeatherService.java): `src/main/java/com/chimtu/Weather/service/WeatherService.java`
- [Location search](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/service/LocationService.java): `src/main/java/com/chimtu/Weather/service/LocationService.java`
- [Weather API DTOs](https://github.com/hhari1234/weather-app/tree/main/src/main/java/com/chimtu/Weather/dto): `src/main/java/com/chimtu/Weather/dto`
- [Location result DTO](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/dto/LocationDto.java): `src/main/java/com/chimtu/Weather/dto/LocationDto.java`

### OpenWeather integration

- [Weather HTTP client](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/client/WeatherApiClient.java): `src/main/java/com/chimtu/Weather/client/WeatherApiClient.java`
- [Upstream payload models](https://github.com/hhari1234/weather-app/tree/main/src/main/java/com/chimtu/Weather/client): `src/main/java/com/chimtu/Weather/client`

### Configuration and errors

- [API settings](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/config/WeatherApiProperties.java): `src/main/java/com/chimtu/Weather/config/WeatherApiProperties.java`
- [HTTP client timeouts](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/config/WeatherClientConfig.java): `src/main/java/com/chimtu/Weather/config/WeatherClientConfig.java`
- [Caffeine cache](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/config/WeatherCacheConfig.java): `src/main/java/com/chimtu/Weather/config/WeatherCacheConfig.java`
- [API error mapping](https://github.com/hhari1234/weather-app/blob/main/src/main/java/com/chimtu/Weather/exception/GlobalExceptionHandler.java): `src/main/java/com/chimtu/Weather/exception/GlobalExceptionHandler.java`

### Other components

- **Browser user**
- **OpenWeather API**

## Connections

- Browser user → Dashboard page: opens (evidence: `README.md`)
- Page controller → Dashboard page: renders (evidence: `src/main/java/com/chimtu/Weather/controller/WeatherPageController.java`)
- Dashboard page → Dashboard interactions: loads scripts (evidence: `README.md`)
- Dashboard page → Responsive themes: uses styles (evidence: `README.md`)
- Dashboard interactions → Weather REST API: requests JSON (evidence: `src/main/resources/static/js/weather.js`)
- Weather REST API → Weather mapping and forecasts: dispatches weather (evidence: `src/main/java/com/chimtu/Weather/controller/WeatherApiController.java`)
- Weather REST API → Location search: dispatches search (evidence: `src/main/java/com/chimtu/Weather/controller/WeatherApiController.java`)
- Weather mapping and forecasts → Weather API DTOs: maps results (evidence: `README.md`)
- Weather REST API → Weather API DTOs: returns (evidence: `src/main/java/com/chimtu/Weather/controller/WeatherApiController.java`)
- Location search → Weather HTTP client: searches locations (evidence: `src/main/java/com/chimtu/Weather/service/LocationService.java`)
- Location search → Location result DTO: builds results (evidence: `src/main/java/com/chimtu/Weather/service/LocationService.java`)
- Weather mapping and forecasts → Weather HTTP client: fetches weather (evidence: `README.md`)
- Weather HTTP client → OpenWeather API: calls REST API (evidence: `README.md`)
- Weather HTTP client → Upstream payload models: decodes responses (evidence: `src/main/java/com/chimtu/Weather/client/WeatherApiClient.java`)
- Weather HTTP client → API settings: reads settings (evidence: `src/main/java/com/chimtu/Weather/client/WeatherApiClient.java`)
- HTTP client timeouts → API settings: sets timeouts (evidence: `src/main/java/com/chimtu/Weather/config/WeatherClientConfig.java`)
- Weather HTTP client → HTTP client timeouts: uses configured client
- Weather mapping and forecasts → Caffeine cache: caches lookups (evidence: `README.md`)
- Location search → Caffeine cache: caches searches (evidence: `README.md`)
- Weather REST API → API error mapping: maps API errors (evidence: `README.md`)
