# dawid2504/wetter-projekt architecture

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

- Interactive diagram: https://gitdiagram.com/dawid2504/wetter-projekt
- Repository: https://github.com/dawid2504/wetter-projekt

## Overview

Wetter weltweit is a vanilla-JavaScript weather PWA. Users choose or search for a city (or use their location), then view current conditions, local time, forecasts, charts and related environmental details; a live map and saved favorites extend that flow. The README documents Open-Meteo weather data and RainViewer/Leaflet mapping, while sampled source confirms the main controller and its internal module dependencies. The main file excerpt is partial, so several feature-to-service links are based on README documentation rather than inspected call sites.

Main entry points: [`js/main.js`](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js) (App controller), [`js/state.js`](https://github.com/dawid2504/wetter-projekt/blob/main/js/state.js) (Shared state), [`js/time.js`](https://github.com/dawid2504/wetter-projekt/blob/main/js/time.js) (Time sync), [`index.html`](https://github.com/dawid2504/wetter-projekt/blob/main/index.html) (Web app shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["Web app shell<br/>[index.html]"]
  node_controller["App controller<br/>[main.js]"]
  node_city_search["City search<br/>[main.js]"]
  node_favorites["Favorites and clocks<br/>[main.js]"]
end

subgraph group_weather["Weather features"]
  node_weather_detail["Weather details<br/>[main.js]"]
  node_forecast_chart["Forecast and charts<br/>[main.js]"]
  node_air_moon["Air, pollen, moon<br/>[main.js]"]
  node_weather_map["Weather map<br/>[main.js]"]
end

subgraph group_shared["Shared modules"]
  node_city_data[("City catalog<br/>[cities.js]")]
  node_shared_state["Shared state<br/>[state.js]"]
  node_preferences["Preference keys<br/>[config.js]"]
  node_translations["Translations<br/>[i18n.js]"]
  node_weather_codes["Weather codes<br/>[weather-codes.js]"]
  node_helpers["Weather helpers<br/>[helpers.js]"]
  node_units["Temperature units<br/>[units.js]"]
  node_time_sync["Time sync<br/>[time.js]"]
  node_icons["Weather icons<br/>[weather-icons.js]"]
end

subgraph group_platform["Platform and integrations"]
  node_open_meteo["Open-Meteo"]
  node_geocoding["Geocoding service"]
  node_rainviewer["RainViewer"]
  node_map_tiles["Map tiles and Leaflet"]
  node_browser["Browser APIs"]
  node_time_api["UTC time API"]
  node_service_worker["Offline service worker<br/>[sw.js]"]
end

node_user(("User"))

node_user -->|"opens"| node_app
node_app -->|"loads"| node_controller
node_controller -->|"handles search"| node_city_search
node_city_search -->|"extends catalog"| node_city_data
node_city_search -->|"geocodes cities"| node_geocoding
node_controller -->|"renders details"| node_weather_detail
node_controller -->|"renders forecasts"| node_forecast_chart
node_controller -->|"renders indicators"| node_air_moon
node_controller -->|"shows map"| node_weather_map
node_controller -->|"manages favorites"| node_favorites
node_favorites -->|"stores locally"| node_browser
node_controller -->|"fetches weather"| node_open_meteo
node_weather_map -->|"loads radar"| node_rainviewer
node_weather_map -->|"renders map"| node_map_tiles
node_controller -->|"uses geolocation"| node_browser
node_controller -->|"reads and updates"| node_shared_state
node_shared_state -->|"reads keys"| node_preferences
node_controller -->|"imports translations"| node_translations
node_translations -->|"reads language"| node_shared_state
node_controller -->|"imports codes"| node_weather_codes
node_controller -->|"imports helpers"| node_helpers
node_controller -->|"imports formatting"| node_units
node_units -->|"reads unit"| node_shared_state
node_controller -->|"syncs clocks"| node_time_sync
node_time_sync -->|"updates offset"| node_shared_state
node_time_sync -->|"requests UTC time"| node_time_api
node_controller -->|"renders icons"| node_icons
node_browser -->|"runs offline support"| node_service_worker

click node_app "https://github.com/dawid2504/wetter-projekt/blob/main/index.html"
click node_controller "https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js"
click node_city_search "https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js"
click node_city_data "https://github.com/dawid2504/wetter-projekt/blob/main/js/data/cities.js"
click node_weather_detail "https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js"
click node_forecast_chart "https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js"
click node_air_moon "https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js"
click node_weather_map "https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js"
click node_favorites "https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js"
click node_shared_state "https://github.com/dawid2504/wetter-projekt/blob/main/js/state.js"
click node_preferences "https://github.com/dawid2504/wetter-projekt/blob/main/js/config.js"
click node_translations "https://github.com/dawid2504/wetter-projekt/blob/main/js/data/i18n.js"
click node_weather_codes "https://github.com/dawid2504/wetter-projekt/blob/main/js/data/weather-codes.js"
click node_helpers "https://github.com/dawid2504/wetter-projekt/blob/main/js/helpers.js"
click node_units "https://github.com/dawid2504/wetter-projekt/blob/main/js/units.js"
click node_time_sync "https://github.com/dawid2504/wetter-projekt/blob/main/js/time.js"
click node_icons "https://github.com/dawid2504/wetter-projekt/blob/main/js/weather-icons.js"
click node_service_worker "https://github.com/dawid2504/wetter-projekt/blob/main/sw.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_app,node_controller,node_city_search,node_favorites,node_user toneBlue
class node_weather_detail,node_forecast_chart,node_air_moon,node_weather_map toneAmber
class node_city_data,node_shared_state,node_preferences,node_translations,node_weather_codes,node_helpers,node_units,node_time_sync,node_icons toneMint
class node_open_meteo,node_geocoding,node_rainviewer,node_map_tiles,node_browser,node_time_api,node_service_worker toneRose
```

## Components

### User experience

- [Web app shell](https://github.com/dawid2504/wetter-projekt/blob/main/index.html): `index.html`
- [App controller](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js): `js/main.js`
- [City search](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js): `js/main.js`
- [Favorites and clocks](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js): `js/main.js`

### Weather features

- [Weather details](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js): `js/main.js`
- [Forecast and charts](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js): `js/main.js`
- [Air, pollen, moon](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js): `js/main.js`
- [Weather map](https://github.com/dawid2504/wetter-projekt/blob/main/js/main.js): `js/main.js`

### Shared modules

- [City catalog](https://github.com/dawid2504/wetter-projekt/blob/main/js/data/cities.js): `js/data/cities.js`
- [Shared state](https://github.com/dawid2504/wetter-projekt/blob/main/js/state.js): `js/state.js`
- [Preference keys](https://github.com/dawid2504/wetter-projekt/blob/main/js/config.js): `js/config.js`
- [Translations](https://github.com/dawid2504/wetter-projekt/blob/main/js/data/i18n.js): `js/data/i18n.js`
- [Weather codes](https://github.com/dawid2504/wetter-projekt/blob/main/js/data/weather-codes.js): `js/data/weather-codes.js`
- [Weather helpers](https://github.com/dawid2504/wetter-projekt/blob/main/js/helpers.js): `js/helpers.js`
- [Temperature units](https://github.com/dawid2504/wetter-projekt/blob/main/js/units.js): `js/units.js`
- [Time sync](https://github.com/dawid2504/wetter-projekt/blob/main/js/time.js): `js/time.js`
- [Weather icons](https://github.com/dawid2504/wetter-projekt/blob/main/js/weather-icons.js): `js/weather-icons.js`

### Platform and integrations

- **Open-Meteo**
- **Geocoding service**
- **RainViewer**
- **Map tiles and Leaflet**
- **Browser APIs**
- **UTC time API**
- [Offline service worker](https://github.com/dawid2504/wetter-projekt/blob/main/sw.js): `sw.js`

### Other components

- **User**

## Connections

- User → Web app shell: opens (evidence: `README.md`)
- Web app shell → App controller: loads (evidence: `README.md`)
- App controller → City search: handles search (evidence: `README.md`)
- City search → City catalog: extends catalog (evidence: `js/data/cities.js`)
- City search → Geocoding service: geocodes cities (evidence: `README.md`)
- App controller → Weather details: renders details (evidence: `README.md`)
- App controller → Forecast and charts: renders forecasts (evidence: `README.md`)
- App controller → Air, pollen, moon: renders indicators (evidence: `README.md`)
- App controller → Weather map: shows map (evidence: `README.md`)
- App controller → Favorites and clocks: manages favorites (evidence: `js/main.js`)
- Favorites and clocks → Browser APIs: stores locally (evidence: `js/main.js`)
- App controller → Open-Meteo: fetches weather (evidence: `README.md`)
- Weather map → RainViewer: loads radar (evidence: `README.md`)
- Weather map → Map tiles and Leaflet: renders map (evidence: `README.md`)
- App controller → Browser APIs: uses geolocation (evidence: `README.md`)
- App controller → Shared state: reads and updates (evidence: `js/main.js`)
- Shared state → Preference keys: reads keys (evidence: `js/state.js`)
- App controller → Translations: imports translations (evidence: `js/main.js`)
- Translations → Shared state: reads language (evidence: `js/data/i18n.js`)
- App controller → Weather codes: imports codes (evidence: `js/main.js`)
- App controller → Weather helpers: imports helpers (evidence: `js/main.js`)
- App controller → Temperature units: imports formatting (evidence: `js/main.js`)
- Temperature units → Shared state: reads unit (evidence: `js/units.js`)
- App controller → Time sync: syncs clocks (evidence: `js/main.js`)
- Time sync → Shared state: updates offset (evidence: `js/time.js`)
- Time sync → UTC time API: requests UTC time (evidence: `js/time.js`)
- App controller → Weather icons: renders icons (evidence: `js/main.js`)
- Browser APIs → Offline service worker: runs offline support (evidence: `sw.js`)
