# testingforforrwhat/travelplanner architecture

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

- Interactive diagram: https://gitdiagram.com/testingforforrwhat/travelplanner
- Repository: https://github.com/testingforforrwhat/travelplanner

## Overview

##### Main Components

a) API Layer
- Authentication Controller
- Error Handling (Global Exception Handler)

b) Service Layer
- Authentication Service
- Image Storage Service
- User Details Service

c) Security Layer
- JWT Authentication Filter
- JWT Handler
- CORS Filter

d) Data Layer
- User Repository
- Database (PostgreSQL with PostGIS extension, evident from SQL files)

e) Storage Component
- Image Storage System

##### Specific Implementation Details

- Blue rectangles: Controllers (REST endpoints)
- Green rectangles: Services (business logic)
- Yellow rectangles: Security components
- Purple rectangles: Data storage (Repository & Database)
- Orange rectangles: External storage systems

##### Key Architectural Elements

**[Client Requests]**
- ↓
**[Security Layer (CORS, JWT)]**
- ↓
**[API Layer (Controllers)]**
- ↓
**[Service Layer]**
- ↙     ↘
**[Repository]  [Storage]**
- ↓           ↓
**[Database]   [File System]**

##### Important Connections to Highlight

- Authentication flow:
- Client → AuthenticationController → AuthenticationService → UserRepository
- ↘ JwtHandler (token generation)
- User management flow:
- Client → UserDetailsService → UserRepository → Database
- Image handling flow:
- Client → ImageStorageService → Storage System

##### Additional Elements

- Configuration (AppConfig)
- Error handling flow
- Database with PostGIS extension notation
- Clear distinction between authentication and resource access paths

##### Technical Stack Indicators

Annotations showing:
- Spring Boot framework
- JWT for authentication
- PostgreSQL with PostGIS
- Gradle build system

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        CL[Client Requests]
    end

    subgraph Security
        CORS[CORS Filter]:::security
        JWT_FILTER[JWT Authentication Filter]:::security
        JWT_HANDLER[JWT Handler]:::security
    end

    subgraph API
        AUTH_CTRL[Authentication Controller]:::api
        ERR_HANDLE[Error Handler]:::api
    end

    subgraph Services
        AUTH_SVC[Authentication Service]:::service
        IMG_SVC[Image Storage Service]:::service
        USER_SVC[User Details Service]:::service
    end

    subgraph Data
        USER_REPO[User Repository]:::data
        DB[(PostgreSQL + PostGIS)]:::database
    end

    subgraph Storage
        IMG_STORE[File System Storage]:::storage
    end

    subgraph Config
        APP_CONFIG[Application Config]:::config
        DB_CONFIG[Database Config]:::config
    end

    %% Connections
    CL --> CORS
    CORS --> JWT_FILTER
    JWT_FILTER --> AUTH_CTRL
    JWT_FILTER --> ERR_HANDLE
    
    AUTH_CTRL --> AUTH_SVC
    AUTH_CTRL --> JWT_HANDLER
    AUTH_SVC --> USER_REPO
    USER_SVC --> USER_REPO
    
    USER_REPO --> DB
    IMG_SVC --> IMG_STORE

    APP_CONFIG -.-> AUTH_SVC
    DB_CONFIG -.-> DB

    %% Click Events
    click AUTH_CTRL "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/authentication/AuthenticationController.java"
    click ERR_HANDLE "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/GlobalControllerExceptionHandler.java"
    click AUTH_SVC "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/authentication/AuthenticationService.java"
    click IMG_SVC "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/storage/ImageStorageService.java"
    click USER_SVC "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/security/UserDetailsServiceImpl.java"
    click JWT_FILTER "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/security/JwtAuthenticationFilter.java"
    click JWT_HANDLER "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/security/JwtHandler.java"
    click CORS "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/security/TravelplannerCorsFilter.java"
    click USER_REPO "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/repository/UserRepository.java"
    click DB_CONFIG "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/resources/database-init.sql"
    click APP_CONFIG "https://github.com/testingforforrwhat/travelplanner/blob/master/src/main/java/com/test/travelplanner/AppConfig.java"

    %% Styling
    classDef security fill:#FFE873,stroke:#333,stroke-width:2px
    classDef api fill:#85C1E9,stroke:#333,stroke-width:2px
    classDef service fill:#82E0AA,stroke:#333,stroke-width:2px
    classDef data fill:#BB8FCE,stroke:#333,stroke-width:2px
    classDef database fill:#BB8FCE,stroke:#333,stroke-width:2px
    classDef storage fill:#F5B041,stroke:#333,stroke-width:2px
    classDef config fill:#E6B0AA,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[API Layer]:::api
        L2[Service Layer]:::service
        L3[Security Layer]:::security
        L4[Data Layer]:::data
        L5[Storage Layer]:::storage
        L6[Config Layer]:::config
    end
```
