# zmingwww/hotel-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/zmingwww/hotel-management-system
- Repository: https://github.com/zmingwww/hotel-management-system

## Overview

1. **Overall shape**
   - This is a **single Laravel 12 application** for a hotel management system.
   - It is a **monolithic server-rendered web app** with a MySQL-backed data layer, plus a small set of **API/XML export endpoints** and static/XSLT presentation pages.

2. **Primary runtime boundary**
   - The core runtime is **PHP/Laravel**.
   - Requests enter through Laravel routes and are handled by controllers/views inside the app.
   - The app is started locally with `php artisan serve`, while front-end assets are built/served via **Vite** (`npm run dev`).

3. **Data storage layer**
   - The system uses **MySQL** as its main database.
   - `hms.sql` is the supplied schema/data seed file, and the README also expects migrations plus an admin seeder.
   - Session state can be stored in the **database session driver**, which is important because the app explicitly relies on session persistence and expiration behavior.

4. **User-facing application flow**
   - There are two browser-facing entry points:
     - **User panel** at `/`
     - **Admin panel** at `/admin/login`
   - The README recommends using separate browsers to avoid session conflicts, which suggests the admin/user experiences are session-isolated but still share the same application backend.

5. **Admin management subsystem**
   - The admin side is used to manage hotel entities such as **room types** and likely bookings/payments/users through authenticated CRUD screens.
   - A notable content-management path is **room type images**, where the admin enters an image filename and Laravel serves it from `public/roomtype_picture/`.
   - This is a classic admin-backed content workflow: database stores the metadata, public filesystem stores the actual image assets.

6. **Booking subsystem**
   - Bookings have a dedicated export/display path that writes XML to **storage/app/public** and exposes it through Laravel’s public storage link.
   - The URL `/storage/bookings.xml` is an externally consumable artifact, not just an internal page.
   - The booking XML can also be transformed/displayed through `/transform-xml` with an optional date filter, indicating server-side XML generation plus XSLT presentation.

7. **Room export subsystem**
   - Room data can be exported as XML via `/generate-rooms-xml`, which writes `public/rooms.xml`.
   - The generated XML is then rendered through `/rooms.xml` using XSLT.
   - This is a separate reporting/export path from the normal UI, so in a diagram it should be shown as a backend-to-file-to-browser flow.

8. **Payment subsystem**
   - Payments have both a UI and an API surface:
     - Browser UI: `/payment-ui.html`
     - Web service: `/api/payments`
   - The README’s Postman instructions imply the API is intended for direct client testing and possibly integration use, independent of the main admin/user pages.
   - Payments also have an XML/XSLT presentation path, so the same domain data is exposed through multiple interfaces.

9. **External interfaces and clients**
   - The repository expects access from:
     - A **web browser** for the Laravel UI
     - **Postman** for the payments API
     - An external **NetBeans Java client** for consuming the bookings XML
   - These are not separate services in the repo, but they are important consumers of the backend outputs and should appear as external clients in an architecture diagram.

10. **Filesystem/static boundary**
   - The app relies on the **public** directory for directly served assets and generated XML.
   - Room type images live under `public/roomtype_picture/`.
   - Generated room/payment XML and the booking XML publication path depend on the public filesystem and Laravel’s storage symlink.

11. **Security/session boundary**
   - Session handling is called out explicitly as part of the secure-coding guidance.
   - The app uses session lifetime/expiration settings and recommends `SESSION_DRIVER=database`, so session persistence is an architectural concern rather than a minor config detail.
   - This affects authentication behavior across the admin and user panels.

12. **Tooling and build support**
   - **Composer** manages PHP dependencies.
   - **npm/Vite** handles frontend asset compilation.
   - **PHPUnit** is present for testing, though the README does not emphasize a large automated test architecture.
   - `rooms.py` is a standalone Python file in the repo root; based on the README it appears to be an auxiliary script, not the primary application runtime.

13. **How to draw the diagram**
   - Show one central **Laravel application** connected to:
     - **MySQL** for persistent hotel data and sessions
     - **Public/storage files** for images and generated XML
     - **Browser UI** for user/admin screens
     - **API clients** for `/api/payments`
     - **XML/XSLT consumers** for rooms, payments, and bookings exports
   - Treat XML generation as a separate output pipeline branching off the Laravel backend, not as part of the normal CRUD UI flow.

Main entry points: [`composer.json`](https://github.com/zmingwww/hotel-management-system/blob/main/composer.json) (Composer), [`vite.config.js`](https://github.com/zmingwww/hotel-management-system/blob/main/vite.config.js) (Vite), [`phpunit.xml`](https://github.com/zmingwww/hotel-management-system/blob/main/phpunit.xml) (PHPUnit), [`rooms.py`](https://github.com/zmingwww/hotel-management-system/blob/main/rooms.py) (rooms.py)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_laravel_app["Laravel app<br/>php runtime"]
  node_web_routes["Routes<br/>http routing"]
  node_session_auth["Session auth<br/>auth/session"]
  node_user_panel["User panel<br/>web UI"]
  node_admin_panel["Admin panel<br/>web UI"]
  node_room_mgmt["Room mgmt<br/>crud screens"]
  node_booking_exports["Bookings XML<br/>export pipeline"]
  node_room_exports["Rooms XML<br/>export pipeline"]
  node_payments_api["Payments API<br/>web API"]
  node_payments_ui["Payment UI<br/>web page"]
  node_xml_transform["XSLT views<br/>server transform"]
end

subgraph group_data["Data & Files"]
  node_mysql[("MySQL<br/>database")]
  node_public_files["Public files<br/>filesystem"]
  node_storage_link["Storage public<br/>filesystem"]
end

subgraph group_clients["External Clients"]
  node_browser(("Browser<br/>client"))
  node_postman(("Postman<br/>api client"))
  node_netbeans_client(("Java client<br/>xml consumer"))
end

subgraph group_tooling["Tooling"]
  node_composer["Composer<br/>php deps<br/>[composer.json]"]
  node_vite["Vite<br/>asset build<br/>[vite.config.js]"]
  node_phpunit["PHPUnit<br/>test runner<br/>[phpunit.xml]"]
  node_rooms_py["rooms.py<br/>python helper<br/>[rooms.py]"]
end

node_browser -->|"HTTP requests"| node_laravel_app
node_postman -->|"API calls"| node_payments_api
node_netbeans_client -->|"XML fetch"| node_booking_exports
node_laravel_app -->|"dispatches"| node_web_routes
node_web_routes -->|"root UI"| node_user_panel
node_web_routes -->|"admin UI"| node_admin_panel
node_web_routes -->|"API route"| node_payments_api
node_web_routes -->|"payment page"| node_payments_ui
node_web_routes -->|"export route"| node_booking_exports
node_web_routes -->|"export route"| node_room_exports
node_web_routes -->|"auth flow"| node_session_auth
node_admin_panel -->|"manage rooms"| node_room_mgmt
node_room_mgmt -->|"room images"| node_public_files
node_booking_exports -->|"write XML"| node_storage_link
node_booking_exports -->|"transform"| node_xml_transform
node_room_exports -->|"write XML"| node_public_files
node_room_exports -->|"render XML"| node_xml_transform
node_payments_ui -->|"shares domain"| node_payments_api
node_laravel_app -->|"reads/writes"| node_mysql
node_session_auth -->|"session driver"| node_mysql
node_laravel_app -->|"serves assets"| node_public_files
node_laravel_app -->|"publishes files"| node_storage_link
node_composer -->|"dependencies"| node_laravel_app
node_vite -->|"assets"| node_laravel_app
node_phpunit -->|"tests"| node_laravel_app
node_rooms_py -.->|"auxiliary"| node_laravel_app

click node_composer "https://github.com/zmingwww/hotel-management-system/blob/main/composer.json"
click node_vite "https://github.com/zmingwww/hotel-management-system/blob/main/vite.config.js"
click node_phpunit "https://github.com/zmingwww/hotel-management-system/blob/main/phpunit.xml"
click node_rooms_py "https://github.com/zmingwww/hotel-management-system/blob/main/rooms.py"

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_laravel_app,node_web_routes,node_session_auth,node_user_panel,node_admin_panel,node_room_mgmt,node_booking_exports,node_room_exports,node_payments_api,node_payments_ui,node_xml_transform toneBlue
class node_mysql,node_public_files,node_storage_link toneAmber
class node_browser,node_postman,node_netbeans_client toneMint
class node_composer,node_vite,node_phpunit,node_rooms_py toneRose
```

## Components

### Application

Laravel runtime and major request paths

- **Laravel app**: php runtime · Single Laravel 12 application handling web, API, and export requests
- **Routes**: http routing · Entry routing for browser pages, API endpoints, and export actions
- **Session auth**: auth/session · Login state, persistence, and expiration behavior across user and admin flows
- **User panel**: web UI · Main browser-facing hotel user experience at the root path
- **Admin panel**: web UI · Authenticated admin experience for hotel management
- **Room mgmt**: crud screens · Admin-managed room types and related content such as room images
- **Bookings XML**: export pipeline · Generates booking XML for public consumption and transform views
- **Rooms XML**: export pipeline · Generates room XML and serves it through XSLT presentation
- **Payments API**: web API · API surface for payment access and direct client testing
- **Payment UI**: web page · Browser-facing payment screen used alongside the API
- **XSLT views**: server transform · Server-side XML transformation and browser presentation layer

### Data & Files

Database, sessions, and generated/public artifacts

- **MySQL**: database · Primary persistence for hotel data and session storage
- **Public files**: filesystem · Directly served assets and generated XML under public/
- **Storage public**: filesystem · Laravel storage/public publication path for exported booking XML

### External Clients

Consumers of the web UI and export endpoints

- **Browser**: client · Web browser used for user and admin panels
- **Postman**: api client · Client used to exercise the payments API
- **Java client**: xml consumer · External consumer of exported booking XML

### Tooling

Build, dependency, and test support

- [Composer](https://github.com/zmingwww/hotel-management-system/blob/main/composer.json): php deps · PHP dependency management for the Laravel app · `composer.json`
- [Vite](https://github.com/zmingwww/hotel-management-system/blob/main/vite.config.js): asset build · Frontend asset build and dev server · `vite.config.js`
- [PHPUnit](https://github.com/zmingwww/hotel-management-system/blob/main/phpunit.xml): test runner · Automated test configuration and execution · `phpunit.xml`
- [rooms.py](https://github.com/zmingwww/hotel-management-system/blob/main/rooms.py): python helper · Standalone auxiliary Python script in the repository root · `rooms.py`

## Connections

- Browser → Laravel app: HTTP requests · Browser reaches the Laravel backend for normal site usage
- Postman → Payments API: API calls · Direct API client access to payment endpoints
- Java client → Bookings XML: XML fetch · External client consumes exported booking XML
- Laravel app → Routes: dispatches · Application routes incoming requests to features
- Routes → User panel: root UI · Routes the user-facing homepage and related pages
- Routes → Admin panel: admin UI · Routes admin login and management screens
- Routes → Payments API: API route · Exposes payments under the API surface
- Routes → Payment UI: payment page · Serves the browser payment screen
- Routes → Bookings XML: export route · Triggers booking XML generation and transform views
- Routes → Rooms XML: export route · Triggers room XML generation and XSLT serving
- Routes → Session auth: auth flow · Login and session state support admin/user separation
- Admin panel → Room mgmt: manage rooms · Admin CRUD for room types and images
- Room mgmt → Public files: room images · Room type images are served from the public filesystem
- Bookings XML → Storage public: write XML · Booking XML is written to storage/app/public
- Bookings XML → XSLT views: transform · Booking XML can be rendered through XSLT views
- Rooms XML → Public files: write XML · Room XML is generated into public/rooms.xml
- Rooms XML → XSLT views: render XML · Room XML is displayed through XSLT presentation
- Payment UI → Payments API: shares domain · UI and API expose the same payment data domain
- Laravel app → MySQL: reads/writes · Persistent hotel data and session storage live in MySQL
- Session auth → MySQL: session driver · Database session storage and expiration depend on MySQL
- Laravel app → Public files: serves assets · Public directory backs direct asset and XML access
- Laravel app → Storage public: publishes files · Storage symlink exposes generated booking XML to the web
- Composer → Laravel app: dependencies · Composer manages PHP packages for the application
- Vite → Laravel app: assets · Vite supports frontend asset compilation and dev serving
- PHPUnit → Laravel app: tests · PHPUnit validates the Laravel codebase
- rooms.py → Laravel app: auxiliary · Standalone helper script separate from the main PHP runtime
