# mrjay090903/online-resort-management architecture

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

- Interactive diagram: https://gitdiagram.com/mrjay090903/online-resort-management
- Repository: https://github.com/mrjay090903/online-resort-management

## Overview

##### Main Components

- Frontend (User Interfaces):
- Customer Interface: Contains pages for room booking, reservations, payment processing, profile management, and feedback (resides in the “customer” directory and includes components like header, footer, sidebar).
- Admin Interface: Includes administrative pages like dashboard, reports, room management, staff management, and notifications (located under the “admin” directory with its own set of components such as header, sidebar, and layout).

- Backend:
- Handlers: A set of PHP files (e.g., login_handler.php, booking_handler.php, payment_handler.php) that process user actions, interact with the database, and handle integration with external services like PayMongo.
- Configuration: The “config” directory holds configuration files (database.php and env.php) to manage environment variables and database connectivity.
- Core Public Files: Such as index.php and other standalone pages like about-us.php.

- Assets & External Resources:
- Assets: Contains images, videos (e.g., videos/bg-vid.mp4), and uploaded files (in the “uploads” directory).
- Node Modules & CSS/JS: The “src” directory along with package.json and other assets handle styling (Tailwind CSS) and client-side JavaScript operations.

- Third-Party Integrations:
- PayMongo API: Used for processing payments securely.
- Composer packages: Managed via composer.json and composer.lock indicate additional PHP libraries and dependencies.

##### Relationships and Interactions

- The user interfaces (customer and admin) interact with the backend by sending HTTP requests to various PHP endpoints.
- Handlers process these requests by performing actions (e.g., user authentication, reservation processing, payment handling), querying/updating the MySQL database, and communicating with third-party services (PayMongo).
- The configuration files ensure the correct environmental settings, including API keys and database credentials, are loaded into the application.
- Frontend assets (CSS, JavaScript) are loaded separately via the “assets” and “src” directories for styling and dynamic behaviors on both customer and admin sides.

##### Architectural Patterns

- Separation of Concerns: The project is structured into distinct directories for admin and customer frontends, backend processing (handlers), and configuration. This modular division reflects clear separation between presentation, business logic, and data layers.
- MVC-like Organization (loosely applied): Although not strictly following the MVC paradigm, the separation into interfaces (views), handlers (controllers), and configuration/data access (model-like) is evident.
- Security Best Practices: Environment variables for sensitive data, input validation in handlers, and session management emphasize secure design.
- Integration with External Services: Payment processing via PayMongo is an important external dependency that must be clearly represented.

- “Authentication & Session Handling” (possibly a subset of handlers)
- “Booking & Reservation Processing”
- “Payment Handling” (highlighting integration with PayMongo)

e. Finally, add a section for “Assets and Static Files” to denote where resources such as images, CSS, and video files are stored.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Client Side
    subgraph "Client Side"
        CB["Customer Browser"]:::frontend
        AB["Admin Browser"]:::frontend
    end

    %% Frontend Components
    subgraph "Frontend Components"
        CI["Customer Interface"]:::frontend
        AI["Admin Interface"]:::frontend
        PF["Core Public Files"]:::frontend
        ASSET["Assets & Static Files"]:::assets
        SS["Styles & Scripts"]:::assets
        TPL["Third-Party Libraries"]:::backend
    end

    %% Server Side
    subgraph "Application Server"
        HC["Handlers/Controllers"]:::backend
        CE["Configuration & Environment"]:::backend
        PH["Payment Handling (PayMongo)"]:::backend
    end

    %% Data Stores and External Services
    DB["Database (MySQL)"]:::database
    EX["PayMongo API"]:::external

    %% Interactions from Client Side to Frontend Components
    CB -->|"loads"| CI
    AB -->|"loads"| AI
    CB -->|"loads"| PF
    AB -->|"loads"| PF

    %% Assets and Styles loaded by Browsers
    CB -->|"loads"| ASSET
    AB -->|"loads"| ASSET
    CB -->|"loads"| SS
    AB -->|"loads"| SS

    %% Frontend sending HTTP requests to Server Side
    CI -->|"HTTP_Request"| HC
    AI -->|"HTTP_Request"| HC
    PF -->|"HTTP_Request"| HC

    %% Backend Internal Interactions
    HC -->|"uses"| CE
    HC -->|"database_query"| DB
    HC -->|"sends_payment"| PH
    PH -->|"API_call"| EX

    %% Third-Party Libraries dependency
    TPL -->|"provides_libraries"| HC

    %% Click Events for Component Mapping
    click CI "https://github.com/mrjay090903/online-resort-management/tree/main/customer/"
    click AI "https://github.com/mrjay090903/online-resort-management/tree/main/admin/"
    click HC "https://github.com/mrjay090903/online-resort-management/tree/main/handlers/"
    click CE "https://github.com/mrjay090903/online-resort-management/tree/main/config/"
    click PF "https://github.com/mrjay090903/online-resort-management/blob/main/index.php"
    click ASSET "https://github.com/mrjay090903/online-resort-management/tree/main/assets/"
    click SS "https://github.com/mrjay090903/online-resort-management/tree/main/src/"
    click TPL "https://github.com/mrjay090903/online-resort-management/blob/main/composer.json"

    %% Styles
    classDef frontend fill:#aedff7,stroke:#333,stroke-width:2px;
    classDef backend fill:#caffbf,stroke:#333,stroke-width:2px;
    classDef database fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef external fill:#ffa500,stroke:#333,stroke-width:2px;
    classDef assets fill:#d1c4e9,stroke:#333,stroke-width:2px;
```
