# hilal-verse/campus-environment-enhancement-initiative architecture

> Architecture diagram of the GitHub repository hilal-verse/campus-environment-enhancement-initiative, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hilal-verse/campus-environment-enhancement-initiative
- Repository: https://github.com/hilal-verse/campus-environment-enhancement-initiative

## Overview

##### What this project is (type + purpose)
This is a classic **PHP + MySQL monolithic web application** (runs on Apache/XAMPP) for a **Campus Environment Feedback/Complaint system**:

- **Students**: register/login, submit feedback, view their own submissions and status.
- **Admins**: login, review all submissions, update status + add responses.
- **Security**: sessions, role-based access, prepared statements, password hashing.

- A **browser-based UI** (HTML/CSS/JS)
- A **PHP server-side app** (pages + action endpoints)
- A **MySQL database**
- **Session/auth and role gates**
- Admin vs student flows

##### Application layer (server / PHP)
Role dashboards:
- `student/student_dashboard.php`
- `admin/admin_dashboard.php`

Action endpoints (backend “controllers”):
- `actions/login_form.php`
- `actions/sign_up_form.php`
- `actions/logout.php`
- `actions/get_complaint_details.php`
- `actions/update_complaint_details.php`

Configuration:
- `config/config.example.php` (implies `config/config.php` exists locally with DB creds)

##### Data layer
- `database/campus_feedback_system.sql`

##### Documentation
- `docs/Documentaion.txt` (not runtime, but helps understand flows)

##### Browser (UI)
- Public pages: login/signup/index
- Dashboards: student/admin
##### Apache/PHP Runtime (Monolith App)
- Page controllers: `student_dashboard.php`, `admin_dashboard.php`
- Action endpoints: `actions/*`
- Auth/session + RBAC (cross-cutting)
- DB config module (`config/config.php`)

##### Architectural pattern(s) to highlight (based on structure)
This repo strongly suggests a **Page Controller + Action Script** pattern typical in PHP:

- **Pages**: `public/*.html`, `student/*.php`, `admin/*.php` (render UI)
- **Actions**: `actions/*.php` (handle POST/AJAX, DB operations, returns/redirects)

Also call out **cross-cutting concerns**:
- **RBAC**: routes/scripts separated by role (student vs admin)
- **Session protection**: enforced before serving dashboards/actions
- **DB access**: centralized via config + prepared statements (from README)

##### Labels
Use explicit labels that match the repo to reduce ambiguity:
- “Student Dashboard (student/student_dashboard.php)”
- “Admin Dashboard (admin/admin_dashboard.php)”
- “Login Handler (actions/login_form.php)”
- “Update Complaint (actions/update_complaint_details.php)”
- “DB Config (config/config.php)”
- “MySQL (campus_feedback_system)”

- “HTTP GET (HTML/CSS/JS)”
- “HTTP POST (form)”
- “AJAX JSON (if applicable)”
- “SQL SELECT/INSERT/UPDATE (prepared statements)”

##### Browser/UI
- Public pages (index/login/signup)
- Student dashboard
- Admin dashboard
- Loads static assets (CSS/JS)
##### Apache + PHP Application
- Router is implicit (file-based endpoints)
- Modules:
- `actions/*` (login, signup, logout, get details, update details)
- `student/*`
- `admin/*`
- Shared:
- Session/Auth/RBAC
- DB connector/config
##### MySQL DB
- Users/Auth tables
- Complaints/Feedback tables

Then connect:
- Browser → specific PHP scripts (by name) → DB
- DB → PHP → Browser (HTML render / JSON / redirects)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    Student["Student"]:::actor
    Admin["Admin"]:::actor

    %% Client / Browser
    subgraph "Client Layer (Browser UI)"
        Browser["Web Browser"]:::client

        subgraph "Public Pages (HTML)"
            IndexUI["Public Landing Page (Index UI)"]:::ui
            LoginUI["Login Page (UI)"]:::ui
            SignupUI["Signup Page (UI)"]:::ui
        end

        subgraph "Dashboards (Rendered/Interactive UI)"
            StudentDashUI["Student Dashboard (UI)"]:::ui
            AdminDashUI["Admin Dashboard (UI)"]:::ui
        end

        subgraph "Static Assets"
            Assets["Static Assets (CSS/JS/Images/Fonts)"]:::assets
            ScriptJS["Client-side Script (UI behavior/AJAX)"]:::assets
            CSSAdmin["Admin Dashboard Styling"]:::assets
            CSSIndex["Index Styling"]:::assets
            CSSPopup["Popup Styling"]:::assets
            CSSSubmit["Submission Form Styling"]:::assets
        end
    end

    %% Server / Apache + PHP Monolith
    subgraph "Server Layer (Apache + PHP Monolith)"
        ApachePHP["Apache HTTP Server + PHP Runtime"]:::server

        subgraph "Page Controllers (PHP)"
            StudentDashboard["Student Dashboard (Page Controller)"]:::php
            AdminDashboard["Admin Dashboard (Page Controller)"]:::php
        end

        subgraph "Action Endpoints (Backend Controllers)"
            ActionsDir["Action Endpoints / Backend Controllers"]:::phpmod
            LoginAction["Login Handler"]:::php
            SignupAction["Signup Handler"]:::php
            LogoutAction["Logout Handler"]:::php
            GetComplaintDetails["Get Complaint Details Endpoint"]:::php
            UpdateComplaintDetails["Update Complaint Details Endpoint"]:::php
        end

        subgraph "Cross-cutting Concerns"
            AuthRBAC["Session + Auth + RBAC Gate"]:::security
            DBConfig["DB Configuration Module (config.php from template)"]:::config
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        MySQL[("MySQL Database (campus_feedback_system)")]:::db
        DBSchema["MySQL Schema / Database Script"]:::dbmeta
    end

    %% Documentation
    subgraph "Docs (Non-runtime)"
        Docs["Documentation (flow/reference)"]:::docs
    end

    %% Top-down flow: Actors -> Browser
    Student -->|"uses"| Browser
    Admin -->|"uses"| Browser

    %% Browser loads pages/assets
    Browser -->|"HTTP_GET(HTML)"| IndexUI
    Browser -->|"HTTP_GET(HTML)"| LoginUI
    Browser -->|"HTTP_GET(HTML)"| SignupUI

    Browser -->|"HTTP_GET(CSS/JS/images/fonts)"| Assets
    Assets -->|"loads"| ScriptJS
    Assets -->|"loads"| CSSAdmin
    Assets -->|"loads"| CSSIndex
    Assets -->|"loads"| CSSPopup
    Assets -->|"loads"| CSSSubmit

    %% Browser -> Server runtime (file-based endpoints)
    Browser -->|"HTTP_GET/POST"| ApachePHP

    %% Public auth flows
    LoginUI -->|"HTTP_POST(credentials)"| LoginAction
    SignupUI -->|"HTTP_POST(registration)"| SignupAction
    Browser -->|"HTTP_GET/POST"| LogoutAction

    %% Auth/RBAC gating to protected areas
    ApachePHP -->|"enforces"| AuthRBAC
    AuthRBAC -->|"protects"| StudentDashboard
    AuthRBAC -->|"protects"| AdminDashboard
    AuthRBAC -->|"protects"| ActionsDir

    %% Redirects after login (role-based)
    LoginAction -.->|"redirect(student)"| StudentDashboard
    LoginAction -.->|"redirect(admin)"| AdminDashboard

    %% Logout
    LogoutAction -->|"destroy_session"| AuthRBAC
    LogoutAction -.->|"redirect(login)"| LoginUI

    %% Dashboard navigation (served by PHP pages)
    Browser -->|"HTTP_GET"| StudentDashboard
    Browser -->|"HTTP_GET"| AdminDashboard
    StudentDashboard -->|"renders"| StudentDashUI
    AdminDashboard -->|"renders"| AdminDashUI

    %% Student submission & viewing flow
    StudentDashUI -->|"HTTP_POST(submit_feedback/complaint)"| StudentDashboard
    StudentDashboard -->|"SQL_INSERT(feedback/complaint;prepared_stmt)"| MySQL
    StudentDashboard -->|"SQL_SELECT(own_complaints,status)"| MySQL
    MySQL -->|"result_rows"| StudentDashboard

    %% Admin review/update flow
    AdminDashboard -->|"SQL_SELECT(all_complaints)"| MySQL
    MySQL -->|"result_rows"| AdminDashboard

    %% Optional AJAX/details flow from admin UI
    AdminDashUI -->|"AJAX_GET(details)"| GetComplaintDetails
    GetComplaintDetails -->|"SQL_SELECT(complaint_details)"| MySQL
    MySQL -->|"result_rows"| GetComplaintDetails
    GetComplaintDetails -->|"JSON/HTML_fragment"| AdminDashUI

    AdminDashUI -->|"AJAX_POST(status,response)"| UpdateComplaintDetails
    UpdateComplaintDetails -->|"SQL_UPDATE(status,response)"| MySQL
    MySQL -->|"ack"| UpdateComplaintDetails
    UpdateComplaintDetails -->|"JSON/redirect"| AdminDashUI

    %% DB config usage
    StudentDashboard -->|"includes"| DBConfig
    AdminDashboard -->|"includes"| DBConfig
    LoginAction -->|"includes"| DBConfig
    SignupAction -->|"includes"| DBConfig
    GetComplaintDetails -->|"includes"| DBConfig
    UpdateComplaintDetails -->|"includes"| DBConfig

    DBConfig -->|"connects_to"| MySQL
    DBSchema -.->|"creates_tables"| MySQL

    %% Docs informational
    Docs -.->|"describes"| ApachePHP

    %% Click events (from component_mapping)
    click IndexUI "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/public/index.html"
    click LoginUI "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/public/login_form.html"
    click SignupUI "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/public/sign_up_form.html"

    click Assets "https://github.com/hilal-verse/campus-environment-enhancement-initiative/tree/master/assets/"
    click ScriptJS "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/assets/js/script.js"
    click CSSAdmin "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/assets/css/admin_dashboard.css"
    click CSSIndex "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/assets/css/index.css"
    click CSSPopup "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/assets/css/popup.css"
    click CSSSubmit "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/assets/css/submission_form.css"

    click StudentDashboard "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/student/student_dashboard.php"
    click AdminDashboard "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/admin/admin_dashboard.php"

    click ActionsDir "https://github.com/hilal-verse/campus-environment-enhancement-initiative/tree/master/actions/"
    click LoginAction "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/actions/login_form.php"
    click SignupAction "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/actions/sign_up_form.php"
    click LogoutAction "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/actions/logout.php"
    click GetComplaintDetails "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/actions/get_complaint_details.php"
    click UpdateComplaintDetails "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/actions/update_complaint_details.php"

    click DBConfig "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/config/config.example.php"
    click DBSchema "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/database/campus_feedback_system.sql"
    click Docs "https://github.com/hilal-verse/campus-environment-enhancement-initiative/blob/master/docs/Documentaion.txt"

    %% Styles
    classDef actor fill:#0b1320,stroke:#93c5fd,color:#e5e7eb,stroke-width:1px
    classDef client fill:#1d4ed8,stroke:#93c5fd,color:#ffffff,stroke-width:1px
    classDef ui fill:#2563eb,stroke:#bfdbfe,color:#ffffff,stroke-width:1px
    classDef assets fill:#6d28d9,stroke:#ddd6fe,color:#ffffff,stroke-width:1px

    classDef server fill:#065f46,stroke:#6ee7b7,color:#ecfdf5,stroke-width:1px
    classDef php fill:#16a34a,stroke:#86efac,color:#052e16,stroke-width:1px
    classDef phpmod fill:#15803d,stroke:#86efac,color:#ecfdf5,stroke-width:1px

    classDef security fill:#f59e0b,stroke:#fcd34d,color:#111827,stroke-width:1px
    classDef config fill:#10b981,stroke:#6ee7b7,color:#052e16,stroke-width:1px

    classDef db fill:#374151,stroke:#9ca3af,color:#f9fafb,stroke-width:1px
    classDef dbmeta fill:#4b5563,stroke:#9ca3af,color:#f9fafb,stroke-width:1px

    classDef docs fill:#64748b,stroke:#cbd5e1,color:#f8fafc,stroke-width:1px
```
