# juy0/cyber architecture

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

- Interactive diagram: https://gitdiagram.com/juy0/cyber
- Repository: https://github.com/juy0/cyber

## Overview

##### Main Components
- Frontend (User Interface): This is built using HTML/CSS and is represented by the files in the “views”, “css”, and “daft” directories. It contains pages for home, login, reservations, user profile, tournament listings, etc.
- Backend (PHP Controllers): The “controllers” directory contains all the PHP scripts handling business logic including user reservations, forfait purchases, game management, tournament creation, and administrative operations. Additionally, “db.php” manages the connection to the database.
- Database: The presence of “cpy.sql” and “cybergames.sql” indicates two SQL schema files for MySQL databases, which store data for users, postes, reservations, forfaits, and tournaments.
- Deployment/Development Environment: The Docker configuration (docker-compose.yml and dockerfile) alongside references to XAMPP in the README indicate the environment setup and containerized deployment approach.

##### Relationships and Interactions
- Client–Server Model: The frontend interacts with the backend controllers through HTTP requests. Each controller (e.g., login.php, reserve_poste.php) maps user actions to server-side business logic.
- Administrative/Employee Interfaces: Highlight that specialized panels (admin.php, manage_postes.php, manage_reservations.php, manage_tournaments.php) allow privileged operations on the system.
- Docker and Deployment: Indicate a containerization layer that helps in isolating the development and production environments and streamlining deployment.

##### Architectural Patterns and Design Principles
- MVC-like Separation: Although not a strict MVC framework, the project separates presentation (views), business logic (controllers), and data management (database) clearly.
- Separation of Concerns: Different responsibilities are split between user functionalities (reservation, forfaits, tournois) and administrative management.
- Extensibility: The distinct modules (controllers and views for various features) suggest that the system is designed for future scalability and maintenance.

##### Mapping the Technologies
- Frontend Technologies: HTML and CSS (with the “css” and “daft” directories).
- Backend Technologies: PHP scripts in the controllers interact with MySQL through PDO.
- Database: MySQL setup indicated by the SQL files.
- Containerization: Docker (docker-compose.yml and dockerfile) for deployment and testing.
- Local Development: Usage of XAMPP for a local server environment.

##### Important Details to Capture
- The specialized functionalities such as reservation management, forfait purchases, and tournament operations.
- Support for maintenance and future scalability; present the controllers in clusters that show dedicated roles.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface"
        UI1["Views"]:::frontend
        UI2["CSS Assets"]:::frontend
        UI3["Daft Assets"]:::frontend
    end

    subgraph "Deployment Environment (Docker)"
        DC1["Docker Compose"]:::deployment
        DC2["Dockerfile"]:::deployment
        subgraph "Business Logic – PHP Controllers"
            BE1["PHP Controllers"]:::backend
            BE2["DB Connection"]:::backend
        end
        subgraph "Database – MySQL"
            DB1["cpy.sql"]:::database
            DB2["cybergames.sql"]:::database
        end
    end

    %% Arrows from UI to Backend
    UI1 -->|"HTTP_Request"| BE1
    UI2 -->|"HTTP_Request"| BE1
    UI3 -->|"HTTP_Request"| BE1

    %% Arrows within backend to database connection
    BE1 -->|"DB_Query"| BE2
    BE2 -->|"SQL_Query"| DB1
    BE2 -->|"SQL_Query"| DB2

    %% Docker deployment arrows
    DC1 -->|"deploys"| BE1
    DC1 -->|"deploys"| DB1
    DC2 -->|"builds"| BE1
    DC2 -->|"builds"| DB2

    %% Click Events for Frontend Components
    click UI1 "https://github.com/juy0/cyber/tree/main//views"
    click UI2 "https://github.com/juy0/cyber/tree/main//css"
    click UI3 "https://github.com/juy0/cyber/tree/main//daft"

    %% Click Events for Backend Components
    click BE1 "https://github.com/juy0/cyber/tree/main//controllers"
    click BE2 "https://github.com/juy0/cyber/blob/main//db.php"

    %% Click Events for Database Schemas
    click DB1 "https://github.com/juy0/cyber/blob/main//cpy.sql"
    click DB2 "https://github.com/juy0/cyber/blob/main//cybergames.sql"

    %% Click Events for Docker Configuration
    click DC1 "https://github.com/juy0/cyber/blob/main//docker-compose.yml"
    click DC2 "https://github.com/juy0/cyber/tree/main//dockerfile"

    %% Styling
    classDef frontend fill:#CCE5FF,stroke:#3399FF,stroke-width:2px;
    classDef backend fill:#FFCC99,stroke:#FF9933,stroke-width:2px;
    classDef database fill:#CCFFCC,stroke:#33CC33,stroke-width:2px;
    classDef deployment fill:#F0E68C,stroke:#DAA520,stroke-width:2px;
```
