# khotchaitanya/cleantrack-waste-reporting-system-php architecture

> Architecture diagram of the GitHub repository khotchaitanya/cleantrack-waste-reporting-system-php, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khotchaitanya/cleantrack-waste-reporting-system-php
- Repository: https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php

## Overview

##### Project Type and Purpose
- CleanTrack is a small-scale full-stack web application (a monolithic LAMP/WAMP stack) for citizen waste reporting.
- Purpose: Allow public users to submit garbage-related issues, view existing reports, and enable administrators to manage and resolve them.

##### File Structure Analysis
- index.html: Public-facing form UI
- style.css: Shared styling for all pages
- submit.php: Endpoint handling new report submissions
- view_reports.php: Public dashboard showing all reports
- admin.php: Admin dashboard listing all issues
- update_status.php: Endpoint to mark a report resolved
- db.php: Centralized database connection logic
- README.md / LICENSE: Documentation and licensing

##### README Insights
- Technologies: PHP (server-side logic), MySQL (data store), HTML5/CSS3 (UI), WAMP/XAMPP (local hosting)
- No external JS frameworks or microservices—this is a single-tier server-rendered app
- Key features: form submission, auto-generated report IDs, admin resolution flow, public viewing

a. Main Components
- Client Browser (User)
- Web Server (Apache under WAMP/XAMPP)
- PHP Application Layer (.php scripts & db.php)
- MySQL Database
- Optional: phpMyAdmin (DB administration)
b. Relationships & Data Flow
1. User loads index.html ← style.css
2. User submits form → submit.php → db.php → MySQL INSERT
3. submit.php → User (success + Report ID)
4. Public viewer → view_reports.php → db.php → MySQL SELECT → JSON/HTML table → User
5. Admin → admin.php → db.php → MySQL SELECT → User
6. Admin marks resolved → update_status.php → db.php → MySQL UPDATE
c. Architectural Patterns
- Monolithic LAMP‐style
- Server-side rendering (no client-side MV* framework)
- Simple MVC hints:
- Models: db.php + MySQL tables
- Views: index.html, styled PHP templates embedded in admin.php/view_reports.php
- Controllers: submit.php, update_status.php
d. Key Technologies
- PHP scripts for business logic & routing
- MySQL for persistence
- HTML/CSS for UI
- WAMP/XAMPP for local hosting environment

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Client["Client Browser"]:::presentation
        Index["index.html"]:::presentation
        CSS["style.css"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        Submit["submit.php"]:::application
        ViewReports["view_reports.php"]:::application
        AdminDash["admin.php"]:::application
        UpdateStatus["update_status.php"]:::application
        DBConn["db.php"]:::application
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        MySQL["MySQL Database"]:::data
        PMA["phpMyAdmin (Optional)"]:::external
    end

    %% Client to Presentation
    Client -->|"GET /index.html"| Index
    Index -->|"Loads CSS"| CSS

    %% Submission Flow
    Client -->|"POST /submit"| Submit
    Submit -->|"includes db.php"| DBConn
    DBConn -->|"INSERT INTO reports"| MySQL
    Submit -->|"Response with Report ID"| Client

    %% Public Reports Flow
    Client -->|"GET /view_reports"| ViewReports
    ViewReports -->|"includes db.php"| DBConn
    DBConn -->|"SELECT * FROM reports"| MySQL
    ViewReports -->|"HTML Table / JSON"| Client

    %% Admin Dashboard Flow
    Client -->|"GET /admin"| AdminDash
    AdminDash -->|"includes db.php"| DBConn
    DBConn -->|"SELECT * FROM reports"| MySQL
    AdminDash -->|"HTML Table"| Client

    %% Update Status Flow
    Client -->|"POST /update_status"| UpdateStatus
    UpdateStatus -->|"includes db.php"| DBConn
    DBConn -->|"UPDATE reports SET status='resolved'"| MySQL
    UpdateStatus -->|"Response"| Client

    %% phpMyAdmin
    PMA -.->|"DB Admin"| MySQL

    %% Click Events
    click Index "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/index.html"
    click CSS "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/style.css"
    click Submit "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/submit.php"
    click ViewReports "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/view_reports.php"
    click AdminDash "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/admin.php"
    click UpdateStatus "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/update_status.php"
    click DBConn "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/db.php"
    click README "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/blob/main/README.md"
    click LICENSE "https://github.com/khotchaitanya/cleantrack-waste-reporting-system-php/tree/main/LICENSE"

    %% Styles
    classDef presentation fill:#B3D1FF,stroke:#333,stroke-width:1px
    classDef application fill:#B3FFC9,stroke:#333,stroke-width:1px
    classDef data fill:#FFD8A8,stroke:#333,stroke-width:1px
    classDef external stroke-dasharray: 5 5,fill:#EEE,stroke:#888,stroke-width:1px
```
