# aryanshekhada08/php-curd-app architecture

> Architecture diagram of the GitHub repository aryanshekhada08/php-curd-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aryanshekhada08/php-curd-app
- Repository: https://github.com/aryanshekhada08/php-curd-app

## Overview

##### Project Type and Purpose
- This is a monolithic, full-stack web application for Student Registration & Management.
- Built with PHP for server-side logic, MySQL for persistence, standard HTML/CSS/Bootstrap for UI, and DataTables for client-side table enhancements.
- Provides CRUD operations: create (registration form + image upload), read (dashboard table), update (edit form), delete (record removal).

##### File Structure
- Top-level .php scripts act as controllers/endpoints:
- index.php (registration form + POST → create student)
- dashboard.php (lists students, links to edit/delete)
- edit.php (loads data, POST → update)
- delete.php (handles record removal)
- thankyou.html / thankyou.css: post-submission confirmation page & styling.
- style.css: global custom styles.
- images/: stores uploaded profile pictures.
- screenshots/: docs only.
- No explicit “models” folder—data access is mixed within controller scripts.

##### Architecture Components
a. Client Layer
- Browser with HTML/CSS/Bootstrap UI
- DataTables JS plugin for searching & pagination
b. Web Server Layer
- Apache/Nginx + PHP runtime
- Controller scripts (index.php, edit.php, etc.) implement routing & business logic
c. Data Access Layer
- PHP code issues SQL queries against MySQL database
d. Storage Layer
- MySQL database (students table)
- File system (‘images/’ directory) for profile pictures

##### Interactions & Data Flow
- User fills registration form → HTTP POST to index.php
- index.php
- Validates input, saves student record to MySQL
- Stores image file under images/
- Redirects to thankyou.html
- Student list page (dashboard.php)
- Queries MySQL for all students
- Builds HTML table, DataTables adds search/pagination
- Edit flow (edit.php)
- GET loads existing data into form, POST updates MySQL & optional image
- Delete flow (delete.php)
- Deletes DB record, unlinks image file

##### Architectural Patterns & Principles
- Monolithic MVC-like separation (Controllers are PHP files, Views are inline HTML + Bootstrap, Model is direct SQL calls).
- Single codebase deployable on a PHP-enabled web host.
- Stateless HTTP interactions; session or cookies can be added if auth is required.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Browser<br/>(HTML/CSS/Bootstrap)"]:::ui
        DataTables["DataTables JS"]:::ui
        Style["style.css"]:::ui
        ThankyouCSS["thankyou.css"]:::ui
    end

    %% Web Server Layer
    subgraph "Web Server Layer"
        CreateC["index.php<br/>(Registration Controller)"]:::backend
        ReadC["dashboard.php<br/>(Student List Controller)"]:::backend
        UpdateC["edit.php<br/>(Student Update Controller)"]:::backend
        DeleteC["delete.php<br/>(Student Deletion Controller)"]:::backend
        ThankyouView["thankyou.html<br/>(Confirmation View)"]:::backend
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        DB["MySQL Database<br/>(students table)"]:::db
        FS["File Storage<br/>(images/)"]:::fs
        Docs["README.md & screenshots/"]:::fs
    end

    %% Client to Server
    Browser -->|POST Create| CreateC
    Browser -->|GET Read| ReadC
    Browser -->|GET Edit Form| UpdateC
    Browser -->|POST Update| UpdateC
    Browser -->|Request Delete| DeleteC
    Browser --> Style
    ThankyouView --> ThankyouCSS
    Browser --> DataTables

    %% Server to Persistence
    CreateC -->|INSERT student| DB
    CreateC -->|Save image| FS
    CreateC -->|Redirect| ThankyouView

    ReadC -->|SELECT students| DB
    ReadC -->|Response HTML| Browser

    UpdateC -->|SELECT student| DB
    UpdateC -->|Response Form| Browser
    UpdateC -->|UPDATE student| DB
    UpdateC -->|Optional save image| FS

    DeleteC -->|DELETE student| DB
    DeleteC -->|Unlink image| FS
    DeleteC -->|Redirect| ReadC

    %% Click Events
    click CreateC "https://github.com/aryanshekhada08/php-curd-app/blob/main/index.php"
    click ReadC "https://github.com/aryanshekhada08/php-curd-app/blob/main/dashboard.php"
    click UpdateC "https://github.com/aryanshekhada08/php-curd-app/blob/main/edit.php"
    click DeleteC "https://github.com/aryanshekhada08/php-curd-app/blob/main/delete.php"
    click ThankyouView "https://github.com/aryanshekhada08/php-curd-app/blob/main/thankyou.html"
    click ThankyouCSS "https://github.com/aryanshekhada08/php-curd-app/blob/main/thankyou.css"
    click Style "https://github.com/aryanshekhada08/php-curd-app/blob/main/style.css"
    click FS "https://github.com/aryanshekhada08/php-curd-app/tree/main/images/"
    click Docs "https://github.com/aryanshekhada08/php-curd-app/blob/main/README.md"

    %% Styles
    classDef ui fill:#cfe2f3,stroke:#333,stroke-width:1px
    classDef backend fill:#d9ead3,stroke:#333,stroke-width:1px
    classDef db fill:#f9cb9c,stroke:#333,stroke-width:1px
    classDef fs fill:#d9d2e9,stroke:#333,stroke-width:1px
```
