# bigbossa/depmst1 architecture

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

- Interactive diagram: https://gitdiagram.com/bigbossa/depmst1
- Repository: https://github.com/bigbossa/depmst1

## Overview

##### Project type and purpose
- This is a monolithic, full-stack PHP web application (“Dormitory Management System”) whose purpose is to allow administrators, staff, and tenants to manage rooms, bills, maintenance, events, reports, user accounts, and related assets (PDFs, images, etc.).

##### File structure
- Top-level directories:
- admin/     → PHP pages for “admin” workflows (user/room management, billing, utilities, event setup, reports)
- staff/     → PHP pages for “staff” workflows (maintenance, bills, events, reports)
- tenant/    → PHP pages for “tenant” workflows (view bills, request repairs, view reports, dashboard)
- public/    → authentication endpoints (login, register, logout)
- assets/    → static assets (CSS, JS, images) and uploaded Data files (Charter PDFs, Excel)
- config/    → configuration (database connection, session management)
- dormitory_management.sql → database schema dump
- index.php  → likely the home page or router entry point
- product-admin-master/ → packaged HTML/CSS/JS admin template (unused or for prototyping)
- Patterns:
- A simple layered pattern: Presentation (PHP + HTML + assets) → Business logic (PHP scripts under each module directory) → Data access (config/database.php) → MySQL database.
- No microservices; a single codebase.
- Assets folder doubles as a file store for Charter documents and static assets.

##### README for additional insights
- README is empty, so we rely solely on file structure.

##### Elements
- Labels: “Browser”, “Web Server (PHP)”, “MySQL DB”, “File Storage”
- Browser → Web Server: HTTP Requests
- Web Server → DB: SQL Queries
- Web Server ↔ File Storage: Read/Write Files
- Web Server → Browser: HTML/CSS/JS Response

##### Detailed guidance
- Break each major module into subcomponents if needed (e.g., Admin → User Management, Room Management, Billing, Utilities, Events, Reports).
- How session management (config/session.php) feeds into each module for access control.
- Important config files (database.php) as the single point of DB configuration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::external

    subgraph "Web Server (PHP)"
        Index["index.php"]:::server

        subgraph "Auth Module"
            Login["login.php"]:::server
            Register["register.php"]:::server
            Logout["logout.php"]:::server
        end

        subgraph "Admin Module"
            AdminDir["admin/"]:::server
        end

        subgraph "Staff Module"
            StaffDir["staff/"]:::server
        end

        subgraph "Tenant Module"
            TenantDir["tenant/"]:::server
        end

        subgraph "Reporting Service"
            Reports["generate_graph.php"]:::server
        end

        subgraph "Configuration"
            DBConfig["database.php"]:::config
            Session["session.php"]:::config
        end
    end

    Static["Static Assets"]:::static
    FileStorage["File Storage"]:::storage
    DB["MySQL Database"]:::db

    Browser -->|HTTP request| Index
    Index -->|"route request"| Login
    Index -->|"route request"| Register
    Index -->|"route request"| Logout
    Index -->|"route request"| AdminDir
    Index -->|"route request"| StaffDir
    Index -->|"route request"| TenantDir

    Login -->|"uses config"| DBConfig
    Register -->|"uses config"| DBConfig
    Logout -->|"uses config"| Session

    AdminDir -->|"SQL queries"| DBConfig
    StaffDir -->|"SQL queries"| DBConfig
    TenantDir -->|"SQL queries"| DBConfig
    Reports -->|"SQL queries"| DBConfig

    DBConfig -->|"connects to"| DB
    AdminDir -->|"read/write files"| FileStorage
    StaffDir -->|"read/write files"| FileStorage
    TenantDir -->|"read/write files"| FileStorage

    AdminDir -->|"serves assets"| Static
    StaffDir -->|"serves assets"| Static
    TenantDir -->|"serves assets"| Static
    Login -->|"serves assets"| Static
    Register -->|"serves assets"| Static

    subgraph "Responses"
        WebResponse["HTML/CSS/JS Response"]:::server
    end
    AdminDir --> WebResponse
    StaffDir --> WebResponse
    TenantDir --> WebResponse
    Login --> WebResponse
    Register --> WebResponse
    Logout --> WebResponse
    Reports --> WebResponse
    WebResponse -->|HTTP response| Browser

    click Login "https://github.com/bigbossa/depmst1/blob/main/public/login.php"
    click Register "https://github.com/bigbossa/depmst1/blob/main/public/register.php"
    click Logout "https://github.com/bigbossa/depmst1/blob/main/public/logout.php"
    click AdminDir "https://github.com/bigbossa/depmst1/tree/main/admin/"
    click StaffDir "https://github.com/bigbossa/depmst1/tree/main/staff/"
    click TenantDir "https://github.com/bigbossa/depmst1/tree/main/tenant/"
    click Static "https://github.com/bigbossa/depmst1/tree/main/assets/"
    click FileStorage "https://github.com/bigbossa/depmst1/tree/main/assets/Data/file_Charter/"
    click DBConfig "https://github.com/bigbossa/depmst1/blob/main/config/database.php"
    click Session "https://github.com/bigbossa/depmst1/blob/main/config/session.php"
    click Index "https://github.com/bigbossa/depmst1/blob/main/index.php"
    click Reports "https://github.com/bigbossa/depmst1/tree/main/reports/"

    classDef external fill:#f9f,stroke:#333
    classDef server fill:#bbf,stroke:#333
    classDef db fill:#afa,stroke:#333
    classDef storage fill:#fea,stroke:#333
    classDef static fill:#ddd,stroke:#333
    classDef config fill:#cff,stroke:#333
```
