# callisto-aurelia/hotel-management architecture

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

- Interactive diagram: https://gitdiagram.com/callisto-aurelia/hotel-management
- Repository: https://github.com/callisto-aurelia/hotel-management

## Overview

##### Project Type and Purpose
- This is a console-based, full-stack (single-process) application written in Python with a MySQL backend.
- It provides hotel operations functionality: room management, customer management, reservations, check-in/out, and billing.

##### File Structure
- main.py: entry point, orchestrates menu and dispatches user choices.
- admin.py, employee.py, user.py: modules handling role-specific workflows.
- funcs.py: shared business logic and utility functions.
- tables.py: schema definition and table-creation scripts.
- sql_insertion.py: initial data seeding into MySQL.
- README.md: documents features, tech stack, and contributors.

##### README for Technical Insights
- Python + mysql-connector-python for DB connectivity.
- texttable for CLI table formatting.
- Standard modules for I/O and data processing.

##### Main Components
a. Actors (External Users)
- Admin user
- Employee user
- Guest/General user
b. Presentation Layer
- CLI Menu (main.py)
- texttable module for output formatting
c. Application Layer (Business Logic)
- Admin workflows (admin.py)
- Employee workflows (employee.py)
- Customer/Reservation workflows (user.py)
- Shared utilities (funcs.py)
d. Data Layer
- Data-access wrappers (mysql-connector-python calls inside each module)
- Schema setup (tables.py)
- Data seeding (sql_insertion.py)
e. Persistence
- MySQL Database (Rooms, Customers, Reservations, Payments, Employees, Admins)

##### Interactions and Data-flow
1. Actor selects option in CLI → main.py
2. main.py routes to appropriate module (admin.py / employee.py / user.py)
3. Module invokes funcs.py for shared validations or computations
4. Module issues SQL queries via mysql-connector-python to MySQL
5. MySQL returns result sets → python module processes results
6. Results rendered back to user via texttable in CLI

##### Architectural Patterns and Design Principles
- Layered architecture: Presentation → Business Logic → Data Access → Persistence
- Single responsibility: each module handles one actor’s use-cases
- Shared utility library (funcs.py) to avoid code duplication
- Modular DB schema initialization (tables.py) and seeding (sql_insertion.py)

##### Relevant Technologies & Libraries
- Python 3.x
- mysql-connector-python
- texttable
- MySQL Server

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors
    Admin["Admin User"]:::actor
    Employee["Employee User"]:::actor
    Guest["Guest User"]:::actor

    %% Presentation Layer
    CLIRouter["CLI Router"]:::presentation

    %% Business Logic Modules
    AdminModule["Admin Module"]:::business
    EmployeeModule["Employee Module"]:::business
    UserModule["User/Guest Module"]:::business

    %% Utility and Setup
    UtilityLibrary["Utility Library"]:::utility
    SchemaSetup["Schema Setup"]:::dbsetup
    DataSeeder["Data Seeder"]:::dbsetup

    %% Persistence
    HotelDB["HotelDB"]:::db

    %% Documentation
    README["README.md"]:::doc

    %% User flows to CLI
    Admin -->|"Select Option"| CLIRouter
    Employee -->|"Select Option"| CLIRouter
    Guest -->|"Select Option"| CLIRouter

    %% CLI to modules
    CLIRouter -->|"Route to Admin"| AdminModule
    CLIRouter -->|"Route to Employee"| EmployeeModule
    CLIRouter -->|"Route to Guest"| UserModule

    %% Modules to Utility and DB
    AdminModule -->|"Validate/Input Data"| UtilityLibrary
    EmployeeModule -->|"Validate/Input Data"| UtilityLibrary
    UserModule -->|"Validate/Input Data"| UtilityLibrary

    AdminModule -->|"Execute Query"| HotelDB
    EmployeeModule -->|"Execute Query"| HotelDB
    UserModule -->|"Execute Query"| HotelDB

    %% DB responses back to modules and CLI
    HotelDB -->|"Return Result Set"| AdminModule
    HotelDB -->|"Return Result Set"| EmployeeModule
    HotelDB -->|"Return Result Set"| UserModule

    AdminModule -->|"Render Table"| CLIRouter
    EmployeeModule -->|"Render Table"| CLIRouter
    UserModule -->|"Render Table"| CLIRouter

    CLIRouter -->|"Display"| Admin
    CLIRouter -->|"Display"| Employee
    CLIRouter -->|"Display"| Guest

    %% Initialization flows
    SchemaSetup -->|"Create Tables"| HotelDB
    DataSeeder -->|"Insert Initial Data"| HotelDB

    %% Document reference
    README -.-> CLIRouter

    %% Click Events
    click CLIRouter "https://github.com/callisto-aurelia/hotel-management/blob/main/main.py"
    click AdminModule "https://github.com/callisto-aurelia/hotel-management/blob/main/admin.py"
    click EmployeeModule "https://github.com/callisto-aurelia/hotel-management/blob/main/employee.py"
    click UserModule "https://github.com/callisto-aurelia/hotel-management/blob/main/user.py"
    click UtilityLibrary "https://github.com/callisto-aurelia/hotel-management/blob/main/funcs.py"
    click SchemaSetup "https://github.com/callisto-aurelia/hotel-management/blob/main/tables.py"
    click DataSeeder "https://github.com/callisto-aurelia/hotel-management/blob/main/sql_insertion.py"
    click README "https://github.com/callisto-aurelia/hotel-management/blob/main/README.md"

    %% Styles
    classDef actor fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef presentation fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef business fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef utility fill:#90EE90,stroke:#333,stroke-width:1px
    classDef dbsetup fill:#98FB98,stroke:#333,stroke-width:1px
    classDef db fill:#FFA500,stroke:#333,stroke-width:1px
    classDef doc fill:#F5F5F5,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
