# aymant122r/client_traceability_rfid architecture

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

- Interactive diagram: https://gitdiagram.com/aymant122r/client_traceability_rfid
- Repository: https://github.com/aymant122r/client_traceability_rfid

## Overview

##### Project type and purpose
- This is an embedded-to-web full-stack system that tracks RFID-tagged clients.
- The hardware (MFRC522 + ESP32) reads tag IDs, the ESP32 C++ firmware processes and forwards them to a PHP-MySQL backend, and a web frontend manages and displays the data.

##### File structure
- C++_Backend/
- station_lavage.cpp – ESP32 firmware using the MFRC522 library
- PHP_Frontend/
- post-esp-data.php – API endpoint to receive ESP32 HTTP requests
- insert.php, update.php, search.php – CRUD handlers for client records
- Php_frontend.php – main UI entry point
- README.md + image/architecture.png – high-level description and existing architecture sketch

##### Key insights from the README
- Data flow: RFID → ESP32 → HTTP → PHP API → MySQL → PHP frontend
- Tech stack: C++ on ESP32, PHP/Apache, MySQL (phpMyAdmin), HTML/CSS/JS

##### Essential details without over-complicating
- Files or endpoints next to each component (station_lavage.cpp, post-esp-data.php, search.php).
- If helpful, include small callouts showing database schema entities (tags, clients, timestamps).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Hardware/Firmware Layer"
        RFID["RFID Reader (MFRC522)"]:::hardware
        ESP32["ESP32 Module\n(station_lavage.cpp)"]:::hardware
    end

    subgraph "Network/API Layer"
        WiFi["Wi-Fi Network"]:::network
    end

    subgraph "Server Layer"
        Apache["Web Server\n(Apache + PHP)"]:::server
        subgraph "PHP API Endpoints"
            Post["/post-esp-data.php"]:::api
            Insert["insert.php"]:::api
            Search["search.php"]:::api
            Update["update.php"]:::api
        end
        Frontend["Php_frontend.php"]:::frontend
    end

    subgraph "Persistence Layer"
        MySQL["MySQL Database"]:::db
    end

    subgraph "Client Layer"
        Browser["Web Browser\n(HTML/CSS/JS)"]:::client
    end

    subgraph "Documentation"
        README["README.md"]:::docs
        ARCH["architecture.png"]:::docs
    end

    RFID -->|"SPI"| ESP32
    ESP32 -->|"HTTP POST /post-esp-data.php"| WiFi
    WiFi -->|"HTTP POST"| Post
    Post -->|"SQL INSERT"| MySQL
    Insert -->|"SQL INSERT"| MySQL
    Search -->|"SQL SELECT"| MySQL
    Update -->|"SQL UPDATE"| MySQL
    Browser -->|"HTTP GET/POST"| Frontend
    Frontend -->|"SQL SELECT/INSERT/UPDATE"| MySQL
    Frontend -->|"renders HTML/CSS/JS"| Browser

    click ESP32 "https://github.com/aymant122r/client_traceability_rfid/blob/main/C++_Backend/station_lavage.cpp"
    click Post "https://github.com/aymant122r/client_traceability_rfid/blob/main/PHP_Frontend/post-esp-data.php"
    click Insert "https://github.com/aymant122r/client_traceability_rfid/blob/main/PHP_Frontend/insert.php"
    click Search "https://github.com/aymant122r/client_traceability_rfid/blob/main/PHP_Frontend/search.php"
    click Update "https://github.com/aymant122r/client_traceability_rfid/blob/main/PHP_Frontend/update.php"
    click Frontend "https://github.com/aymant122r/client_traceability_rfid/blob/main/PHP_Frontend/Php_frontend.php"
    click README "https://github.com/aymant122r/client_traceability_rfid/blob/main/README.md"
    click ARCH "https://github.com/aymant122r/client_traceability_rfid/blob/main/image/architecture.png"

    classDef hardware fill:#a8d5ba,stroke:#333,stroke-width:1px
    classDef network fill:#a4c8f0,stroke:#333,stroke-width:1px
    classDef server fill:#f7c46c,stroke:#333,stroke-width:1px
    classDef api fill:#f7c46c,stroke:#333,stroke-dasharray:5 5
    classDef frontend fill:#f7c46c,stroke:#333,stroke-width:1px
    classDef db fill:#d3d3d3,stroke:#333,stroke-width:2px
    classDef client fill:#f0a4c8,stroke:#333,stroke-width:1px
    classDef docs fill:#e0e0e0,stroke:#333,stroke-dasharray:2 2,stroke-width:1px
```
