# evaluationweb/projet-chocoblast architecture

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

- Interactive diagram: https://gitdiagram.com/evaluationweb/projet-chocoblast
- Repository: https://github.com/evaluationweb/projet-chocoblast

## Overview

##### Project Type and Purpose
- This is a PHP‐based full‐stack web application (named “Chocoblast”) following a classic MVC pattern.
- It delivers server‐rendered HTML pages, uses Composer for dependency management, reads configuration from an .env file, and persists data in a relational database.

##### File Structure Analysis
- App/
- Controller/ – contains controller logic (routes → handlers)
- Model/      – domain objects and database access methods
- Database/   – database connection/config wrapper
- public/
- index.php  – front controller (entry point)
- style/, script/, image/ – static assets served directly
- templates/    – view templates (HTML/PHP)
- composer.json/.env – dependency & configuration
- README.md – setup instructions

##### Core Components
a. Client (Browser)
b. Web Server (PHP built‐in server or Apache/Nginx + PHP-FPM)
c. Front Controller (public/index.php)
d. Router & Controllers (App/Controller)
e. Model Layer (App/Model)
f. Database Connector (App/Database + .env config)
g. Relational Database (MySQL/PostgreSQL/etc.)
h. Templating Engine (templates/)
i. Static Asset Server (public/style, script, image)

##### Relationships and Data Flows
- Web Server → Front Controller (index.php)
- Front Controller → Router → Specific Controller Method
- Controller ↔ Model: read/write business data
- Model → Database Connector → Database: SQL queries/results
- Controller → Templating Engine → Generated HTML
- HTML + Asset references → Client
- Static asset requests (CSS/JS/Images) are served directly by the public directory

##### Architectural Patterns & Principles
- MVC Separation (Controller / Model / View)
- Single Entry‐Point (Front Controller)
- Dependency Injection via Composer packages (if applicable)
- Twelve-Factor App-style environment config (.env)

##### Step-by-Step Creation
– index.php (Front Controller)
– Router → Controller classes
7. Labels for protocols (HTTP, SQL) and config details (.env).

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef presentation fill:#D0E4F5,stroke:#000;
    classDef application fill:#D8ECC7,stroke:#000;
    classDef data fill:#F9E0B2,stroke:#000;
    classDef database fill:#F5C6AA,stroke:#000;

    subgraph "Presentation Layer"
        Client["Client (Browser)"]:::presentation
        Templates["Templates (Twig/native PHP)"]:::presentation
        subgraph "Static Assets"
            Images["Images"]:::presentation
            Scripts["Scripts"]:::presentation
            Styles["Styles"]:::presentation
        end
    end

    subgraph "Application Layer"
        WebServer["Web Server (PHP 8.x + Composer)"]:::application
        subgraph "Server Internal"
            FrontController["public/index.php"]:::application
            Controllers["Router & Controllers (App/Controller/)"]:::application
            ComposerNode["composer.json"]:::application
            EnvNode[".env"]:::application
        end
    end

    subgraph "Data Layer"
        Models["Model Layer (App/Model/)"]:::data
        DBConnector["DB Connector (.env config)"]:::data
        Database[(Database MySQL/PostgreSQL)]:::database
    end

    README["README.md"]:::presentation

    Client -->|"HTTP/HTTPS"| WebServer
    WebServer --> FrontController
    FrontController --> Controllers
    Controllers -->|"PHP method call"| Models
    Models -->|"SQL"| DBConnector
    DBConnector -->|"SQL"| Database
    Controllers -->|"renders"| Templates
    Templates -->|"HTML"| Client
    Client -->|"GET assets"| Images
    Client -->|"GET assets"| Scripts
    Client -->|"GET assets"| Styles
    WebServer --> ComposerNode
    WebServer --> EnvNode

    click FrontController "https://github.com/evaluationweb/projet-chocoblast/blob/main/public/index.php"
    click Controllers "https://github.com/evaluationweb/projet-chocoblast/tree/main/App/Controller/"
    click Models "https://github.com/evaluationweb/projet-chocoblast/tree/main/App/Model/"
    click DBConnector "https://github.com/evaluationweb/projet-chocoblast/tree/main/App/Database/"
    click Templates "https://github.com/evaluationweb/projet-chocoblast/tree/main/templates/"
    click Images "https://github.com/evaluationweb/projet-chocoblast/tree/main/public/image/"
    click Scripts "https://github.com/evaluationweb/projet-chocoblast/tree/main/public/script/"
    click Styles "https://github.com/evaluationweb/projet-chocoblast/tree/main/public/style/"
    click ComposerNode "https://github.com/evaluationweb/projet-chocoblast/blob/main/composer.json"
    click EnvNode "https://github.com/evaluationweb/projet-chocoblast/blob/main/.env"
    click README "https://github.com/evaluationweb/projet-chocoblast/blob/main/README.md"
```
