# kehyde/weather-app architecture

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

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

## Overview

##### Project type and purpose
- NimbusWeathR is a purely client-side, single-page/web-page weather application.
- Purpose: let users search for a city’s current weather, persist recent searches in browser storage, and display details including map location.

##### File structure
- Top-level HTML entry points:
- index.html + indexpage.js – main search UI
- previousCity.html + previousCity.js – list of prior searches
- weatherdisplay.html + weatherDisplay.js – detailed weather view
- assets: style.css, images/
- No backend directory or server code → entirely static hostable site.
- Uses sessionStorage/localStorage, external APIs (WeatherAPI, Leaflet).

##### README for additional insights
- Confirms API integration for real-time data, UI flow between pages, storage strategy, error resolutions.
- Technologies: vanilla JavaScript, REST calls, responsive design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Client Boundary
    subgraph "Browser Client"
        direction TB
        %% Search Page Components
        subgraph "Search Page"
            direction TB
            SearchPageUI["Search Page"]:::ui
            SearchLogic["Search Logic Module"]:::logic
        end

        %% History Page Components
        subgraph "History Page"
            direction TB
            HistoryPageUI["History Page"]:::ui
            HistoryLogic["History Logic Module"]:::logic
        end

        %% Details Page Components
        subgraph "Details Page"
            direction TB
            DetailsPageUI["Details Page"]:::ui
            DetailsLogic["Display Logic Module"]:::logic
        end

        %% Shared Storage
        BrowserStorage["Browser Storage\n(sessionStorage/localStorage)"]:::storage

        %% Assets and Docs
        Stylesheet["Global Stylesheet"]:::assets
        Images["Static Assets"]:::assets
        README["README.md"]:::docs
        TextFile["Text.txt"]:::docs
    end

    %% External Services
    subgraph "External Services"
        direction TB
        WeatherAPI["WeatherAPI REST Service"]:::external
        LeafletService["Leaflet Map Tile Service"]:::external
    end

    %% User Interaction
    User["User"]:::user

    %% Connections: User to Search
    User -->|"opens"| SearchPageUI
    SearchPageUI -->|"invokes"| SearchLogic
    SearchLogic -->|"GET /current?city=..."| WeatherAPI
    WeatherAPI -->|"JSON response"| SearchLogic
    SearchLogic -->|"save city data"| BrowserStorage

    %% History Flow
    User -->|"opens"| HistoryPageUI
    HistoryPageUI -->|"invokes"| HistoryLogic
    HistoryLogic -->|"reads recent searches"| BrowserStorage
    HistoryLogic -->|"renders city cards"| HistoryPageUI
    HistoryPageUI -->|"selects city"| DetailsPageUI

    %% Details Flow
    User -->|"opens"| DetailsPageUI
    DetailsPageUI -->|"invokes"| DetailsLogic
    DetailsLogic -->|"reads selectedCity"| BrowserStorage
    DetailsLogic -->|"init map with coords"| LeafletService

    %% Asset and Docs usage
    SearchPageUI --> Stylesheet
    HistoryPageUI --> Stylesheet
    DetailsPageUI --> Stylesheet
    SearchPageUI --> Images
    HistoryPageUI --> Images
    DetailsPageUI --> Images

    %% Click events
    click SearchPageUI "https://github.com/kehyde/weather-app/blob/main/index.html"
    click SearchLogic "https://github.com/kehyde/weather-app/blob/main/indexpage.js"
    click HistoryPageUI "https://github.com/kehyde/weather-app/blob/main/previousCity.html"
    click HistoryLogic "https://github.com/kehyde/weather-app/blob/main/previousCity.js"
    click DetailsPageUI "https://github.com/kehyde/weather-app/blob/main/weatherdisplay.html"
    click DetailsLogic "https://github.com/kehyde/weather-app/blob/main/weatherDisplay.js"
    click Stylesheet "https://github.com/kehyde/weather-app/blob/main/style.css"
    click Images "https://github.com/kehyde/weather-app/tree/main/images/"
    click README "https://github.com/kehyde/weather-app/blob/main/README.md"
    click TextFile "https://github.com/kehyde/weather-app/blob/main/Text.txt"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,color:#000
    classDef logic fill:#90EE90,stroke:#000,color:#000
    classDef storage fill:#FFFF99,stroke:#000,color:#000
    classDef external fill:#D3D3D3,stroke:#000,color:#000
    classDef assets fill:#FFE4E1,stroke:#000,color:#000
    classDef docs fill:#E6E6FA,stroke:#000,color:#000
    classDef user fill:#FFFACD,stroke:#000,color:#000
```
