# f2had/online-charity-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/f2had/online-charity-management-system
- Repository: https://github.com/f2had/online-charity-management-system

## Overview

##### Project Type and Purpose
- This is a monolithic full‐stack web application called “Online Charity Project Management System.”
- Purpose: Enables non-profits to manage charity projects, meeting reports and volunteer data.

##### High-Level Architecture Components
a. Presentation Layer (Client / Frontend)
- Static HTML pages: index.html, login.php (mix of HTML/PHP), *.html under root (e.g. Volunteer.html, create.html, meeting-report.html).
- CSS & skins: css/, bodybg/, skins/default.css
- JavaScript: js/ (custom.js, login_register.js, profile-handler.js, uisearch.js, plus 3rd-party libs)
- Fonts & images: fonts/, img/
b. Application Layer (Server / Backend)
- Entry points: *.php in root (login.php, logout.php, profile.php, add_report.php, assignVolunteer.php, etc.)
- Business logic & controllers: includes/*.php (signup.inc.php, login.inc.php, report.inc.php, insert_project.php, update_project.php, delete_project.php, edit-profile.inc.php, password-recovery, resetPassword)
- Mailing service: includes/phpmailer/ (PHPMailer library for email notifications)
- Templating / layout: includes/top.php, includes/footer.php, includes/loader.inc.php
c. Data Layer
- Relational database: MySQL schema defined in database/wif2003.sql
- Database access: includes/connect_database.php & includes/config.inc.php
d. External Services
- Email SMTP service (via PHPMailer)
- (Potentially) third-party JS libraries (prettify, classie.js)

##### Key Interactions and Data Flows
- Browser ↔ Web Server: HTTP requests for HTML/PHP pages → server executes .php, uses includes, returns HTML/CSS/JS.
- Server ↔ Database: PHP scripts invoke connect_database.php → SQL queries to wif2003 schema → CRUD operations for projects, volunteers, reports.
- Server ↔ SMTP: report submission or password recovery triggers PHPMailer to send emails.

##### Architectural Patterns & Design Principles
- Layered (Presentation / Business / Data)
- Reusable components via includes/ templates
- Procedural PHP with a light MVC flavor (controllers in includes/, views in HTML/PHP mix)
- Asset separation (css/, js/, fonts/, img/)

- Presentation Layer: static assets (css/, js/, fonts/, img/)
- Application Layer: includes/*.php controllers & page scripts

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Browser" 
        direction TB
        UI["User Interface"]:::client
    end

    %% Server Layer
    subgraph "Web Server (PHP Runtime)" 
        direction TB

        subgraph "Presentation Layer" 
            direction TB
            StaticPages["Static Pages\n(index.html, create.html, Volunteer.html, ...)"]:::client
            EntryPoint["Entry-Point PHP Pages\n(login.php, logout.php, profile.php, ...)"]:::client
            AssetsCSS["CSS & Skins\n(css/, skins/)"]:::client
            AssetsJS["JavaScript Files\n(js/)"]:::client
            AssetsMedia["Fonts & Images\n(fonts/, img/, uploaded_img/)"]:::client
        end

        subgraph "Application Layer" 
            direction TB
            Config["Configuration & DB Connect\n(config.inc.php, connect_database.php)"]:::server
            Controllers["Business Logic / Controllers\n(signup.inc.php, login.inc.php, report.inc.php, ...)"]:::server
            Templates["Templating & Layout\n(top.php, footer.php, loader.inc.php)"]:::server
            MailLib["PHPMailer Library\n(PHPMailer.php, SMTP.php, ...)"]:::external
        end
    end

    %% Data Layer
    Database[(MySQL Database\nwif2003 schema)]:::data

    %% External
    SMTP["SMTP Email Service"]:::external

    %% Connections
    UI -->|"HTTP request/response"| StaticPages
    UI -->|"HTTP request/response"| EntryPoint
    StaticPages -->|"served by"| UI
    EntryPoint -->|"executes PHP"| Controllers
    Controllers -->|"reads/writes"| Database
    Controllers -->|"invokes"| MailLib
    Controllers -->|"uses"| Config
    Controllers -->|"renders"| Templates
    Controllers -->|"serves assets"| AssetsCSS
    Controllers -->|"serves assets"| AssetsJS
    Controllers -->|"serves assets"| AssetsMedia
    MailLib -->|"SMTP send"| SMTP

    %% Click Events
    click StaticPages "https://github.com/f2had/online-charity-management-system/blob/master/index.html"
    click EntryPoint "https://github.com/f2had/online-charity-management-system/blob/master/login.php"
    click AssetsCSS "https://github.com/f2had/online-charity-management-system/blob/master/bodybg/bg1.css"
    click AssetsJS "https://github.com/f2had/online-charity-management-system/blob/master/js/custom.js"
    click AssetsMedia "https://github.com/f2had/online-charity-management-system/tree/master/fonts/"
    click Config "https://github.com/f2had/online-charity-management-system/blob/master/includes/config.inc.php"
    click Controllers "https://github.com/f2had/online-charity-management-system/blob/master/includes/signup.inc.php"
    click Templates "https://github.com/f2had/online-charity-management-system/blob/master/includes/top.php"
    click MailLib "https://github.com/f2had/online-charity-management-system/blob/master/includes/phpmailer/PHPMailer.php"
    click Database "https://github.com/f2had/online-charity-management-system/blob/master/database/wif2003.sql"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef server fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
