# shayanghosh03/mediloopmain_statuscode2 architecture

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

- Interactive diagram: https://gitdiagram.com/shayanghosh03/mediloopmain_statuscode2
- Repository: https://github.com/shayanghosh03/mediloopmain_statuscode2

## Overview

##### Project type and purpose
- This is a monolithic, full-stack web application (“MediLoop”) built in PHP, serving static HTML/CSS/JS on the frontend and handling user registration, login, donation processing, and email/contact functionality on the backend.
- Its purpose is to enable users to share or donate medications, contact the site owners via email, and manage user sessions and data.

##### File structure
- Top-level “mediloopmain” folder contains:
- auth/ (check_session.php, login.php, logout.php, register.php) → authentication endpoints
- config/database.php → database connection configuration (likely MySQL)
- process/donation.php → business logic for processing donations
- setup/ (database_setup.php, complete_setup.php) → initial database setup scripts
- includes/Auth.php, includes/header.php → shared PHP classes and header template
- Static assets at root of mediloopmain: index.html, login.html, signup.html, donate.html, find.html, verify.html, styles.css, script.js, email-config.js
- Debug files (debug.html, debug_check_table.php, debug_test_connection.php) for development checks
- This structure implies a classic server-centric architecture: browser requests static & dynamic pages, PHP scripts handle business logic, configuration lives in config/, and data persists in a relational database.

##### README
- Describes features: contact form (EmailJS/Formspree/Netlify integration), “deliver” button with JS notifications, improved UI, navigation and footer enhancements.
- Confirms tech: HTML/CSS/JS frontend, configurable email service via email-config.js, PHP backend, database.

a. Main components:
- Client Browser (HTML/CSS/JS)
- Web Server (Apache/Nginx with PHP-FPM)
- PHP Application Modules:
– Authentication Module (auth/*)
– Donation Processing Module (process/donation.php)
– Setup Module (setup/*)
– Shared Includes (includes/*)
- Database Server (MySQL/MariaDB)
- External Email Service (EmailJS, Formspree, or Netlify Forms)
b. Relationships & interactions:
1. User’s browser requests an HTML page or makes an AJAX call
2. Web server routes to the corresponding PHP script
3. PHP scripts read/write to the Database via config/database.php
4. For contact form submissions, script.js calls email-config.js which communicates directly with the chosen Email Service API
5. PHP authentication scripts set/validate session cookies
c. Architectural patterns:
- Monolithic, tiered architecture (presentation layer in static files, application layer in PHP, data layer in RDBMS)
- Shared include files to avoid duplication (Auth.php, header.php)
- Separate folder per feature (auth, process, setup) approximates modularization
d. Key technologies/frameworks:
- PHP (server-side logic)
- MySQL/MariaDB (persistent storage)
- HTML5/CSS3/JavaScript (UI & client logic)
- EmailJS/Formspree/Netlify Forms (external email integration)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Client Browser"]:::client
    subgraph "Frontend (Static Assets)"
        direction TB
        Index["index.html"]:::client
        LoginPage["login.html"]:::client
        SignupPage["signup.html"]:::client
        DonatePage["donate.html"]:::client
        FindPage["find.html"]:::client
        VerifyPage["verify.html"]:::client
        DeliverPage["deliver.html"]:::client
        Styles["styles.css"]:::client
        Script["script.js"]:::client
        EmailConfig["email-config.js"]:::client
    end

    %% Backend Layer
    subgraph "Web Server & PHP Application"
        direction TB
        subgraph "Authentication Module"
            CS["check_session.php"]:::server
            Login["login.php"]:::server
            Logout["logout.php"]:::server
            Register["register.php"]:::server
        end
        subgraph "Donation Module"
            Donation["donation.php"]:::server
        end
        subgraph "Setup Module"
            DBSetup["database_setup.php"]:::server
            CompleteSetup["complete_setup.php"]:::server
        end
        subgraph "Shared Includes"
            AuthClass["Auth.php"]:::server
            Header["header.php"]:::server
        end
        ConfigDB["database.php"]:::server
        Dashboard["dashboard.php"]:::server
        subgraph "Debug Tools"
            DebugHTML["debug.html"]:::server
            DebugTable["debug_check_table.php"]:::server
            DebugConn["debug_test_connection.php"]:::server
        end
    end

    %% Data Layer
    Database[(MySQL Database)]:::db

    %% External Services
    EmailService(("Email Service")):::ext

    %% Relationships
    Browser -->|HTTP GET| Index
    Browser -->|HTTP GET| LoginPage
    Browser -->|HTTP GET| SignupPage
    Browser -->|HTTP GET| DonatePage
    Browser -->|HTTP GET| FindPage
    Browser -->|HTTP GET| VerifyPage
    Browser -->|HTTP GET| DeliverPage
    Browser -->|loads CSS/JS| Styles
    Browser -->|loads JS| Script

    Script -->|calls| EmailConfig
    EmailConfig -->|API call| EmailService

    Browser -->|form submit / AJAX| CS
    Browser -->|form submit| Login
    Browser -->|form submit| Register
    Browser -->|request| Logout
    Browser -->|request donation| Donation
    Browser -->|access| Dashboard

    CS -->|session check| AuthClass
    Login -->|authenticate| AuthClass
    Register -->|create user| AuthClass
    Donation -->|use| AuthClass

    CS -->|uses DB| ConfigDB
    Login -->|uses DB| ConfigDB
    Register -->|uses DB| ConfigDB
    Logout -->|uses DB| ConfigDB
    Donation -->|write/read| ConfigDB
    Dashboard -->|read| ConfigDB
    DBSetup -->|initialize| ConfigDB
    CompleteSetup -->|finalize| ConfigDB
    DebugTable -->|check tables| ConfigDB
    DebugConn -->|test connection| ConfigDB

    ConfigDB -->|SQL queries| Database

    %% Click Events
    click CS "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/auth/check_session.php"
    click Login "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/auth/login.php"
    click Logout "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/auth/logout.php"
    click Register "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/auth/register.php"
    click Donation "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/process/donation.php"
    click DBSetup "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/setup/database_setup.php"
    click CompleteSetup "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/setup/complete_setup.php"
    click AuthClass "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/includes/Auth.php"
    click Header "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/includes/header.php"
    click ConfigDB "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/config/database.php"
    click Index "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/index.html"
    click LoginPage "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/login.html"
    click SignupPage "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/signup.html"
    click DonatePage "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/donate.html"
    click FindPage "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/find.html"
    click VerifyPage "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/verify.html"
    click DeliverPage "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/deliver.html"
    click Styles "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/styles.css"
    click Script "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/script.js"
    click EmailConfig "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/email-config.js"
    click Dashboard "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/dashboard.php"
    click DebugHTML "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/debug.html"
    click DebugTable "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/debug_check_table.php"
    click DebugConn "https://github.com/shayanghosh03/mediloopmain_statuscode2/blob/main/mediloopmain/debug_test_connection.php"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef server fill:#98FB98,stroke:#333,stroke-width:1px
    classDef db fill:#F08080,stroke:#333,stroke-width:1px
    classDef ext fill:#FFA500,stroke:#333,stroke-width:1px
```
