# ramanjeet-code/weather_app architecture

> Architecture diagram of the GitHub repository ramanjeet-code/weather_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ramanjeet-code/weather_app
- Repository: https://github.com/ramanjeet-code/weather_app

## Overview

##### Main Components

a) Client Layer:
- HTML/CSS/JavaScript frontend
- Bootstrap for styling
- Login interface
- Weather forecast interface (Summary and Hourly views)

b) Security Layer:
- JWT Authentication system
- Spring Security components

c) Backend Layer:
- Spring Boot application
- REST Controllers
- Service Layer
- Exception Handling

d) External Services:
- OpenWeatherMap API
- RapidAPI integration

**Web Browser → JWT Auth Filter → Controllers → Services → External APIs**

##### Authentication flow
- Login request → JWT Filter → Auth Controller → JWT Helper
- JWT token generation and validation path

##### Weather data flow
- Frontend request → Weather Controller → Weather Service → External Weather APIs
- Error handling path through Global Exception Handler

##### Specific Components to Detail

Frontend Layer:
- index.html (Weather Dashboard)
- login.html (Authentication Page)
- JavaScript modules (home.js, login.js)

Security Layer:
- JwtAuthenticationFilter
- JwtAuthenticationEntryPoint
- JwtHelper
- Security Config

Backend Layer:
- Controllers (AuthController, WeatherController)
- Services (WeatherService, WeatherServiceImpl)
- Exception Handling (GlobalExceptionHandler)

##### Technical Details

Annotations for:
- Port numbers
- API endpoints (/getForecast-Summary, /getForecast-Hourly, /login)
- Authentication flow (JWT token mechanism)
- Response formats (JSON)

##### Additional Elements

- Authentication flow
- Error handling paths

- API specifications
- Authentication requirements
- Error handling strategies
- External API integration details

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#d4e6ff,stroke:#333
    classDef security fill:#d4ffd4,stroke:#333
    classDef backend fill:#ffe6cc,stroke:#333
    classDef external fill:#e6e6e6,stroke:#333
    classDef database fill:#f9f,stroke:#333

    %% Frontend Layer
    subgraph Frontend
        WD["Weather Dashboard"]
        LI["Login Interface"]
        HS["Home Script"]
        LS["Login Script"]
    end

    %% Security Layer
    subgraph Security
        JF["JWT Filter"]
        JEP["JWT Entry Point"]
        JH["JWT Helper"]
        JRQ["JWT Request"]
        JRS["JWT Response"]
        SC["Security Config"]
    end

    %% Backend Layer
    subgraph Backend
        AC["Auth Controller"]
        WC["Weather Controller"]
        WS["Weather Service Interface"]
        WSI["Weather Service Implementation"]
        GEH["Global Exception Handler"]
        WSE["Weather Service Exception"]
        EF["Error Format"]
        MC["Main Config"]
        AP["Application Properties"]
        MA["Main Application"]
    end

    %% External Services
    subgraph External
        OWM["OpenWeatherMap API"]
        RA["RapidAPI"]
    end

    %% Relationships
    WD --> JF
    LI --> JF
    JF --> AC
    JF --> WC
    JEP --> JF
    JH --> AC
    AC --> JH
    WC --> WS
    WS --> WSI
    WSI --> OWM
    WSI --> RA
    WSE --> GEH
    WC --> GEH

    %% Click Events
    click WD "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App(FrontEnd)/index.html"
    click LI "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App(FrontEnd)/login.html"
    click HS "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App(FrontEnd)/scripts/home.js"
    click LS "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App(FrontEnd)/scripts/login.js"
    click JF "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/config/JwtAuthenticationFilter.java"
    click JEP "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/config/JwtAuthenticationEntryPoint.java"
    click JH "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/config/JwtHelper.java"
    click JRQ "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/config/JwtRequest.java"
    click JRS "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/config/JwtResponse.java"
    click AC "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/controller/AuthController.java"
    click WC "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/controller/WeatherController.java"
    click WS "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/service/WeatherService.java"
    click WSI "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/service/WeatherServiceImpl.java"
    click GEH "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/exception/GlobalExceptionHandler.java"
    click WSE "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/exception/WeatherServiceException.java"
    click EF "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/exception/ErrorFormat.java"
    click AP "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/resources/application.properties"
    click MC "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/config/MyConfig.java"
    click MA "https://github.com/ramanjeet-code/Weather_App/blob/main/Weather_App/src/main/java/com/Weather_App/WeatherApplication.java"

    %% Style Applications
    WD:::frontend
    LI:::frontend
    HS:::frontend
    LS:::frontend
    JF:::security
    JEP:::security
    JH:::security
    JRQ:::security
    JRS:::security
    SC:::security
    AC:::backend
    WC:::backend
    WS:::backend
    WSI:::backend
    GEH:::backend
    WSE:::backend
    EF:::backend
    MC:::backend
    AP:::backend
    MA:::backend
    OWM:::external
    RA:::external
```
