# thienkonphap/olympic-2024 architecture

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

- Interactive diagram: https://gitdiagram.com/thienkonphap/olympic-2024
- Repository: https://github.com/thienkonphap/olympic-2024

## Overview

##### Main Components
- API Gateway (gateway): Acts as the entry point for client requests, available on port 8082. Its role is to route and possibly filter or aggregate requests before forwarding them to individual services.
- Calendar Service (calendar-service): Exposes endpoints at port 8080. It contains controllers, models, repositories, and services for managing calendar-related data. Its Swagger documentation is available at “/swagger-ui/index.html.”
- Planning Service (planning-service): Runs on port 8081 with similar architectural layering (AppConfig, controllers, models, repositories, services) handling planning-related features.
- Site Service (sites-service): Available on port 8083, contains endpoints for site and sport functionalities, along with Kubernetes deployment artifacts and Docker configurations. It loads initial data via SQL scripts and exposes its own API docs at the proper swagger endpoint.
- External Clients/Users: Represented as browsers or Postman. These clients interact with the API Gateway and can also directly access individual services using their respective ports.

##### Relationships and Data Flow
- That each microservice exposes its own Swagger documentation for API exploration.

##### Architectural Patterns and Design Principles
- Microservices Architecture: Each service is built as an isolated Spring Boot application with its own configuration (e.g., application.yml and application.properties) and business domain.
- API Gateway Pattern: A gateway component centralizes incoming requests to route them to the appropriate service.
- Containerization and Orchestration: The presence of Dockerfiles and Kubernetes YAML files (in sites-service/k8s) suggests that container-based deployment is used, emphasizing scalability, resilience, and easy deployment.

##### Relevant Technologies and Frameworks
- Java with Maven for dependency management.
- Spring Boot (implied by the MsaApplication.java classes and typical Spring project structure).
- Controller/Repository/Service patterns (typical layered architecture).
- Docker and Kubernetes for containerization and orchestration (specifically for the site service).
- Swagger for API documentation.
- Additional libraries provided in the “lib” directory to support Java EE/Jakarta EE features.

##### Elements
- “API Gateway” (listening on port 8082)
- “Calendar Service” (port 8080)
- “Planning Service” (port 8081)
- “Site Service” (port 8083)
- Data flow from Clients to API Gateway.
- Infrastructure/External component (e.g., API Gateway)
- Business services (e.g., Calendar, Planning, Site)
- Deployment elements (Docker, Kubernetes elements)
- Annotations for Swagger endpoints for enhanced clarity.

##### Detailed Composition
- Calendar Service
- Planning Service
- Site Service
- Optionally, include Docker/Kubernetes symbols next to the Site Service to remind viewers of its containerized nature.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    CLIENT("Clients (Browser/Postman)"):::external

    %% API Gateway Subgraph
    subgraph "API Gateway (port 8082)"
        AG1("API Gateway Application"):::gateway
        AG2("Configuration"):::gateway
    end

    %% Calendar Service Subgraph
    subgraph "Calendar Service (port 8080)"
        CAL1("Calendar Application"):::service
        CAL2("Swagger: /swagger-ui/index.html"):::service
    end

    %% Planning Service Subgraph
    subgraph "Planning Service (port 8081)"
        PLAN1("Planning Application"):::service
        PLAN2("AppConfig"):::service
        PLAN3("Swagger: /swagger-ui/index.html"):::service
    end

    %% Site Service Subgraph
    subgraph "Site Service (port 8083)"
        SITE1("Site Application"):::service
        SITE_CTRL1("SiteController"):::service
        SITE_CTRL2("SportController"):::service
        SITE_DOCKER("Dockerfile"):::deployment
        SITE_K8S("Kubernetes YAMLs"):::deployment
        SITE4("Swagger: /swagger-ui/index.html"):::service
    end

    %% Main Connections
    CLIENT -->|"HTTP"| AG1
    AG1 -->|"Routes"| CAL1
    AG1 -->|"Routes"| PLAN1
    AG1 -->|"Routes"| SITE1

    %% Click Events for API Gateway
    click AG1 "https://github.com/thienkonphap/olympic-2024/blob/main/gateway/src/main/java/dauphine/miageif/site/ApiGatewayApplication.java"
    click AG2 "https://github.com/thienkonphap/olympic-2024/blob/main/gateway/src/main/resources/application.yml"

    %% Click Events for Calendar Service
    click CAL1 "https://github.com/thienkonphap/olympic-2024/blob/main/calendar-service/src/main/java/dauphine/miageif/site/MsaApplication.java"

    %% Click Events for Planning Service
    click PLAN1 "https://github.com/thienkonphap/olympic-2024/blob/main/planning-service/src/main/java/dauphine/miageif/site/MsaApplication.java"
    click PLAN2 "https://github.com/thienkonphap/olympic-2024/blob/main/planning-service/src/main/java/dauphine/miageif/site/AppConfig.java"

    %% Click Events for Site Service
    click SITE1 "https://github.com/thienkonphap/olympic-2024/blob/main/sites-service/src/main/java/dauphine/miageif/site/MsaApplication.java"
    click SITE_CTRL1 "https://github.com/thienkonphap/olympic-2024/blob/main/sites-service/src/main/java/dauphine/miageif/site/SiteController.java"
    click SITE_CTRL2 "https://github.com/thienkonphap/olympic-2024/blob/main/sites-service/src/main/java/dauphine/miageif/site/SportController.java"
    click SITE_DOCKER "https://github.com/thienkonphap/olympic-2024/tree/main/sites-service/Dockerfile"
    click SITE_K8S "https://github.com/thienkonphap/olympic-2024/tree/main/sites-service/k8s/"

    %% Styles
    classDef external fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef gateway fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef service fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef deployment fill:#f8d7da,stroke:#333,stroke-width:2px;
```
