# jprathod2007/java-hotel-reservation-system architecture

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

- Interactive diagram: https://gitdiagram.com/jprathod2007/java-hotel-reservation-system
- Repository: https://github.com/jprathod2007/java-hotel-reservation-system

## Overview

This is a single-file console hotel reservation application. A user selects menu actions; the console entry point delegates room search, booking, cancellation, and reservation listing to HotelService. The service keeps room and reservation state in memory and loads or saves it in two local text files. The excerpts show a simulated payment method, but not its call site, so no payment-flow edge is asserted.

Main entry points: [`HotelReservationSystem.java`](https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java) (Hotel service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Console interface"]
  node_menu["Console menu"]
end

subgraph group_booking["Reservation domain"]
  node_service["Hotel service"]
  node_room["Room inventory"]
  node_reservation["Reservation record"]
end

subgraph group_storage["Local persistence"]
  node_rooms_file[("rooms.txt")]
  node_bookings_file[("bookings.txt")]
end

node_guest(("Hotel guest"))

node_guest -->|"selects actions"| node_menu
node_menu -->|"requests operations"| node_service
node_service -->|"loads and filters"| node_room
node_service -->|"creates and updates"| node_reservation
node_service -->|"loads and saves"| node_rooms_file
node_service -->|"loads and saves"| node_bookings_file
node_room -->|"serializes inventory"| node_rooms_file
node_reservation -->|"serializes bookings"| node_bookings_file

click node_menu "https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java"
click node_service "https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java"
click node_room "https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java"
click node_reservation "https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java"
click node_rooms_file "https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java"
click node_bookings_file "https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.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_menu toneBlue
class node_service,node_room,node_reservation toneAmber
class node_rooms_file,node_bookings_file toneMint
class node_guest toneIndigo
```

## Components

### Console interface

- [Console menu](https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java): `HotelReservationSystem.java`

### Reservation domain

- [Hotel service](https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java): `HotelReservationSystem.java`
- [Room inventory](https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java): `HotelReservationSystem.java`
- [Reservation record](https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java): `HotelReservationSystem.java`

### Local persistence

- [rooms.txt](https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java): `HotelReservationSystem.java`
- [bookings.txt](https://github.com/jprathod2007/java-hotel-reservation-system/blob/main/HotelReservationSystem.java): `HotelReservationSystem.java`

### Other components

- **Hotel guest**

## Connections

- Hotel guest → Console menu: selects actions (evidence: `HotelReservationSystem.java`)
- Console menu → Hotel service: requests operations (evidence: `HotelReservationSystem.java`)
- Hotel service → Room inventory: loads and filters (evidence: `HotelReservationSystem.java`)
- Hotel service → Reservation record: creates and updates (evidence: `HotelReservationSystem.java`)
- Hotel service → rooms.txt: loads and saves (evidence: `HotelReservationSystem.java`)
- Hotel service → bookings.txt: loads and saves (evidence: `HotelReservationSystem.java`)
- Room inventory → rooms.txt: serializes inventory (evidence: `HotelReservationSystem.java`)
- Reservation record → bookings.txt: serializes bookings (evidence: `HotelReservationSystem.java`)
