# chouaib100/blog_with_php architecture

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

- Interactive diagram: https://gitdiagram.com/chouaib100/blog_with_php
- Repository: https://github.com/chouaib100/blog_with_php

## Overview

##### Project type and purpose
- This is a simple, monolithic PHP/MySQL blog application.
- It serves HTML pages (home, dashboard, posts, login, register) and uses PHP scripts plus a MySQL database for persistence.

##### File structure
- Top-level “blog” directory contains:
- config.php – database connection parameters
- css/styles.css – static styling
- includes/ – shared modules (db connection, functions, header/footer templates)
- pages/ – content controllers (dashboard.php, home.php, login.php, post.php, register.php)
- index.php – front-controller or router entry point
- No separate “frontend” framework—HTML is generated server-side.
- build/deployment specifics aren’t present; it’s designed to run on a standard LAMP stack.

##### README
- Confirms “Blog simple avec le langage de programmation PHP et MySQL.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Client Browser"]:::client
    Browser -->|"HTTP Request"| WebServer

    %% Server Layer
    WebServer["Web Server<br/>(Apache/Nginx + PHP-FPM)"]:::server
    WebServer -->|"Invokes"| FrontController

    %% Application Layer
    subgraph "PHP Application (Blog)"
        direction TB
        FrontController["Front Controller<br/>index.php"]:::appLogic
        Configuration["Configuration Layer<br/>config.php"]:::appLogic

        subgraph "Includes (Shared Modules)"
            direction TB
            DBModule["DB Connection Module<br/>db.php"]:::appLogic
            Functions["Common Functions Module<br/>functions.php"]:::appLogic
            HeaderTpl["Header Template<br/>header.php"]:::static
            FooterTpl["Footer Template<br/>footer.php"]:::static
        end

        subgraph "Pages (Controllers)"
            direction TB
            Dashboard["Dashboard Page<br/>dashboard.php"]:::appLogic
            Home["Home Page<br/>home.php"]:::appLogic
            Login["Login Page<br/>login.php"]:::appLogic
            Post["Single Post Page<br/>post.php"]:::appLogic
            Register["Register Page<br/>register.php"]:::appLogic
        end

        Assets["Static Assets<br/>styles.css"]:::static
    end

    %% Data Layer
    Database["MySQL Database"]:::data

    %% Internal Flows
    FrontController -->|"Loads"| Configuration
    FrontController -->|"Loads"| DBModule
    FrontController -->|"Loads"| Functions
    FrontController -->|"Dispatches"| Dashboard
    FrontController -->|"Dispatches"| Home
    FrontController -->|"Dispatches"| Login
    FrontController -->|"Dispatches"| Post
    FrontController -->|"Dispatches"| Register

    Dashboard -->|"Uses"| Functions
    Home -->|"Uses"| Functions
    Login -->|"Uses"| Functions
    Post -->|"Uses"| Functions
    Register -->|"Uses"| Functions

    Dashboard -->|"DB Queries"| DBModule
    Home -->|"DB Queries"| DBModule
    Login -->|"DB Queries"| DBModule
    Post -->|"DB Queries"| DBModule
    Register -->|"DB Queries"| DBModule

    Dashboard -->|"Includes"| HeaderTpl
    Home -->|"Includes"| HeaderTpl
    Login -->|"Includes"| HeaderTpl
    Post -->|"Includes"| HeaderTpl
    Register -->|"Includes"| HeaderTpl

    Dashboard -->|"Includes"| FooterTpl
    Home -->|"Includes"| FooterTpl
    Login -->|"Includes"| FooterTpl
    Post -->|"Includes"| FooterTpl
    Register -->|"Includes"| FooterTpl

    Dashboard -->|"Links to"| Assets
    Home -->|"Links to"| Assets
    Login -->|"Links to"| Assets
    Post -->|"Links to"| Assets
    Register -->|"Links to"| Assets

    DBModule -->|"SQL Queries"| Database

    WebServer -->|"Serves Static"| Assets
    WebServer -->|"Sends Response"| Browser

    %% Click Events
    click FrontController "https://github.com/chouaib100/blog_with_php/blob/main/blog/index.php"
    click Configuration "https://github.com/chouaib100/blog_with_php/blob/main/blog/config.php"
    click DBModule "https://github.com/chouaib100/blog_with_php/blob/main/blog/includes/db.php"
    click Functions "https://github.com/chouaib100/blog_with_php/blob/main/blog/includes/functions.php"
    click HeaderTpl "https://github.com/chouaib100/blog_with_php/blob/main/blog/includes/header.php"
    click FooterTpl "https://github.com/chouaib100/blog_with_php/blob/main/blog/includes/footer.php"
    click Dashboard "https://github.com/chouaib100/blog_with_php/blob/main/blog/pages/dashboard.php"
    click Home "https://github.com/chouaib100/blog_with_php/blob/main/blog/pages/home.php"
    click Login "https://github.com/chouaib100/blog_with_php/blob/main/blog/pages/login.php"
    click Post "https://github.com/chouaib100/blog_with_php/blob/main/blog/pages/post.php"
    click Register "https://github.com/chouaib100/blog_with_php/blob/main/blog/pages/register.php"
    click Assets "https://github.com/chouaib100/blog_with_php/blob/main/blog/css/styles.css"

    %% Styles
    classDef client fill:#AEDFF7,stroke:#0366D6,color:#03396C
    classDef server fill:#D6EAF8,stroke:#2980B9,color:#154360
    classDef appLogic fill:#ABEBC6,stroke:#27AE60,color:#145A32
    classDef data fill:#FADBD8,stroke:#C0392B,color:#641E16
    classDef static fill:#F9E79F,stroke:#F1C40F,color:#7D6608
```
