# sriharsha1405/hotel-reservation-system architecture

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

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

## Overview

##### Project Type and Purpose
- This is a **Java-based console application** (monolithic) that provides CRUD operations for hotel reservations.
- It uses **JDBC** (MySQL Connector/J) to persist data in a **MySQL** database.
- The `schemas/` folder holds your SQL DDL, and `src/HotelReservationSystem.java` contains UI, business logic, and data-access code all in one class.

##### File Structure
- Top-level:
- `.gitignore`, IDE configs (`.idea/`, `*.iml`)
- `README.md` (project description)
- `schemas/` (SQL scripts for table creation)
- `src/` (Java source)
- No separate frontend/backend directories—this is a single executable class.
- Database connection constants and menu-driven UI live in `HotelReservationSystem.java`.

##### README for Insights
- Prerequisites: JDK, MySQL, JDBC driver.
- Setup steps configure DB credentials in code and then compile/run.
- Features: add/view/edit/delete reservations via console.

##### Main Components & Their Relationships
a. Components:
1. **Console UI Layer**
- Presents menu, reads user input, displays results.
2. **Business Logic Layer**
- Orchestrates create/read/update/delete operations.
3. **Data Access Layer (DAL)**
- JDBC interactions: opens connections, prepares statements, executes queries.
4. **MySQL Database**
- `reservations` table (and any supporting tables) defined by `schemas/` SQL scripts.
b. Interactions:
- UI → calls Business Logic methods
- Business Logic → invokes DAL methods
- DAL → uses JDBC → MySQL
- MySQL returns results → DAL → Business Logic → UI
c. Architectural Patterns:
- **Monolithic, layered approach** (even though all code is in one class, conceptually three layers).
- **Menu-driven control flow**
- **Direct JDBC** (no ORM)
d. Key Technologies:
- Java (JDK 8+)
- MySQL
- MySQL Connector/J (JDBC driver)

##### Putting It All Together
- Java class: `HotelReservationSystem.java`
- SQL scripts: `schemas/*.sql`
- Technologies: JDK, MySQL Connector/J

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers
    ConsoleUI["Console Menu"]:::ui
    BusinessLogic["Business Logic\nReservationService"]:::business
    DataAccess["JDBC Data Access"]:::data
    DB(("MySQL Database\n(hotel_db)")):::db
    Schemas[[schemas/]]:::script
    README[[README.md]]:::script

    %% Flow
    ConsoleUI -->|"calls operations"| BusinessLogic
    BusinessLogic -->|"invokes DAL methods"| DataAccess
    DataAccess -->|"executes SQL via JDBC"| DB
    DB -->|"returns results"| DataAccess
    DataAccess -->|"returns data objects"| BusinessLogic
    BusinessLogic -->|"displays on console"| ConsoleUI

    %% Documentation and Schema
    Schemas -.->|defines tables| DB
    README -.->|project description & setup| ConsoleUI

    %% Click Events
    click ConsoleUI "https://github.com/sriharsha1405/hotel-reservation-system/blob/main/src/HotelReservationSystem.java"
    click BusinessLogic "https://github.com/sriharsha1405/hotel-reservation-system/blob/main/src/HotelReservationSystem.java"
    click DataAccess "https://github.com/sriharsha1405/hotel-reservation-system/blob/main/src/HotelReservationSystem.java"
    click Schemas "https://github.com/sriharsha1405/hotel-reservation-system/tree/main/schemas/"
    click README "https://github.com/sriharsha1405/hotel-reservation-system/blob/main/README.md"

    %% Styles
    classDef ui fill:#1f77b4,stroke:#000,color:#fff;
    classDef business fill:#2ca02c,stroke:#000,color:#fff;
    classDef data fill:#ff7f0e,stroke:#000,color:#fff;
    classDef db fill:#d62728,stroke:#000,color:#fff;
    classDef script fill:#cccccc,stroke:#000,color:#000;
```
