# avotexs/interventions_aireport architecture

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

- Interactive diagram: https://gitdiagram.com/avotexs/interventions_aireport
- Repository: https://github.com/avotexs/interventions_aireport

## Overview

##### Project Type & Purpose
- This is a full-stack web application named “Airport Intervention Management Platform.”
- Frontend: Angular 20 single-page app for role-aware user interfaces (admins vs technicians).
- Backend: Spring Boot 3.5 REST API providing CRUD and reporting over MySQL.
- Containerized with Docker (Angular in Nginx), Spring Boot in its own container, and MySQL via docker-compose.

##### File-Structure Analysis
- Top-level:
- backend/ – Spring Boot service (Maven wrapper, Dockerfile, controllers, services, repositories, models, DTOs, application.properties)
- frontend/ – Angular workspace (standalone components, routes, guards, interceptors, services, public assets, Dockerfile)
- docker-compose.yml – definition for MySQL, backend, and frontend stacks.
- Backend layers reflect a classic layered architecture:
- controller/ – REST endpoints (AuthController, ReportingController, entity controllers)
- service/ – business logic & reporting calculations
- repository/ – Spring Data JPA interfaces
- model/ – JPA entities
- dto/ – data transfer objects
- Frontend modules:
- src/app/* – standalone components grouped by feature (aeroport, campagny, equipement, zones, etc.), guard/interceptor for auth, shared services (ThemeService, LangService).
- app.routes.ts – route definitions and guard wiring.
- Deployment artifacts: Dockerfiles in both subprojects and top-level docker-compose.yml.

##### Key Insights from README
- Role-based UX with Angular Guards and token-based session handling.
- Reporting module with DTOs for chart data and CSV export.
- CORS config in backend to allow calls from Angular dev server.
- In-memory session store in dev, planned to swap to persistent.
- Dev vs Prod: Angular dev server on 4200 proxies to 9090; production build served by Nginx.
- MySQL 8 container with named volume persists data.

a. Main Components
- User Agents (Browser) – Admin and Technician roles
- Angular Frontend Container (Nginx)
- API Gateway/Proxy (Optional: Nginx reverse proxy)
- Spring Boot Backend Container
- MySQL Database Container
- (Optional) External Services: e.g., SMTP for notifications, external storage for CSV exports
b. Relationships & Data Flows
1. Browser → HTTP(S) → Nginx/Angular (ports 80/4200)
2. Angular Services → HTTP API calls → Spring Boot controllers (/api/*)
3. Controllers → Service Layer → Repository → MySQL
4. Service Layer uses DTOs to map Entities → Controllers → JSON → Angular
5. Interceptors attach X-Auth-Token; Guards enforce route access.
6. ReportingService fetches aggregated stats & streams CSV exports.
c. Architectural Patterns & Principles
- Layered Architecture (Controller → Service → Repository)
- RESTful API design
- Token-based Authentication & Authorization
- Component-based frontend with Angular standalone components & router
- Internationalisation via LangService
- Containerization (Dockerfile + Docker Compose as orchestration)
d. Technologies & Frameworks
- Frontend: Angular 20, RxJS, Angular Router, Karma/Jasmine
- Backend: Spring Boot 3.5, Spring Data JPA, Maven, Java 21
- Database: MySQL 8
- DevOps: Docker, Docker Compose, Nginx

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    Browser["Browser (Admin/Technician)"]:::external
    Browser -->|"HTTP 4200/80"| Nginx

    subgraph "docker-compose"
        direction TB
        Nginx["Angular SPA Container (Nginx)"]:::frontend
        click Nginx "https://github.com/avotexs/interventions_aireport/tree/main/frontend/Dockerfile"

        subgraph "Angular Application"
            direction TB
            AppEntry["app.ts & app.routes.ts"]:::frontend
            click AppEntry "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/app/app.ts"
            click AppEntry "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/app/app.routes.ts"

            Guards["Guards (AuthGuard & RoleGuard)"]:::frontend
            click Guards "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/app/guards/auth-guard.ts"
            click Guards "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/app/guards/role-guard.ts"

            Interceptor["HTTP Interceptor (X-Auth-Token)"]:::frontend
            click Interceptor "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/app/interceptors/auth-interceptor.ts"

            Services["i18n & Theming Services"]:::frontend
            click Services "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/app/services/Theme.service.ts"
            click Services "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/app/services/lang.service.ts"

            Components["Feature Components"]:::frontend
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/aeroport-component"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/campagny"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/equipement"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/zone"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/problem"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/intervention-component"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/solution"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/projet"
            click Components "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/technicien-component"

            HomeDash["Home Dashboards"]:::frontend
            click HomeDash "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/home"
            click HomeDash "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/app/technicien-home"

            Assets["Public Assets & Index"]:::frontend
            click Assets "https://github.com/avotexs/interventions_aireport/blob/main/frontend/src/index.html"
            click Assets "https://github.com/avotexs/interventions_aireport/tree/main/frontend/src/assets"
        end

        Nginx -->|"Serves SPA via HTTP 80"| AppEntry
        AppEntry --> Guards
        Guards --> Interceptor
        Interceptor --> Components
        Components --> Services
        Services --> HomeDash
        HomeDash --> Assets

        SpringBootContainer["Spring Boot Container"]:::backend
        click SpringBootContainer "https://github.com/avotexs/interventions_aireport/tree/main/backend/Dockerfile"

        subgraph "Spring Boot Application"
            direction TB
            Bootstrap["BackendApplication.java"]:::backend
            click Bootstrap "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/BackendApplication.java"

            Controllers["REST Controllers"]:::backend
            click Controllers "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/controller/AuthController.java"
            click Controllers "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/controller/ReportingController.java"

            ServicesBE["Service Layer"]:::backend
            click ServicesBE "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/service/AuthService.java"
            click ServicesBE "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/service/ReportingService.java"

            Repositories["Repositories (JPA)"]:::backend
            click Repositories "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/repository/AeroportRepository.java"

            Models["JPA Entities"]:::backend
            click Models "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/model/Aeroport.java"

            DTOs["DTOs & Reporting DTOs"]:::backend
            click DTOs "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/dto/LoginRequest.java"

            Config["CORS & Web Config"]:::backend
            click Config "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/config/CorsConfig.java"
            click Config "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/java/com/airoport/backend/config/WebConfig.java"

            Properties["application.properties"]:::backend
            click Properties "https://github.com/avotexs/interventions_aireport/blob/main/backend/src/main/resources/application.properties"
        end

        AppEntry -->|"HTTP 9090 /api/*"| SpringBootContainer
        SpringBootContainer --> Bootstrap
        Bootstrap --> Controllers
        Controllers --> ServicesBE
        ServicesBE --> Repositories
        Repositories --> Models
        ServicesBE --> DTOs
        Controllers --> DTOs
        Config --> Controllers
        SpringBootContainer --> Properties

        MySQL["MySQL Database"]:::data
        MySQL -->|"JDBC 3306"| Repositories
        click MySQL "https://github.com/avotexs/interventions_aireport/blob/main/docker-compose.yml"

        SpringBootContainer --> MySQL
        Nginx -.->|"Depends on"| SpringBootContainer

        SMTP["SMTP Service"]:::external
        Storage["External Storage"]:::external
        ServicesBE --> SMTP
        ServicesBE --> Storage
    end

    classDef frontend fill:#ADD8E6,stroke:#000;
    classDef backend fill:#90EE90,stroke:#000;
    classDef data fill:#FFD580,stroke:#000;
    classDef external fill:#E6E6E6,stroke:#000;
```
