# ntuanh/hotelmanagement architecture

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

- Interactive diagram: https://gitdiagram.com/ntuanh/hotelmanagement
- Repository: https://github.com/ntuanh/hotelmanagement

## Overview

##### Project’s Main Purpose and Type
- It’s a full-fledged hotel management application.
- The codebase is split between a command-line (or graphical text-based) interface and underlying business logic (domain objects), alongside a web component.
- The README shows compilation instructions where C source files from the Interface and Objects directories are combined into an executable (“out.exe”).

##### And Break Down the File Structure
- “Interface” Directory:
- Contains the user interface components, including files like AdminInterface.c, HomePage.c, HotelInterface.c, and UserInterface.c.
- Also contains text files (history.txt, hotels.txt, users.txt) likely used to persist or simulate data storage.
- Executables such as main.exe indicate this is the primary entry point for user interaction.
- “Objects” Directory:
- Holds core functionality and business logic with files like history.c, hotels.c, and users.c.
- These files likely handle the data processing and management behind hotel operations.
- “Website” Directory:
- Contains HTML pages (admin.html, hotel.html, index.html, user.html) and styles (styles.css). This indicates an additional static web-based component, perhaps for administrative views or to provide a client-facing website.
- Other Directories:
- “Ascii-Graphics” and “.vscode” suggest development tools and graphical elements used in the application.

##### Main Components
a. User Interface Layer:
- C-based text/graphical interfaces (Admin, Home, Hotel, User).
- This layer interacts directly with the end user via the executable (out.exe) in the Interface directory.
b. Business Logic / Domain Objects:
- This includes the Objects directory code which encapsulates data management, customer history, hotel data, and user details.
c. Data Storage / Persistence:
- The text files (history.txt, hotels.txt, users.txt) that act as data repositories.
d. Static Website Component:
- The Website directory provides a web-based view, which could be used for monitoring or direct interaction with the hotel management system.
e. Development & Utility Tools:
- Supporting directories like Ascii-Graphics (for enhanced display in the terminal) and VS Code settings (.vscode directory).

##### Relationships and Interactions
- The Interface layer is the entry point that takes user input and displays output.
- The Interface code calls functions from the Objects module to execute business logic (for instance, booking a hotel room or retrieving user history).
- The Website component can be seen as an external or supplementary interface that displays hotel information or administrative details. It might read from the same data sources or provide a different interaction paradigm.

##### Architectural Patterns and Design Principles
- There is a clear separation of concerns between:
- The presentation layer (Interface and Website)
- The business logic (Objects)
- The data management (text-based files used for persistence)
- The use of separate directories indicates a modular design that simplifies maintenance.

## Diagram (Mermaid)

```mermaid
graph TB
    %% User Interface Layer (CLI)
    subgraph "User Interface Layer (CLI)"
        UI_out["out.exe"]:::ui
        UI_Admin["AdminInterface.c"]:::ui
        UI_Home["HomePage.c"]:::ui
        UI_Hotel["HotelInterface.c"]:::ui
        UI_User["UserInterface.c"]:::ui
        UI_txt1["history.txt"]:::storage
        UI_txt2["hotels.txt"]:::storage
        UI_txt3["users.txt"]:::storage
    end

    %% Business Logic / Domain Objects
    subgraph "Business Logic / Domain Objects"
        BL_History["history.c"]:::logic
        BL_Hotels["hotels.c"]:::logic
        BL_Users["users.c"]:::logic
    end

    %% Data Storage (Text Files)
    subgraph "Data Storage (Text Files)"
        DS_history["history.txt"]:::storage
        DS_hotels["hotels.txt"]:::storage
        DS_users["users.txt"]:::storage
    end

    %% Static Website Component
    subgraph "Static Website Component"
        WS_admin["admin.html"]:::website
        WS_hotel["hotel.html"]:::website
        WS_index["index.html"]:::website
        WS_user["user.html"]:::website
        WS_styles["styles.css"]:::website
    end

    %% Development & Utility Tools
    subgraph "Development & Utility Tools"
        Dev_ASCII["Ascii-Graphics"]:::dev
        Dev_vscodeRoot[".vscode (root)"]:::dev
        Dev_vscodeInterface[".vscode (Interface)"]:::dev
    end

    %% Connections within the Interface Layer
    UI_out -->|"launches"| UI_Admin
    UI_out -->|"launches"| UI_Home
    UI_out -->|"launches"| UI_Hotel
    UI_out -->|"launches"| UI_User

    %% UI Layer calls Business Logic functions
    UI_Admin -->|"calls"| BL_History
    UI_Home -->|"calls"| BL_Hotels
    UI_Hotel -->|"calls"| BL_Hotels
    UI_User -->|"calls"| BL_Users

    %% Business Logic interacts with Data Storage
    BL_History -->|"I/O"| DS_history
    BL_Hotels -->|"I/O"| DS_hotels
    BL_Users -->|"I/O"| DS_users

    %% UI Layer accesses local text files (for persistence simulation)
    UI_txt1 --- UI_Admin
    UI_txt2 --- UI_Home
    UI_txt3 --- UI_User

    %% Static Website reads data from Data Storage
    WS_index -->|"reads"| DS_history
    WS_index -->|"reads"| DS_hotels
    WS_index -->|"reads"| DS_users

    %% Styling
    classDef ui fill:#a2d2ff,stroke:#0b66c3,stroke-width:2px;
    classDef logic fill:#cbe6ff,stroke:#0b3d91,stroke-width:2px;
    classDef storage fill:#d1f7c4,stroke:#3b7a0a,stroke-width:2px;
    classDef website fill:#ffe3a1,stroke:#d17b00,stroke-width:2px;
    classDef dev fill:#e0e0e0,stroke:#777777,stroke-width:2px;

    %% Click Events for User Interface Layer (CLI)
    click UI_Admin "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/AdminInterface.c"
    click UI_Home "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/HomePage.c"
    click UI_Hotel "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/HotelInterface.c"
    click UI_User "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/UserInterface.c"
    click UI_txt1 "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/history.txt"
    click UI_txt2 "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/hotels.txt"
    click UI_txt3 "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/users.txt"
    click UI_out "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/main.exe"

    %% Click Events for Business Logic / Domain Objects
    click BL_History "https://github.com/ntuanh/hotelmanagement/blob/main/Objects/history.c"
    click BL_Hotels "https://github.com/ntuanh/hotelmanagement/blob/main/Objects/hotels.c"
    click BL_Users "https://github.com/ntuanh/hotelmanagement/blob/main/Objects/users.c"

    %% Click Events for Data Storage / Persistence
    click DS_history "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/history.txt"
    click DS_hotels "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/hotels.txt"
    click DS_users "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/users.txt"

    %% Click Events for Static Website Component
    click WS_admin "https://github.com/ntuanh/hotelmanagement/blob/main/Website/admin.html"
    click WS_hotel "https://github.com/ntuanh/hotelmanagement/blob/main/Website/hotel.html"
    click WS_index "https://github.com/ntuanh/hotelmanagement/blob/main/Website/index.html"
    click WS_user "https://github.com/ntuanh/hotelmanagement/blob/main/Website/user.html"
    click WS_styles "https://github.com/ntuanh/hotelmanagement/blob/main/Website/styles.css"

    %% Click Events for Development & Utility Tools
    click Dev_ASCII "https://github.com/ntuanh/hotelmanagement/tree/main/Ascii-Graphics"
    click Dev_vscodeRoot "https://github.com/ntuanh/hotelmanagement/blob/main/.vscode"
    click Dev_vscodeInterface "https://github.com/ntuanh/hotelmanagement/blob/main/Interface/.vscode"
```
