# bbi3mn4u69/debuggers-hut architecture

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

- Interactive diagram: https://gitdiagram.com/bbi3mn4u69/debuggers-hut
- Repository: https://github.com/bbi3mn4u69/debuggers-hut

## Overview

##### Project Type and Purpose
- Monolithic Python application with a CLI front-end that manages apartment bookings, computes reward points, and generates receipts.
- No separate web UI or microservices—everything runs as a single process.

##### Main Logical Components
a. Presentation Layer (CLI)
– Entry points: run.py, storage_cli.py
– Module: io_prompts.py (gather user input, validate)
b. Application Controller
– Module: main.py (orchestrates the booking flow, calls sub-modules)
c. Business Logic Layer
– Module: calculations.py (total cost, points rounding)
– Module: receipt.py (formatting receipts)
d. Data Access Layer
– Module: data_store.py (in-memory guest/room data operations)
– Module: storage_manager.py (persisting data to file or DB)
e. Configuration & Cross-Cutting
– Module: config.py (rates, guest defaults, settings)
– Logging subsystem (Python’s logging module; console + file)
f. Testing & Documentation (supporting artifacts)
– tests/ (unit tests for calculations, data_store)
– docs/ (storage and migration guides, system docs)

##### Relationships and Data Flow
1. User invokes CLI (run.py or storage_cli.py).
2. CLI → Controller (main.py): starts interactive or one-off booking.
3. Controller → Presentation (io_prompts.py): prompt for apartment ID, nights, guest name.
4. Controller → Business Logic (calculations.py): compute total cost and points.
5. Controller → Data Access (data_store.py / storage_manager.py):
- get_rate(apartment_id)
- get_guest_points(guest_name)
- add_points(guest_name, points)
6. Controller → Receipt (receipt.py): generate formatted receipt.
7. Controller → Presentation: print receipt, summary.
8. All modules emit log statements to the Logging subsystem.

##### Architectural Patterns and Principles
- Layered Architecture (Presentation → Business → Data Access)
- Single Responsibility per module (I/O, logic, persistence, formatting)
- Configuration centralization (config.py)
- Dependency direction: upper layers depend on lower layers (e.g., receipt on calculations, controller on io_prompts).

##### Technologies & Frameworks
- Python 3.x
- Standard library: logging, argparse (if used), json or file I/O
- pytest for testing
- black, flake8, mypy for code quality
- Packaging: setup.py, requirements.txt

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User CLI Shell"]:::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        Run["run.py"]:::presentation
        StorageCLI["storage_cli.py"]:::presentation
        IOPrompts["io_prompts.py"]:::presentation
    end

    %% Controller Layer
    subgraph "Application Controller"
        Main["main.py"]:::controller
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        Calc["calculations.py"]:::business
        Receipt["receipt.py"]:::business
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        DataStore["data_store.py"]:::data
        StorageMgr["storage_manager.py"]:::data
    end

    %% Cross-Cutting Concerns
    Config["config.py"]:::cross
    Logging["Logging Subsystem"]:::cross

    %% Supporting Artifacts
    subgraph "Supporting Artifacts"
        TestCalc["tests/test_calculations.py"]:::support
        TestData["tests/test_data_store.py"]:::support
        DocStorage["docs/STORAGE_SYSTEM.md"]:::support
        DocStructure["docs/STRUCTURE_MIGRATION.md"]:::support
    end

    %% Console Output
    Console["Console Output"]:::external

    %% Data Flow
    User --> Run
    User --> StorageCLI
    Run --> Main
    StorageCLI --> Main
    Main --> IOPrompts
    Main --> Calc
    Main --> DataStore
    Main --> StorageMgr
    Main --> Receipt
    Receipt --> Console

    %% Cross-Cutting Links
    Config -.-> Run
    Config -.-> StorageCLI
    Config -.-> Main
    Config -.-> IOPrompts
    Config -.-> Calc
    Config -.-> Receipt
    Config -.-> DataStore
    Config -.-> StorageMgr

    Logging -.-> Run
    Logging -.-> StorageCLI
    Logging -.-> Main
    Logging -.-> IOPrompts
    Logging -.-> Calc
    Logging -.-> Receipt
    Logging -.-> DataStore
    Logging -.-> StorageMgr

    %% Click Events
    click Run "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/run.py"
    click StorageCLI "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/storage_cli.py"
    click IOPrompts "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/src/hotel_booking/io_prompts.py"
    click Main "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/src/hotel_booking/main.py"
    click Calc "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/src/hotel_booking/calculations.py"
    click Receipt "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/src/hotel_booking/receipt.py"
    click DataStore "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/src/hotel_booking/data_store.py"
    click StorageMgr "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/src/hotel_booking/storage_manager.py"
    click Config "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/src/hotel_booking/config.py"
    click TestCalc "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/tests/test_calculations.py"
    click TestData "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/tests/test_data_store.py"
    click DocStorage "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/docs/STORAGE_SYSTEM.md"
    click DocStructure "https://github.com/bbi3mn4u69/debuggers-hut/blob/main/docs/STRUCTURE_MIGRATION.md"

    %% Styling
    classDef presentation fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef controller fill:#e6ccff,stroke:#333,stroke-width:1px
    classDef business fill:#d4edda,stroke:#333,stroke-width:1px
    classDef data fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef cross fill:#e2e3e5,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef support fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef external fill:#ffffff,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
```
