# tramyardg/hotel-mgmt-system architecture

> Architecture diagram of the GitHub repository tramyardg/hotel-mgmt-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tramyardg/hotel-mgmt-system
- Repository: https://github.com/tramyardg/hotel-mgmt-system

## Overview

#### Purpose and runtime
A server-rendered PHP hotel management system for customer registration, login/profile management, room reservation, and administrator reservation management. It runs behind a PHP-capable web server (the README suggests XAMPP) with MySQL. Database setup/data are provided in `hotel.sql`; an alternate schema artifact exists at `db/schema.sql`.

#### HTTP entry points and page flow
Public PHP pages are the application’s HTTP entry points: `index.php` presents the customer-facing site; `register.php`, `login.php`, and `sign-in.php` support authentication; `admin.php` is the administrative landing page. Form POSTs are routed directly to procedural endpoint scripts rather than a central router, notably `app/process_registration.php`, `app/process_login.php`, `app/process_reservation.php`, and `app/process_update_profile.php`. Logout is handled by `app/process_logout.php`.

#### Persistence boundary
`app/DB.php` centralizes MySQL connection/configuration and is the boundary between application code and the hotel database. SQL access is organized into DAO classes: `app/dao/CustomerDAO.php`, `app/dao/BookingReservationDAO.php`, and `app/dao/BookingDetailDAO.php`; administrator-specific reads/updates use `app/dao/AdminDAO.php`. These DAOs mediate the core customer, reservation, booking-detail, and admin data tables defined by `hotel.sql`.

#### Domain model layer
PHP model objects represent core business entities and state: `app/models/Customer.php`, `app/models/Reservation.php`, `app/models/Booking.php`, and `app/models/Pricing.php`. Reservation/business status and requirements are constrained through `app/models/StatusEnum.php` and `app/models/RequirementEnum.php`. This separates record/domain representation from DAO persistence and endpoint handling.

#### Application service/handler layer
Handlers coordinate request-facing workflows with DAOs and models: `app/handlers/CustomerHandler.php` manages customer operations, `app/handlers/BookingReservationHandler.php` drives reservation workflows, and `app/handlers/BookingDetailHandler.php` manages booking detail behavior. `app/handlers/AdminHandler.php` provides the admin-facing orchestration used by reservation management. The expected control path is page/form → `process_*.php` endpoint → handler → DAO/DB → redirect or server-rendered response.

#### Customer and administrator boundaries
Customer capabilities include account creation, authenticated access, profile updates, room pricing/reservation submission, and viewing bookings. Administrative authority is represented by the customer `isadmin` database field per the README, with admin UI and management actions isolated in `admin.php` and `app/admin/manage_reservation.php`. This is an application-level authorization boundary rather than a separate admin service.

#### Client assets and dependencies
Browser-side behavior supports form submission and multistep reservation interaction through `js/form-submission.js` and `js/multiStepsRsvn.js`; admin interactions use `js/admin.js`. Styling is in `css/main.css`. PHP dependencies are installed through `composer.json`, while legacy/local password hashing code is bundled in `lib/phpPasswordHashing/passwordLib.php` and `lib/phpPasswordHashing/passwordLibClass.php`. JavaScript dependencies are managed through `package.json`.

Main entry points: [`app/handlers/CustomerHandler.php`](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/CustomerHandler.php) (Customer handler), [`app/DB.php`](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/DB.php) (MySQL connection), [`index.php`](https://github.com/tramyardg/hotel-mgmt-system/blob/master/index.php) (Customer pages), [`app/handlers/BookingReservationHandler.php`](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/BookingReservationHandler.php) (Reservation handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_customer_pages["Customer pages<br/>PHP pages<br/>[index.php]"]
  node_auth_pages["Auth pages<br/>PHP pages<br/>[login.php]"]
  node_admin_page["Admin landing<br/>PHP page<br/>[admin.php]"]
  node_customer_assets["Customer browser assets<br/>JavaScript/CSS<br/>[form-submission.js]"]
  node_admin_assets["Admin browser assets<br/>JavaScript<br/>[admin.js]"]
end

subgraph group_app["PHP application"]
  node_auth_endpoints["Auth endpoints<br/>procedural PHP<br/>[process_login.php]"]
  node_reservation_endpoint["Reservation endpoint<br/>procedural PHP"]
  node_admin_management["Reservation management<br/>admin PHP action"]
  node_customer_handler["Customer handler"]
  node_reservation_handler["Reservation handlers"]
  node_admin_handler["Admin handler<br/>[AdminHandler.php]"]
  node_domain_models["Domain models<br/>PHP models<br/>[Reservation.php]"]
  node_password_library["Password hashing<br/>local library<br/>[passwordLib.php]"]
end

subgraph group_data["Persistence"]
  node_customer_dao["Customer DAO<br/>[CustomerDAO.php]"]
  node_reservation_dao["Reservation DAOs"]
  node_admin_dao["Admin DAO<br/>[AdminDAO.php]"]
  node_db_connection[("MySQL connection<br/>database boundary<br/>[DB.php]")]
  node_hotel_database[("Hotel database<br/>MySQL schema/data<br/>[hotel.sql]")]
end

node_customer_assets -->|"enhances forms"| node_customer_pages
node_admin_assets -->|"supports admin UI"| node_admin_page
node_customer_pages -->|"POSTs account actions"| node_auth_endpoints
node_auth_pages -->|"submits credentials"| node_auth_endpoints
node_customer_pages -->|"submits reservation"| node_reservation_endpoint
node_admin_page -->|"manages reservations"| node_admin_management
node_auth_endpoints -->|"delegates"| node_customer_handler
node_reservation_endpoint -->|"delegates"| node_reservation_handler
node_admin_management -->|"delegates"| node_admin_handler
node_customer_handler -->|"uses"| node_domain_models
node_reservation_handler -->|"uses"| node_domain_models
node_customer_handler -->|"hashes passwords"| node_password_library
node_customer_handler -->|"persists customers"| node_customer_dao
node_reservation_handler -->|"persists bookings"| node_reservation_dao
node_admin_handler -->|"reads and updates"| node_admin_dao
node_customer_dao -->|"uses"| node_db_connection
node_reservation_dao -->|"uses"| node_db_connection
node_admin_dao -->|"uses"| node_db_connection
node_db_connection -->|"connects to"| node_hotel_database

click node_customer_pages "https://github.com/tramyardg/hotel-mgmt-system/blob/master/index.php"
click node_auth_pages "https://github.com/tramyardg/hotel-mgmt-system/blob/master/login.php"
click node_admin_page "https://github.com/tramyardg/hotel-mgmt-system/blob/master/admin.php"
click node_customer_assets "https://github.com/tramyardg/hotel-mgmt-system/blob/master/js/form-submission.js"
click node_admin_assets "https://github.com/tramyardg/hotel-mgmt-system/blob/master/js/admin.js"
click node_auth_endpoints "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/process_login.php"
click node_reservation_endpoint "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/process_reservation.php"
click node_admin_management "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/admin/manage_reservation.php"
click node_customer_handler "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/CustomerHandler.php"
click node_reservation_handler "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/BookingReservationHandler.php"
click node_admin_handler "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/AdminHandler.php"
click node_domain_models "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/models/Reservation.php"
click node_password_library "https://github.com/tramyardg/hotel-mgmt-system/blob/master/lib/phpPasswordHashing/passwordLib.php"
click node_customer_dao "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/dao/CustomerDAO.php"
click node_reservation_dao "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/dao/BookingReservationDAO.php"
click node_admin_dao "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/dao/AdminDAO.php"
click node_db_connection "https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/DB.php"
click node_hotel_database "https://github.com/tramyardg/hotel-mgmt-system/blob/master/hotel.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_customer_pages,node_auth_pages,node_admin_page,node_customer_assets,node_admin_assets toneBlue
class node_auth_endpoints,node_reservation_endpoint,node_admin_management,node_customer_handler,node_reservation_handler,node_admin_handler,node_domain_models,node_password_library toneAmber
class node_customer_dao,node_reservation_dao,node_admin_dao,node_db_connection,node_hotel_database toneMint
```

## Components

### Web interface

- [Customer pages](https://github.com/tramyardg/hotel-mgmt-system/blob/master/index.php): PHP pages · Registration, login, profile, and reservation views. · `index.php`
- [Auth pages](https://github.com/tramyardg/hotel-mgmt-system/blob/master/login.php): PHP pages · `login.php`
- [Admin landing](https://github.com/tramyardg/hotel-mgmt-system/blob/master/admin.php): PHP page · `admin.php`
- [Customer browser assets](https://github.com/tramyardg/hotel-mgmt-system/blob/master/js/form-submission.js): JavaScript/CSS · Form and multistep reservation behavior. · `js/form-submission.js`
- [Admin browser assets](https://github.com/tramyardg/hotel-mgmt-system/blob/master/js/admin.js): JavaScript · `js/admin.js`

### PHP application

- [Auth endpoints](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/process_login.php): procedural PHP · Registration, login, profile update, and logout actions. · `app/process_login.php`
- [Reservation endpoint](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/process_reservation.php): procedural PHP · `app/process_reservation.php`
- [Reservation management](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/admin/manage_reservation.php): admin PHP action · `app/admin/manage_reservation.php`
- [Customer handler](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/CustomerHandler.php): handler · `app/handlers/CustomerHandler.php`
- [Reservation handlers](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/BookingReservationHandler.php): handlers · Coordinates reservation and booking-detail workflows. · `app/handlers/BookingReservationHandler.php`
- [Admin handler](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/handlers/AdminHandler.php): handler · `app/handlers/AdminHandler.php`
- [Domain models](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/models/Reservation.php): PHP models · Customer, reservation, booking, pricing, status, and requirements. · `app/models/Reservation.php`
- [Password hashing](https://github.com/tramyardg/hotel-mgmt-system/blob/master/lib/phpPasswordHashing/passwordLib.php): local library · `lib/phpPasswordHashing/passwordLib.php`

### Persistence

- [Customer DAO](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/dao/CustomerDAO.php): DAO · `app/dao/CustomerDAO.php`
- [Reservation DAOs](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/dao/BookingReservationDAO.php): DAOs · Reservation and booking-detail persistence. · `app/dao/BookingReservationDAO.php`
- [Admin DAO](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/dao/AdminDAO.php): DAO · `app/dao/AdminDAO.php`
- [MySQL connection](https://github.com/tramyardg/hotel-mgmt-system/blob/master/app/DB.php): database boundary · `app/DB.php`
- [Hotel database](https://github.com/tramyardg/hotel-mgmt-system/blob/master/hotel.sql): MySQL schema/data · Includes customer isadmin authorization field. · `hotel.sql`

## Connections

- Customer browser assets → Customer pages: enhances forms
- Admin browser assets → Admin landing: supports admin UI
- Customer pages → Auth endpoints: POSTs account actions
- Auth pages → Auth endpoints: submits credentials
- Customer pages → Reservation endpoint: submits reservation
- Admin landing → Reservation management: manages reservations
- Auth endpoints → Customer handler: delegates
- Reservation endpoint → Reservation handlers: delegates
- Reservation management → Admin handler: delegates
- Customer handler → Domain models: uses
- Reservation handlers → Domain models: uses
- Customer handler → Password hashing: hashes passwords
- Customer handler → Customer DAO: persists customers
- Reservation handlers → Reservation DAOs: persists bookings
- Admin handler → Admin DAO: reads and updates
- Customer DAO → MySQL connection: uses
- Reservation DAOs → MySQL connection: uses
- Admin DAO → MySQL connection: uses
- MySQL connection → Hotel database: connects to
