# markopekasfer/apostoli architecture

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

- Interactive diagram: https://gitdiagram.com/markopekasfer/apostoli
- Repository: https://github.com/markopekasfer/apostoli

## Overview

##### High-Level Architecture Overview

a. Client Layer:
- Next.js Frontend Application
- Frontend components:
- User Interface (pages)
- Components (especially maps and user interactions)
- API Integration Layer

b. Backend Layer:
- Spring Boot Application
- Security Layer
- Service Layer
- Repository Layer
- Database (PostgreSQL)

##### Component Breakdown

- Pages Module (login, register, report, settings)
- UI Components Module
- Maps Integration Module
- Theme/Styling System
- API Client Services

- Controllers Layer
- AppUserController
- ReportController
- Security Layer
- JWT Authentication
- OAuth2 Integration
- CORS Configuration
- Service Layer
- User Management
- Report Management
- Location Services
- Photo Services
- Repository Layer
- Database Entities

##### Data Flow Representation

- User authentication flow
- Report submission flow
- Data retrieval flow
- API communication between frontend and backend

##### Specific Elements

- Disaster Reporting System
- User Management System
- Location Management
- Photo Management
- Notification System
- Security Infrastructure

##### Integration Points

External integrations:
- Google Maps API
- OAuth2 Providers
- PostgreSQL Database
- File Storage System

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black

    %% Frontend Layer
    subgraph Frontend
        Pages["Pages Module"]
        UI["UI Components"]
        Maps["Maps Integration"]
        Theme["Theme System"]
        APIClient["API Integration"]
    end

    %% Backend Layer
    subgraph Backend
        Controllers["Controllers Layer"]
        Security["Security Layer"]
        Services["Service Layer"]
        Repos["Repository Layer"]
        Entities["Database Entities"]
    end

    %% External Services
    GoogleMaps["Google Maps API"]:::external
    OAuth["OAuth2 Providers"]:::external
    DB[(PostgreSQL)]:::database
    Storage["File Storage"]:::external

    %% Security Components
    subgraph SecurityComponents
        JWT["JWT Auth"]
        OAuth2["OAuth2 Integration"]
        CORS["CORS Config"]
    end

    %% Service Components
    subgraph ServiceComponents
        UserService["User Management"]
        ReportService["Report Management"]
        LocationService["Location Services"]
        PhotoService["Photo Services"]
    end

    %% Relationships
    Pages --> UI
    Pages --> Maps
    Pages --> APIClient
    UI --> Theme
    Maps --> GoogleMaps
    APIClient --> Controllers
    
    Controllers --> Security
    Security --> SecurityComponents
    SecurityComponents --> Services
    
    Services --> ServiceComponents
    ServiceComponents --> Repos
    Repos --> Entities
    Entities --> DB
    
    Security --> OAuth
    PhotoService --> Storage

    %% Click Events
    click Pages "https://github.com/MarkoPekasFER/apostoli/tree/main//frontend/pages"
    click Maps "https://github.com/MarkoPekasFER/apostoli/blob/main//frontend/components/maps/GoogleMap.tsx"
    click Theme "https://github.com/MarkoPekasFER/apostoli/blob/main//frontend/components/ThemeProvider.tsx"
    click UI "https://github.com/MarkoPekasFER/apostoli/tree/main//frontend/components/ui"
    click JWT "https://github.com/MarkoPekasFER/apostoli/blob/main//backend/src/main/java/com/apostoli/UnluckyApp/security/JwtAuthFilter.java"
    click OAuth2 "https://github.com/MarkoPekasFER/apostoli/blob/main//backend/src/main/java/com/apostoli/UnluckyApp/security/CustomOAuth2UserService.java"
    click CORS "https://github.com/MarkoPekasFER/apostoli/blob/main//backend/src/main/java/com/apostoli/UnluckyApp/security/CorsConfig.java"
    click UserService "https://github.com/MarkoPekasFER/apostoli/blob/main//backend/src/main/java/com/apostoli/UnluckyApp/service/AppUserService.java"
    click ReportService "https://github.com/MarkoPekasFER/apostoli/blob/main//backend/src/main/java/com/apostoli/UnluckyApp/service/ReportService.java"
    click LocationService "https://github.com/MarkoPekasFER/apostoli/blob/main//backend/src/main/java/com/apostoli/UnluckyApp/service/LocationService.java"
    click PhotoService "https://github.com/MarkoPekasFER/apostoli/blob/main//backend/src/main/java/com/apostoli/UnluckyApp/service/PhotoService.java"
    click Controllers "https://github.com/MarkoPekasFER/apostoli/tree/main//backend/src/main/java/com/apostoli/UnluckyApp/controller"
    click Repos "https://github.com/MarkoPekasFER/apostoli/tree/main//backend/src/main/java/com/apostoli/UnluckyApp/repository"
    click Entities "https://github.com/MarkoPekasFER/apostoli/tree/main//backend/src/main/java/com/apostoli/UnluckyApp/model/entity"

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Component"]:::backend
        Database_L["Database"]:::database
        External_L["External Service"]:::external
        Security_L["Security Component"]:::security
    end
```
