# prog-amin/hotel-booking-system architecture

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

- Interactive diagram: https://gitdiagram.com/prog-amin/hotel-booking-system
- Repository: https://github.com/prog-amin/hotel-booking-system

## Overview

##### Project Type and Purpose
- This is a monolithic, full-stack web application: a Hotel Booking System written in PHP with a MySQL database and HTML/CSS/JS front end.
- Purpose: allow customers to browse and book rooms, view histories and invoices, and provide staff/admin panels for management, inventory, and reporting.

##### File Structure
- Frontend Pages (HTML/CSS/JS): hindex.html, about.html, contact.html, INVENTORY.HTML
- Authentication (PHP): login.php, signup.php, staffadmission.php
- Booking System (PHP): room_available.php, booking.php, submit_booking.php, room_pref.php, invoice2.php
- History & Reports (PHP): booking_history.php, personal_history.php, preferences_history.php
- Admin Panel (PHP): Emp_index.php, customer_management.php, staff_overtime.php
- Configuration: Db.php (database connection)
- Assets: images/

##### README for Insights
- Tech stack: Apache/PHP backend, HTML5/CSS3/JS front end, MySQL database.
- Database schema: users, rooms, bookings, staff, preferences, invoices.
- Features are grouped by user role (Customer vs. Admin/Staff).

##### Main Components & Their Relationships
a. End-Users (Actors)
- Customer (browser)
- Staff/Admin (browser)
b. Presentation Layer
- Static HTML/CSS/JS pages served by Apache
- Interactive PHP pages handling form inputs
c. Application Layer (PHP Modules)
- Authentication Module
- Booking Module
- History & Reporting Module
- Admin Panel Module
- Configuration Module (Db.php)
d. Data Layer
- MySQL Database (six main tables)
- Assets store (images folder)
e. External Dependencies
- XAMPP/WAMP environment (Apache + MySQL)

Relationship Flow:
Browser → Apache Web Server → PHP Application Modules → MySQL Database
PHP modules read/write to DB and fetch assets from file storage.

##### Architectural Patterns & Design Principles
- Monolithic, layered architecture:
- Presentation → Application → Data
- Separation of concerns: each PHP directory/module handles a distinct feature set.
- Single point of configuration (Db.php).
- Role-based access: user vs. admin pages.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Actors
    Customer["Customer Browser"]:::actor
    Admin["Admin/Staff Browser"]:::actor

    subgraph "Server"
        Apache["Apache Web Server"]:::application
    end

    %% Presentation
    hindex["hindex.html"]:::presentation
    about["about.html"]:::presentation
    contact["contact.html"]:::presentation
    inventory["INVENTORY.HTML"]:::presentation

    %% Authentication Module
    login["login.php"]:::application
    signup["signup.php"]:::application
    staffadmission["staffadmission.php"]:::application

    %% Booking Module
    room_available["room_available.php"]:::application
    room_pref["room_pref.php"]:::application
    booking["booking.php"]:::application
    submit_booking["submit_booking.php"]:::application
    invoice2["invoice2.php"]:::application

    %% History & Reporting Module
    booking_history["booking_history.php"]:::application
    personal_history["personal_history.php"]:::application
    preferences_history["preferences_history.php"]:::application

    %% Admin Panel Module
    emp_index["Emp_index.php"]:::application
    customer_management["customer_management.php"]:::application
    staff_overtime["staff_overtime.php"]:::application

    %% Configuration Module
    dbconfig["Db.php"]:::application

    %% Data and Assets
    DB[(MySQL Database)]:::data
    Assets["images/"]:::assets

    %% Connections
    Customer -->|"HTTP Request"| Apache
    Admin -->|"HTTP Request"| Apache

    Apache -->|"Serves"| hindex
    Apache -->|"Serves"| about
    Apache -->|"Serves"| contact
    Apache -->|"Serves"| inventory

    Apache -->|"Serves"| login
    Apache -->|"Serves"| signup
    Apache -->|"Serves"| staffadmission

    Apache -->|"Serves"| room_available
    Apache -->|"Serves"| room_pref
    Apache -->|"Serves"| booking
    Apache -->|"Serves"| submit_booking
    Apache -->|"Serves"| invoice2

    Apache -->|"Serves"| booking_history
    Apache -->|"Serves"| personal_history
    Apache -->|"Serves"| preferences_history

    Apache -->|"Serves"| emp_index
    Apache -->|"Serves"| customer_management
    Apache -->|"Serves"| staff_overtime

    Apache -->|"Includes"| dbconfig

    %% PHP to DB
    login -->|"SQL Query"| DB
    signup -->|"SQL Query"| DB
    staffadmission -->|"SQL Query"| DB

    room_available -->|"SQL Query"| DB
    room_pref -->|"SQL Query"| DB
    booking -->|"SQL Query"| DB
    submit_booking -->|"SQL Query"| DB
    invoice2 -->|"SQL Query"| DB

    booking_history -->|"SQL Query"| DB
    personal_history -->|"SQL Query"| DB
    preferences_history -->|"SQL Query"| DB

    emp_index -->|"SQL Query"| DB
    customer_management -->|"SQL Query"| DB
    staff_overtime -->|"SQL Query"| DB

    dbconfig -->|"DB Connection"| DB

    %% Fetch Assets
    hindex -->|"Fetch Image"| Assets
    about -->|"Fetch Image"| Assets
    contact -->|"Fetch Image"| Assets
    inventory -->|"Fetch Image"| Assets

    login -->|"Fetch Image"| Assets
    signup -->|"Fetch Image"| Assets
    staffadmission -->|"Fetch Image"| Assets
    room_available -->|"Fetch Image"| Assets
    room_pref -->|"Fetch Image"| Assets
    booking -->|"Fetch Image"| Assets
    submit_booking -->|"Fetch Image"| Assets
    invoice2 -->|"Fetch Image"| Assets
    booking_history -->|"Fetch Image"| Assets
    personal_history -->|"Fetch Image"| Assets
    preferences_history -->|"Fetch Image"| Assets
    emp_index -->|"Fetch Image"| Assets
    customer_management -->|"Fetch Image"| Assets
    staff_overtime -->|"Fetch Image"| Assets

    %% Click Events
    click dbconfig "https://github.com/prog-amin/hotel-booking-system/blob/main/Db.php"
    click hindex "https://github.com/prog-amin/hotel-booking-system/blob/main/hindex.html"
    click about "https://github.com/prog-amin/hotel-booking-system/blob/main/about.html"
    click contact "https://github.com/prog-amin/hotel-booking-system/blob/main/contact.html"
    click inventory "https://github.com/prog-amin/hotel-booking-system/blob/main/INVENTORY.HTML"
    click login "https://github.com/prog-amin/hotel-booking-system/blob/main/login.php"
    click signup "https://github.com/prog-amin/hotel-booking-system/blob/main/signup.php"
    click staffadmission "https://github.com/prog-amin/hotel-booking-system/blob/main/staffadmission.php"
    click room_available "https://github.com/prog-amin/hotel-booking-system/blob/main/room_available.php"
    click room_pref "https://github.com/prog-amin/hotel-booking-system/blob/main/room_pref.php"
    click booking "https://github.com/prog-amin/hotel-booking-system/blob/main/booking.php"
    click submit_booking "https://github.com/prog-amin/hotel-booking-system/blob/main/submit_booking.php"
    click invoice2 "https://github.com/prog-amin/hotel-booking-system/blob/main/invoice2.php"
    click booking_history "https://github.com/prog-amin/hotel-booking-system/blob/main/booking_history.php"
    click personal_history "https://github.com/prog-amin/hotel-booking-system/blob/main/personal_history.php"
    click preferences_history "https://github.com/prog-amin/hotel-booking-system/blob/main/preferences_history.php"
    click emp_index "https://github.com/prog-amin/hotel-booking-system/blob/main/Emp_index.php"
    click customer_management "https://github.com/prog-amin/hotel-booking-system/blob/main/customer_management.php"
    click staff_overtime "https://github.com/prog-amin/hotel-booking-system/blob/main/staff_overtime.php"
    click Assets "https://github.com/prog-amin/hotel-booking-system/tree/main/images/"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#000
    classDef application fill:#90EE90,stroke:#000
    classDef data fill:#FFA500,stroke:#000
    classDef assets fill:#D3D3D3,stroke:#000
    classDef actor fill:#CCE5FF,stroke:#000
```
