# saraaiss/exos-diriges-postits architecture

> Architecture diagram of the GitHub repository saraaiss/exos-diriges-postits, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saraaiss/exos-diriges-postits
- Repository: https://github.com/saraaiss/exos-diriges-postits

## Overview

##### Project type and purpose
- This is a simple full-stack web application for managing “post-it” notes.
- The frontend is a static single-page interface; the backend is a PHP service exposing HTTP routes and persisting data in a SQL database.

##### File structure
- Top-level directories:
– postits-fe: contains HTML pages (index, login, user registration), JavaScript, CSS, and a configuration folder for caching rules.
– postits-be: contains a Dockerfile, Docker Compose config, PHP source code, routing, SQL scripts for initial data and schema, and server configuration files.
- The src/controllers directory holds a PostitController, likely implementing CRUD operations.
- router.php and routes.php define the entry point and HTTP endpoints.
- db directory holds db-structure.sql and db-data.sql for schema and sample data.

##### README
- The README only gives the project name; no architectural details are provided. Rely on file tree for structure and purpose.

##### Main components
- Frontend Application
– Static assets: HTML, CSS, JavaScript
– Runs in user browser
- Backend Service
– HTTP server (PHP, configured via .htaccess or js-no-cache.conf)
– Entry point: router.php
– Route definitions: routes.php
– Business logic: PostitController.php
- Database
– Relational database (MySQL or similar) initialized via db-structure.sql and db-data.sql
- Container Orchestration
– Docker Compose defines two services: web (PHP/Apache) and db
– Dockerfile builds the PHP service environment
- Optional external elements
– Browser cache configuration via js-no-cache.conf

##### Relationships and interactions
- The user’s browser loads index.html (or login/register) from the frontend server.
- JavaScript issues AJAX calls to the backend service’s HTTP endpoints.
- The backend service receives HTTP requests via router.php, dispatches to PostitController, and performs CRUD operations on the database.
- Docker Compose ensures the backend service and database service can communicate over a private network.

##### Architectural patterns and design principles
- Separation of concerns: static frontend vs. dynamic backend
- MVC-style routing: router → controller → model (database)
- Infrastructure as code: Dockerfile and docker-compose.yml for reproducible environments
- Configuration management: separate conf files for caching rules

##### Detail
- Layer—UI, API, data store, and container orchestration.
- Don’t split hairs—represent each logical component separately to reflect clear responsibilities.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Layer
    subgraph "User Layer"
        Browser["Browser"]:::compute
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        FE_Server["Frontend Server\n(Static Assets)"]:::frontend
        FE_Index["index.html"]:::frontend
        FE_Login["login.html"]:::frontend
        FE_Register["nouvelUsager.html"]:::frontend
        FE_Script["script.js"]:::frontend
        FE_Styles["styles.css"]:::frontend
        FE_Conf["js-no-cache.conf"]:::config
    end

    %% Container Orchestration
    subgraph "Docker Compose Network"
        direction TB
        subgraph "web (PHP/Apache Service)"
            direction TB
            HTAccess[".htaccess"]:::config
            ConfigGlobal["config.php"]:::config
            Router["router.php"]:::backend
            Routes["routes.php"]:::backend
            Controller["PostitController.php"]:::backend
            CacheConf["js-no-cache.conf"]:::config
        end
        subgraph "db (Database Service)"
            direction TB
            Database["MySQL Database"]:::db
            DB_Schema["db-structure.sql"]:::db
            DB_Data["db-data.sql"]:::db
        end
    end

    %% Data Flows
    Browser -->|"Loads HTML/CSS/JS"| FE_Server
    FE_Server -->|"Serves Static Assets"| Browser
    Browser -->|"AJAX Calls"| Router
    Router -->|"Invokes Routes"| Routes
    Routes -->|"Dispatch to Controller"| Controller
    Controller -->|"CRUD Operations"| Database

    %% Click Events - Frontend
    click FE_Index "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-fe/index.html"
    click FE_Login "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-fe/login.html"
    click FE_Register "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-fe/nouvelUsager.html"
    click FE_Script "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-fe/script.js"
    click FE_Styles "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-fe/styles.css"
    click FE_Conf "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-fe/conf/js-no-cache.conf"

    %% Click Events - Backend
    click HTAccess "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/.htaccess"
    click ConfigGlobal "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/config.php"
    click Router "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/router.php"
    click Routes "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/routes.php"
    click Controller "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/src/controllers/PostitController.php"
    click CacheConf "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/conf/js-no-cache.conf"
    click DB_Schema "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/db/db-structure.sql"
    click DB_Data "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/db/db-data.sql"
    click Database "https://github.com/saraaiss/exos-diriges-postits/blob/main/postits-be/docker-compose.yml"
    click FE_Server "https://github.com/saraaiss/exos-diriges-postits/tree/main/postits-be/Dockerfile"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#90CAF9
    classDef backend fill:#FFF3E0,stroke:#FFB74D
    classDef db fill:#E8F5E9,stroke:#66BB6A
    classDef config fill:#F3E5F5,stroke:#AB47BC
    classDef compute fill:#ECEFF1,stroke:#78909C
```
