# sudhirkumar85/hotel-management-system architecture

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

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

## Overview

##### Project type and purpose
- This is a desktop-based hotel management system built in Java using the AWT/Swing GUI toolkit with JDBC connectivity to a MySQL database.
- It supports room management (add, update, delete, view), customer check-in/out, bill generation, bill storage, and user authentication (sign-in/up, password recovery).

##### File structure
- Top-level build files: build.xml, manifest.mf, NetBeans project files (nbproject/…).
- src/ directory:
- Form classes (*.form + corresponding .java) under src/, each representing one Swing GUI screen.
- Business logic class: src/hotel/management/system/HotelManagementSystem.java (likely application entry point).
- Database access helper: src/project/ConnectionProvider.java.
- src/image/: holds application images/screenshots (used in UI).

##### Additional architecture insights from README
- Layers implicitly follow a simple MVC-like separation:
- View: Swing forms (UI screens).
- Controller/Service: event handlers inside each form’s .java which communicate with business logic and DAOs.
- Data Access: ConnectionProvider + JDBC calls to MySQL.
- Packaged as an executable (.exe) for end-user deployment.

##### Main components
a. Presentation Layer (Swing UI)
- Each form class: Start, SignIn, Signup, PassWord, Home, Admin, ManageRoom, CustomerCheckIn, CustomerCheckOut, GenerateBill, CustomerDetailsBill.
b. Business Logic Layer
- HotelManagementSystem.java: orchestrates flow between UI events and database actions.
- Methods invoked by UI event listeners for room operations, customer operations, billing.
c. Data Access Layer
- ConnectionProvider.java: establishes JDBC connection to MySQL.
- SQL statements executed here or from service methods.
d. Database
- MySQL server storing tables for rooms, customers, bills, users.
e. Packaging/Deployment
- build.xml and NetBeans project files for building .jar/.exe.

##### Relationships and interactions
- UI screens send user actions (e.g., “Add Room”, “Check In”) to controller logic in each form.
- Controllers call helper/business classes in hotel.management.system or directly use ConnectionProvider.
- ConnectionProvider opens JDBC connections, executes CRUD operations on MySQL.
- Responses (success/failure, data sets) propagate back to UI for display.
- The application entry point initializes the loading screen (Start → Start1) then SignIn.

##### Architectural patterns and design principles
- Layered architecture: clear separation of Presentation, Business Logic, Data Access.
- Event-driven UI: Swing action listeners in each Form.
- Single Responsibility: each form handles one user workflow.
- Reusable DB connectivity: ConnectionProvider centralizes JDBC setup.

##### Detail without overthinking
- CRUD operations: room management, customer check-in/out, billing generation.
- How the ConnectionProvider is reused across forms.
- Transition from loading screen to login to main application.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        Start["Start Screen"]:::ui
        Start1["Splash Screen"]:::ui
        SignIn["Sign In Screen"]:::ui
        Signup["Sign Up Screen"]:::ui
        PassWord["Password Recovery Screen"]:::ui
        Home["Home/Main Dashboard"]:::ui
        Admin["Admin Dashboard"]:::ui
        ManageRoom["Room Management Screen"]:::ui
        CustomerCheckIn["Customer Check-In Screen"]:::ui
        CustomerCheckOut["Customer Check-Out Screen"]:::ui
        GenerateBill["Bill Generation Screen"]:::ui
        CustomerDetailsBill["Customer Details & Bill View"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        HotelManagementSystem["HotelManagementSystem.java"]:::logic
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        ConnectionProvider["ConnectionProvider.java"]:::dao
    end

    %% Database
    MySQL[(MySQL Database)]:::db

    %% Deployment
    subgraph "Deployment/Build"
        direction TB
        BuildScript["build.xml"]:::build
        Manifest["manifest.mf"]:::build
        NBProject["nbproject/"]:::build
    end

    %% Flow
    Start -->|loads| Start1
    Start1 -->|navigates| SignIn
    SignIn -->|on success| Home
    SignIn -->|register| Signup
    SignIn -->|forgot password| PassWord
    Home --> Admin
    Home --> ManageRoom
    Home --> CustomerCheckIn
    Home --> CustomerCheckOut
    Home --> GenerateBill
    Home --> CustomerDetailsBill

    %% UI to Logic
    Start -->|events| HotelManagementSystem
    Start1 -->|events| HotelManagementSystem
    SignIn -->|events| HotelManagementSystem
    Signup -->|events| HotelManagementSystem
    PassWord -->|events| HotelManagementSystem
    Home -->|events| HotelManagementSystem
    Admin -->|events| HotelManagementSystem
    ManageRoom -->|events| HotelManagementSystem
    CustomerCheckIn -->|events| HotelManagementSystem
    CustomerCheckOut -->|events| HotelManagementSystem
    GenerateBill -->|events| HotelManagementSystem
    CustomerDetailsBill -->|events| HotelManagementSystem

    %% Logic to DAO
    HotelManagementSystem -->|uses| ConnectionProvider

    %% DAO to Database
    ConnectionProvider -->|executes SQL| MySQL
    MySQL -->|returns data| ConnectionProvider
    ConnectionProvider -->|returns results| HotelManagementSystem
    HotelManagementSystem -->|updates UI| Start
    HotelManagementSystem -->|updates UI| Start1
    HotelManagementSystem -->|updates UI| SignIn
    HotelManagementSystem -->|updates UI| Signup
    HotelManagementSystem -->|updates UI| PassWord
    HotelManagementSystem -->|updates UI| Home
    HotelManagementSystem -->|updates UI| Admin
    HotelManagementSystem -->|updates UI| ManageRoom
    HotelManagementSystem -->|updates UI| CustomerCheckIn
    HotelManagementSystem -->|updates UI| CustomerCheckOut
    HotelManagementSystem -->|updates UI| GenerateBill
    HotelManagementSystem -->|updates UI| CustomerDetailsBill

    %% Deployment build link
    BuildScript -->|builds| nbExecutable[".jar/.exe"]
    Manifest -->|packaged in| nbExecutable
    NBProject -->|configures| nbExecutable
    nbExecutable -->|runs application| Start

    %% Click Events
    click Start "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/Start.java"
    click Start1 "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/Start1.java"
    click SignIn "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/SignIn.java"
    click Signup "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/Signup.java"
    click PassWord "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/PassWord.java"
    click Home "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/Home.java"
    click Admin "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/Admin.java"
    click ManageRoom "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/ManageRoom.java"
    click CustomerCheckIn "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/CustomerCheckIn.java"
    click CustomerCheckOut "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/CustomerCheckOut.java"
    click GenerateBill "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/GenerateBill.java"
    click CustomerDetailsBill "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/CustomerDetailsBill.java"
    click HotelManagementSystem "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/hotel/management/system/HotelManagementSystem.java"
    click ConnectionProvider "https://github.com/sudhirkumar85/hotel-management-system/blob/master/src/project/ConnectionProvider.java"
    click BuildScript "https://github.com/sudhirkumar85/hotel-management-system/blob/master/build.xml"
    click Manifest "https://github.com/sudhirkumar85/hotel-management-system/blob/master/manifest.mf"
    click NBProject "https://github.com/sudhirkumar85/hotel-management-system/tree/master/nbproject/"

    %% Styles
    classDef ui fill:#E3F2FD,stroke:#90CAF9,stroke-width:1px;
    classDef logic fill:#FFF9C4,stroke:#FDD835,stroke-width:1px;
    classDef dao fill:#E0F7FA,stroke:#4DD0E1,stroke-width:1px;
    classDef db fill:#FCE4EC,stroke:#F48FB1,stroke-width:1px;
    classDef build fill:#E8F5E9,stroke:#81C784,stroke-width:1px;
```
