# radom12/dbms-apartment-management-system-project architecture

> Architecture diagram of the GitHub repository radom12/dbms-apartment-management-system-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/radom12/dbms-apartment-management-system-project
- Repository: https://github.com/radom12/dbms-apartment-management-system-project

## Overview

##### Project Type & Purpose
- This is a full-stack web application for an apartment management system.
- It handles multiple user roles (Admin, Employee, Owner, Tenant) with each role having a different set of functionalities (e.g., login, dashboard, management of complaints, parking slots, tenant/employee/room management, etc.).
- The system is built using PHP for the server-side logic, MySQL for the database layer, and HTML/CSS/JavaScript for the frontend.

##### Analyzing the File Structure
- The top-level directories (Admin, Employee, Owner, Tenant) represent different modules or user roles with their individual PHP files for login, dashboard, and specific actions.
- There are also general files and configuration elements:
- config.php: Likely handles the common settings (like database connection).
- apartment_management(1).sql: Specifies the database schema.
- CSS/JS files (sidebar.css, sidebar.html, sidebar.js, images folder) manage the frontend side.
- Common pages like index.html, login.html showcase the landing pages and user authentication.

##### Key Architectural Components
a. User Interfaces (Presentation Layer):
- Separate frontend entry points for each user type: Admin, Employee, Tenant, and Owner (even if merged, still part of the project).
- Shared design elements such as sidebar components and general HTML templates (index.html, login.html).

b. Business Logic & Controller Layer:
- Each role’s directory houses the application logic for that particular user (e.g., Admin/admin_dashboard.php, Tenant/tenant_dashboard.php, etc.).
- Common functionalities like complaint management, parking slot allotment, and fee management should be highlighted.
- Config.php as a central configuration file which is used by various components.

c. Data Access Layer:
- MySQL Database is central. Represent it as a separate component connected via:
- SQL file (apartment_management(1).sql) — the database schema.
- PHP scripts that handle data queries (possibly in the Admin, Employee, Tenant, and Owner directories).

d. External Services:
- PHP Mailer is mentioned in the README for handling emails. Include it as an external service component integrated with the system.

##### Relationships & Interactions
- User requests entering from the browser that connect to a respective login page (Admin login, Employee login, etc.).
- Once authenticated, direct users to their respective dashboard pages.
- A connection from the PHP logic to the PHP Mailer service for sending emails.
- Inter-module communications if, for example, an Admin creates/updates an Owner or Tenant record; illustrate these dependencies.

##### Architectural Patterns & Design Principles
- MVC-Like Separation: Although not strictly following a framework, there is a separation between the presentation (HTML/CSS/JS frontends), business logic (PHP scripts in each directory), and data access layer (MySQL).
- Role-Based Access: Different modules for Admin, Employee, Owner, and Tenant ensure separation of concerns by user role.
- Modularity: The clear separation into directories signifies modularity; each user type’s functionalities are isolated.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        A["Client (Browser)"]:::frontend
        IndexUI["index.html"]:::frontend
        LoginUI["login.html"]:::frontend
        SidebarHtml["sidebar.html"]:::frontend
        SidebarCss["sidebar.css"]:::frontend
        SidebarJs["sidebar.js"]:::frontend
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        AdminModule["Admin Module"]:::backend
        EmployeeModule["Employee Module"]:::backend
        TenantModule["Tenant Module"]:::backend
        OwnerModule["Owner Module (Legacy)"]:::backend
        Config["Configuration (config.php)"]:::backend
    end

    %% Data and External Services
    subgraph "Data & External Services"
        Database["MySQL Database"]:::database
        ExternalServices["PHP Mailer"]:::external
    end

    %% Connections in Presentation Layer
    A -->|"load"| IndexUI
    IndexUI -->|"navigate"| LoginUI

    %% Connections from Login to Business Logic Modules
    LoginUI -->|"login"| AdminModule
    LoginUI -->|"login"| EmployeeModule
    LoginUI -->|"login"| TenantModule
    LoginUI -->|"login"| OwnerModule

    %% Business Logic interactions with Configuration and Database
    AdminModule -->|"uses"| Config
    EmployeeModule -->|"uses"| Config
    TenantModule -->|"uses"| Config
    OwnerModule -->|"uses"| Config

    Config -->|"DB_connect"| Database

    AdminModule -->|"query"| Database
    EmployeeModule -->|"query"| Database
    TenantModule -->|"query"| Database
    OwnerModule -->|"query"| Database

    %% External Email Service Interaction
    EmployeeModule -->|"sendEmail"| ExternalServices

    %% Click Events
    click AdminModule "https://github.com/radom12/dbms-apartment-management-system-project/tree/main/Admin/"
    click EmployeeModule "https://github.com/radom12/dbms-apartment-management-system-project/tree/main/Employee/"
    click TenantModule "https://github.com/radom12/dbms-apartment-management-system-project/tree/main/Tenant/"
    click OwnerModule "https://github.com/radom12/dbms-apartment-management-system-project/tree/main/Owner/"
    click Config "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/config.php"
    click Database "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/apartment_management(1).sql"
    click IndexUI "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/index.html"
    click LoginUI "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/login.html"
    click SidebarHtml "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/sidebar.html"
    click SidebarCss "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/sidebar.css"
    click SidebarJs "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/sidebar.js"
    click ExternalServices "https://github.com/radom12/dbms-apartment-management-system-project/blob/main/Employee/sendemail.php"

    %% Styles
    classDef frontend fill:#ADD8E6, stroke:#000, stroke-width:2px;
    classDef backend fill:#90EE90, stroke:#000, stroke-width:2px;
    classDef database fill:#F4A460, stroke:#000, stroke-width:2px;
    classDef external fill:#FFB6C1, stroke:#000, stroke-width:2px;
```
