# lylio/whether-the-weather architecture

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

- Interactive diagram: https://gitdiagram.com/lylio/whether-the-weather
- Repository: https://github.com/lylio/whether-the-weather

## Overview

This repository contains two weather-app entry points: a Spring web application and a Swing desktop application. The web workflow accepts a city request, resolves its location, fetches current conditions, and renders a result or error. The desktop workflow launches a search GUI, fetches weather for the entered location, and updates its display. The sampled web service uses Open-Meteo geocoding and forecast endpoints; the legacy desktop client does too. The README’s API description differs from the sampled implementation. Unsampled template and styling behavior is not inferred beyond the controller’s view name.

Main entry points: [`src/main/java/com/lylio/weather/WeatherService.java`](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherService.java) (Weather lookup), [`src/main/java/com/lylio/weather/WeatherController.java`](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherController.java) (Weather routes), [`src/main/java/WeatherApp.java`](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/WeatherApp.java) (Desktop weather client), [`src/main/java/AppLauncher.java`](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/AppLauncher.java) (Desktop launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web startup"]
  node_routes["Weather routes"]
  node_webview["Weather page<br/>[index.html]"]
end

subgraph group_desktop["Desktop application"]
  node_launcher["Desktop launcher<br/>[AppLauncher.java]"]
  node_gui["Weather GUI<br/>[WeatherAppGui.java]"]
  node_legacy["Desktop weather client<br/>[WeatherApp.java]"]
end

subgraph group_weather["Weather data"]
  node_exception["API errors"]
  node_service["Weather lookup"]
  node_response["Weather result"]
end

subgraph group_integrations["External APIs"]
  node_geocode["Geocoding API"]
  node_forecast["Forecast API"]
end

node_browser(("Web visitor"))
node_desktopuser(("Desktop user"))

node_browser -->|"requests weather"| node_routes
node_webapp -->|"serves routes"| node_routes
node_routes -->|"looks up city"| node_service
node_service -->|"resolves location"| node_geocode
node_service -->|"fetches conditions"| node_forecast
node_service -->|"builds result"| node_response
node_routes -->|"renders index"| node_webview
node_service -->|"throws errors"| node_exception
node_routes -->|"handles errors"| node_exception
node_desktopuser -->|"starts app"| node_launcher
node_launcher -->|"opens window"| node_gui
node_gui -->|"requests weather"| node_legacy
node_legacy -->|"resolves location"| node_geocode
node_legacy -->|"fetches conditions"| node_forecast

click node_webapp "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherApplication.java"
click node_routes "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherController.java"
click node_webview "https://github.com/lylio/whether-the-weather/blob/main/src/main/resources/templates/index.html"
click node_exception "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherApiException.java"
click node_service "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherService.java"
click node_response "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherResponse.java"
click node_launcher "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/AppLauncher.java"
click node_gui "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/WeatherAppGui.java"
click node_legacy "https://github.com/lylio/whether-the-weather/blob/main/src/main/java/WeatherApp.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_webapp,node_routes,node_webview,node_desktopuser toneBlue
class node_launcher,node_gui,node_legacy toneAmber
class node_exception,node_service,node_response toneMint
class node_geocode,node_forecast toneRose
class node_browser toneIndigo
```

## Components

### Web application

- [Web startup](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherApplication.java): `src/main/java/com/lylio/weather/WeatherApplication.java`
- [Weather routes](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherController.java): `src/main/java/com/lylio/weather/WeatherController.java`
- [Weather page](https://github.com/lylio/whether-the-weather/blob/main/src/main/resources/templates/index.html): `src/main/resources/templates/index.html`

### Desktop application

- [Desktop launcher](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/AppLauncher.java): `src/main/java/AppLauncher.java`
- [Weather GUI](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/WeatherAppGui.java): `src/main/java/WeatherAppGui.java`
- [Desktop weather client](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/WeatherApp.java): `src/main/java/WeatherApp.java`

### Weather data

- [API errors](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherApiException.java): `src/main/java/com/lylio/weather/WeatherApiException.java`
- [Weather lookup](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherService.java): `src/main/java/com/lylio/weather/WeatherService.java`
- [Weather result](https://github.com/lylio/whether-the-weather/blob/main/src/main/java/com/lylio/weather/WeatherResponse.java): `src/main/java/com/lylio/weather/WeatherResponse.java`

### External APIs

- **Geocoding API**
- **Forecast API**

### Other components

- **Web visitor**
- **Desktop user**

## Connections

- Web visitor → Weather routes: requests weather (evidence: `src/main/java/com/lylio/weather/WeatherController.java`)
- Web startup → Weather routes: serves routes (evidence: `src/main/java/com/lylio/weather/WeatherApplication.java`)
- Weather routes → Weather lookup: looks up city (evidence: `src/main/java/com/lylio/weather/WeatherController.java`)
- Weather lookup → Geocoding API: resolves location (evidence: `src/main/java/com/lylio/weather/WeatherService.java`)
- Weather lookup → Forecast API: fetches conditions (evidence: `src/main/java/com/lylio/weather/WeatherService.java`)
- Weather lookup → Weather result: builds result (evidence: `src/main/java/com/lylio/weather/WeatherService.java`)
- Weather routes → Weather page: renders index (evidence: `src/main/java/com/lylio/weather/WeatherController.java`)
- Weather lookup → API errors: throws errors (evidence: `src/main/java/com/lylio/weather/WeatherService.java`)
- Weather routes → API errors: handles errors (evidence: `src/main/java/com/lylio/weather/WeatherController.java`)
- Desktop user → Desktop launcher: starts app (evidence: `src/main/java/AppLauncher.java`)
- Desktop launcher → Weather GUI: opens window (evidence: `src/main/java/AppLauncher.java`)
- Weather GUI → Desktop weather client: requests weather (evidence: `src/main/java/WeatherAppGui.java`)
- Desktop weather client → Geocoding API: resolves location (evidence: `src/main/java/WeatherApp.java`)
- Desktop weather client → Forecast API: fetches conditions (evidence: `src/main/java/WeatherApp.java`)
