# divyanka-20/pg_life architecture

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

- Interactive diagram: https://gitdiagram.com/divyanka-20/pg_life
- Repository: https://github.com/divyanka-20/pg_life

## Overview

##### Project type and purpose
- This is a monolithic, PHP-based web application (“PG_Life”) for browsing and managing property listings.
- Users can view property lists, details, and mark properties as “interested.” There is also a dashboard for authenticated users.

##### File structure
- Top level:
- index.php, property_list.php, property_detail.php, dashboard.php, logout.php
- api/ (AJAX endpoints for login, signup, toggling interest, dashboard data)
- includes/ (shared PHP fragments: header, footer, DB connect, modals)
- css/ and js/ (static front-end assets)
- img/ (property and amenity images)
- The “api” scripts handle JSON requests from the JS layer, while the PHP pages render HTML.
- There’s a database connection abstraction in includes/database_connect*.php (likely MySQL).

##### README
- The README only gives the project name “PG_Life.” Details must be inferred from the code layout.

##### Be detailed but concise
- Distinct module (page, API script, include, asset directory) in grouped components.
- Data flows and dependencies are shown so that a newcomer immediately grasps how requests travel through the system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        classDef frontend fill:#AEDFF7,stroke:#036897,color:#036897
        Browser["Web Browser"]:::frontend

        subgraph "Web Pages (Page Renderer)"
            index["index.php"]:::frontend
            property_list["property_list.php"]:::frontend
            property_detail["property_detail.php"]:::frontend
            dashboard["dashboard.php"]:::frontend
            logout["logout.php"]:::frontend
        end

        subgraph "Static Assets"
            css_common["css/common.css"]:::frontend
            css_index["css/index.css"]:::frontend
            css_property_list["css/property_list.css"]:::frontend
            css_property_detail["css/property_detail.css"]:::frontend
            css_dashboard["css/dashboard.css"]:::frontend
            js_jquery["js/jquery.js"]:::frontend
            js_common["js/common.js"]:::frontend
            js_property_list["js/property_list.js"]:::frontend
            js_property_detail["js/property_detail.js"]:::frontend
            js_dashboard["js/dashboard.js"]:::frontend
            img_properties["img/properties/"]:::frontend
            img_amenities["img/amenities/"]:::frontend
            img_shared["img/images/"]:::frontend
        end
    end

    %% Application Server
    subgraph "Application Server (PHP)"
        classDef backend fill:#C8E6C9,stroke:#2E7D32,color:#2E7D32
        subgraph "Page Renderer"
            index_php["index.php"]:::backend
            proplist_php["property_list.php"]:::backend
            propdetail_php["property_detail.php"]:::backend
            dash_php["dashboard.php"]:::backend
            logout_php["logout.php"]:::backend
        end

        subgraph "API Controllers"
            login_submit["api/login_submit.php"]:::backend
            signup_submit["api/signup_submit.php"]:::backend
            toggle_interested["api/toggle_interested.php"]:::backend
            handle_dashboard["api/handle_intersted_dashboard.php"]:::backend
        end

        subgraph "Shared Includes"
            header["includes/header.php"]:::backend
            footer["includes/footer.php"]:::backend
            login_modal["includes/login_modal.php"]:::backend
            signup_modal["includes/signup_modal.php"]:::backend
            db_connect["includes/database_connect.php"]:::backend
            db_connect_hide["includes/database_connect_hide_error.php"]:::backend
        end
    end

    %% Data Layer
    classDef data fill:#FFE0B2,stroke:#EF6C00,color:#EF6C00
    Database["Database (MySQL)"]:::data

    classDef storage fill:#E0E0E0,stroke:#616161,color:#424242
    FileStorage["File Storage (Images)"]:::storage

    %% Relationships
    Browser -->|HTTP GET| index
    Browser -->|HTTP GET| property_list
    Browser -->|HTTP GET| property_detail
    Browser -->|HTTP GET| dashboard
    Browser -->|HTTP GET| logout

    Browser -->|Load CSS/JS/Images| css_common
    css_common -->|depends| js_common
    Browser --> css_index
    Browser --> css_property_list
    Browser --> css_property_detail
    Browser --> css_dashboard
    Browser --> js_jquery
    Browser --> js_common
    Browser --> js_property_list
    Browser --> js_property_detail
    Browser --> js_dashboard
    Browser --> img_properties
    Browser --> img_amenities
    Browser --> img_shared

    Browser -->|AJAX POST| login_submit
    Browser -->|AJAX POST| signup_submit
    Browser -->|AJAX POST| toggle_interested
    Browser -->|AJAX GET| handle_dashboard

    index -->|include| header
    index -->|include| footer
    index -->|include| db_connect
    property_list -->|include| header
    property_list -->|include| footer
    property_list -->|include| db_connect
    property_detail -->|include| header
    property_detail -->|include| footer
    property_detail -->|include| db_connect
    dashboard -->|include| header
    dashboard -->|include| footer
    dashboard -->|include| db_connect
    logout -->|include| header
    logout -->|include| footer
    logout -->|include| db_connect

    login_submit -->|uses| db_connect
    signup_submit -->|uses| db_connect
    toggle_interested -->|uses| db_connect
    handle_dashboard -->|uses| db_connect

    login_submit -->|queries| Database
    signup_submit -->|queries| Database
    toggle_interested -->|updates| Database
    handle_dashboard -->|queries| Database

    index -->|queries| Database
    property_list -->|queries| Database
    property_detail -->|queries| Database
    dashboard -->|queries| Database

    index -->|reads| FileStorage
    property_list -->|reads| FileStorage
    property_detail -->|reads| FileStorage
    dashboard -->|reads| FileStorage

    %% Click Events
    click index "https://github.com/divyanka-20/pg_life/blob/main/index.php"
    click property_list "https://github.com/divyanka-20/pg_life/blob/main/property_list.php"
    click property_detail "https://github.com/divyanka-20/pg_life/blob/main/property_detail.php"
    click dashboard "https://github.com/divyanka-20/pg_life/blob/main/dashboard.php"
    click logout "https://github.com/divyanka-20/pg_life/blob/main/logout.php"
    click login_submit "https://github.com/divyanka-20/pg_life/blob/main/api/login_submit.php"
    click signup_submit "https://github.com/divyanka-20/pg_life/blob/main/api/signup_submit.php"
    click toggle_interested "https://github.com/divyanka-20/pg_life/blob/main/api/toggle_interested.php"
    click handle_dashboard "https://github.com/divyanka-20/pg_life/blob/main/api/handle_intersted_dashboard.php"
    click header "https://github.com/divyanka-20/pg_life/blob/main/includes/header.php"
    click footer "https://github.com/divyanka-20/pg_life/blob/main/includes/footer.php"
    click login_modal "https://github.com/divyanka-20/pg_life/blob/main/includes/login_modal.php"
    click signup_modal "https://github.com/divyanka-20/pg_life/blob/main/includes/signup_modal.php"
    click db_connect "https://github.com/divyanka-20/pg_life/blob/main/includes/database_connect.php"
    click db_connect_hide "https://github.com/divyanka-20/pg_life/blob/main/includes/database_connect_hide_error.php"
    click css_common "https://github.com/divyanka-20/pg_life/blob/main/css/common.css"
    click css_index "https://github.com/divyanka-20/pg_life/blob/main/css/index.css"
    click css_property_list "https://github.com/divyanka-20/pg_life/blob/main/css/property_list.css"
    click css_property_detail "https://github.com/divyanka-20/pg_life/blob/main/css/property_detail.css"
    click css_dashboard "https://github.com/divyanka-20/pg_life/blob/main/css/dashboard.css"
    click js_jquery "https://github.com/divyanka-20/pg_life/blob/main/js/jquery.js"
    click js_common "https://github.com/divyanka-20/pg_life/blob/main/js/common.js"
    click js_property_list "https://github.com/divyanka-20/pg_life/blob/main/js/property_list.js"
    click js_property_detail "https://github.com/divyanka-20/pg_life/blob/main/js/property_detail.js"
    click js_dashboard "https://github.com/divyanka-20/pg_life/blob/main/js/dashboard.js"
    click img_properties "https://github.com/divyanka-20/pg_life/tree/main/img/properties/"
    click img_amenities "https://github.com/divyanka-20/pg_life/tree/main/img/amenities/"
    click img_shared "https://github.com/divyanka-20/pg_life/tree/main/img/images/"

    %% Styles
    class Browser,css_common,css_index,css_property_list,css_property_detail,css_dashboard,js_jquery,js_common,js_property_list,js_property_detail,js_dashboard,img_properties,img_amenities,img_shared frontend
    class index_php,proplist_php,propdetail_php,dash_php,logout_php,login_submit,signup_submit,toggle_interested,handle_dashboard,header,footer,login_modal,signup_modal,db_connect,db_connect_hide backend
    class Database data
    class FileStorage storage
```
