# yashbohat/hotel_management_system architecture

> Architecture diagram of the GitHub repository yashbohat/hotel_management_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashbohat/hotel_management_system
- Repository: https://github.com/yashbohat/hotel_management_system

## Overview

Royal Stay is a Spring Boot hotel booking application. Its main guest workflow is account registration and login, room discovery and date-based availability, booking creation, then profile and receipt access; administrators also manage rooms, and visitors can submit inquiries. Controllers handle web requests, services apply booking, room, and user operations, and Spring Data repositories persist the JPA entities. The README documents the overall capabilities; the sampled sources show booking and room flows in detail, but not every controller or the receipt-download wiring.

Main entry points: [`src/main/java/com/royalstayhotel/service/UserService.java`](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/UserService.java) (User operations), [`src/main/java/com/royalstayhotel/controller/BookingController.java`](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/BookingController.java) (Booking requests), [`src/main/java/com/royalstayhotel/service/RoomService.java`](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/RoomService.java) (Room operations), [`src/main/java/com/royalstayhotel/controller/ProfileController.java`](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/ProfileController.java) (Profile management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_roomweb["Room browsing"]
  node_bookingweb["Booking requests"]
  node_profile["Profile management"]
  node_receiptweb["Receipt access"]
  node_authweb["Registration and login"]
  node_site["Home and contact"]
  node_adminweb["Room administration"]
end

subgraph group_domain["Hotel operations"]
  node_roomservice["Room operations<br/>[RoomService.java]"]
  node_bookingservice["Booking operations"]
  node_pdf["PDF receipt generation"]
end

subgraph group_identity["Identity and access"]
  node_userservice["User operations<br/>[UserService.java]"]
  node_security["Security configuration"]
end

subgraph group_data["Persistence"]
  node_room["Room entity<br/>[Room.java]"]
  node_booking["Booking entity<br/>[Booking.java]"]
  node_user["User entity<br/>[User.java]"]
  node_roomrepo["Room repository"]
  node_bookingrepo["Booking repository"]
  node_userrepo["User repository"]
end

node_guest(("Guest"))
node_admin(("Administrator"))
node_db[("H2 database")]

node_guest -->|"registers or logs in"| node_authweb
node_guest -->|"browses rooms"| node_roomweb
node_guest -->|"requests booking"| node_bookingweb
node_guest -->|"views bookings"| node_profile
node_guest -->|"accesses receipts"| node_receiptweb
node_guest -->|"sends inquiry"| node_site
node_admin -->|"manages rooms"| node_adminweb
node_roomweb -->|"queries or saves"| node_roomservice
node_bookingweb -->|"checks availability"| node_roomservice
node_bookingweb -->|"creates or cancels"| node_bookingservice
node_bookingweb -->|"looks up guest"| node_userservice
node_profile -->|"loads bookings"| node_bookingservice
node_profile -->|"loads profile"| node_userservice
node_authweb -->|"registers users"| node_userservice
node_security -->|"loads user details"| node_userservice
node_adminweb -->|"manages rooms"| node_roomservice
node_bookingservice -->|"saves or finds"| node_bookingrepo
node_roomservice -->|"queries or saves"| node_roomrepo
node_userservice -->|"saves or finds"| node_userrepo
node_receiptweb -.->|"generates PDF"| node_pdf
node_bookingrepo -->|"persists bookings"| node_db
node_roomrepo -->|"persists rooms"| node_db
node_userrepo -->|"persists users"| node_db

click node_roomweb "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/RoomController.java"
click node_bookingweb "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/BookingController.java"
click node_profile "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/ProfileController.java"
click node_receiptweb "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/ReceiptController.java"
click node_authweb "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/AuthController.java"
click node_site "https://github.com/yashbohat/hotel_management_system/tree/main/src/main/java/com/royalstayhotel/controller"
click node_adminweb "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/AdminController.java"
click node_roomservice "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/RoomService.java"
click node_bookingservice "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/BookingService.java"
click node_pdf "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/ReceiptService.java"
click node_userservice "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/UserService.java"
click node_security "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/config/SecurityConfig.java"
click node_room "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/model/Room.java"
click node_booking "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/model/Booking.java"
click node_user "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/model/User.java"
click node_roomrepo "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/repository/RoomRepository.java"
click node_bookingrepo "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/repository/BookingRepository.java"
click node_userrepo "https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/repository/UserRepository.java"

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_roomweb,node_bookingweb,node_profile,node_receiptweb,node_authweb,node_site,node_adminweb toneBlue
class node_roomservice,node_bookingservice,node_pdf,node_db toneAmber
class node_userservice,node_security toneMint
class node_room,node_booking,node_user,node_roomrepo,node_bookingrepo,node_userrepo toneRose
class node_guest,node_admin toneIndigo
```

## Components

### Web experience

- [Room browsing](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/RoomController.java): `src/main/java/com/royalstayhotel/controller/RoomController.java`
- [Booking requests](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/BookingController.java): `src/main/java/com/royalstayhotel/controller/BookingController.java`
- [Profile management](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/ProfileController.java): `src/main/java/com/royalstayhotel/controller/ProfileController.java`
- [Receipt access](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/ReceiptController.java): `src/main/java/com/royalstayhotel/controller/ReceiptController.java`
- [Registration and login](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/AuthController.java): `src/main/java/com/royalstayhotel/controller/AuthController.java`
- [Home and contact](https://github.com/yashbohat/hotel_management_system/tree/main/src/main/java/com/royalstayhotel/controller): `src/main/java/com/royalstayhotel/controller`
- [Room administration](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/controller/AdminController.java): `src/main/java/com/royalstayhotel/controller/AdminController.java`

### Hotel operations

- [Room operations](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/RoomService.java): `src/main/java/com/royalstayhotel/service/RoomService.java`
- [Booking operations](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/BookingService.java): `src/main/java/com/royalstayhotel/service/BookingService.java`
- [PDF receipt generation](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/ReceiptService.java): `src/main/java/com/royalstayhotel/service/ReceiptService.java`

### Identity and access

- [User operations](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/service/UserService.java): `src/main/java/com/royalstayhotel/service/UserService.java`
- [Security configuration](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/config/SecurityConfig.java): `src/main/java/com/royalstayhotel/config/SecurityConfig.java`

### Persistence

- [Room entity](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/model/Room.java): `src/main/java/com/royalstayhotel/model/Room.java`
- [Booking entity](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/model/Booking.java): `src/main/java/com/royalstayhotel/model/Booking.java`
- [User entity](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/model/User.java): `src/main/java/com/royalstayhotel/model/User.java`
- [Room repository](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/repository/RoomRepository.java): `src/main/java/com/royalstayhotel/repository/RoomRepository.java`
- [Booking repository](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/repository/BookingRepository.java): `src/main/java/com/royalstayhotel/repository/BookingRepository.java`
- [User repository](https://github.com/yashbohat/hotel_management_system/blob/main/src/main/java/com/royalstayhotel/repository/UserRepository.java): `src/main/java/com/royalstayhotel/repository/UserRepository.java`

### Other components

- **Guest**
- **Administrator**
- **H2 database**

## Connections

- Guest → Registration and login: registers or logs in (evidence: `README.md`)
- Guest → Room browsing: browses rooms (evidence: `README.md`)
- Guest → Booking requests: requests booking (evidence: `README.md`)
- Guest → Profile management: views bookings (evidence: `README.md`)
- Guest → Receipt access: accesses receipts (evidence: `README.md`)
- Guest → Home and contact: sends inquiry (evidence: `README.md`)
- Administrator → Room administration: manages rooms (evidence: `README.md`)
- Room browsing → Room operations: queries or saves (evidence: `src/main/java/com/royalstayhotel/controller/RoomController.java`)
- Booking requests → Room operations: checks availability (evidence: `src/main/java/com/royalstayhotel/controller/BookingController.java`)
- Booking requests → Booking operations: creates or cancels (evidence: `src/main/java/com/royalstayhotel/controller/BookingController.java`)
- Booking requests → User operations: looks up guest (evidence: `src/main/java/com/royalstayhotel/controller/BookingController.java`)
- Profile management → Booking operations: loads bookings (evidence: `src/main/java/com/royalstayhotel/controller/ProfileController.java`)
- Profile management → User operations: loads profile (evidence: `src/main/java/com/royalstayhotel/controller/ProfileController.java`)
- Registration and login → User operations: registers users (evidence: `src/main/java/com/royalstayhotel/controller/AuthController.java`)
- Security configuration → User operations: loads user details (evidence: `src/main/java/com/royalstayhotel/config/SecurityConfig.java`)
- Room administration → Room operations: manages rooms (evidence: `src/main/java/com/royalstayhotel/controller/AdminController.java`)
- Booking operations → Booking repository: saves or finds (evidence: `src/main/java/com/royalstayhotel/service/BookingService.java`)
- Room operations → Room repository: queries or saves (evidence: `src/main/java/com/royalstayhotel/service/RoomService.java`)
- User operations → User repository: saves or finds (evidence: `src/main/java/com/royalstayhotel/service/UserService.java`)
- Receipt access → PDF receipt generation: generates PDF
- Booking repository → H2 database: persists bookings (evidence: `src/main/java/com/royalstayhotel/repository/BookingRepository.java`)
- Room repository → H2 database: persists rooms (evidence: `src/main/java/com/royalstayhotel/repository/RoomRepository.java`)
- User repository → H2 database: persists users (evidence: `src/main/java/com/royalstayhotel/repository/UserRepository.java`)
