# monika-bot-kumari/hotel_room_booking_system architecture

> Architecture diagram of the GitHub repository monika-bot-kumari/hotel_room_booking_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/monika-bot-kumari/hotel_room_booking_system
- Repository: https://github.com/monika-bot-kumari/hotel_room_booking_system

## Overview

#### Purpose and Entry Point
This is a small Python hotel-booking web application centered on user registration/login and hotel room/dashboard pages. The runtime entry point is `app.py`, which wires the application to controllers, templates, static assets, and the database layer.

#### Web Application Boundary
The application exposes server-rendered HTML pages rather than a separate frontend API. Page templates are under `templates/`, including `templates/login.html`, `templates/register.html`, `templates/dashboard.html`, and `templates/rooms.html`. Registration styling is served from `static/css/register.css`.

#### Request Routing and Controllers
Controllers define the application’s request-level behavior and separate page/auth concerns from persistence access:
- `controllers/main_controller.py` handles primary page/dashboard/room navigation.
- `controllers/auth_controller.py` handles authentication and registration flows.
- `controllers/db_controller.py` provides controller-facing database connection or query coordination.
- `app.py` is the integration point that registers or invokes these controller routes.

#### Authentication and User Lifecycle
User identity is the central modeled domain. Registration accepts user input through `templates/register.html`, passes it through `controllers/auth_controller.py`, and persists it via `models/user_model.py`. Login similarly begins at `templates/login.html` and is handled through the authentication controller before allowing access to dashboard-oriented pages.

#### Persistence Layer
The application uses a relational SQL database with a `users` table, indicated by the documented `hotel_booking.users` queries. Schema ownership is in `database/schema.sql`. Database-specific operations are isolated from route behavior through `controllers/db_controller.py` and model helpers in `models/db_helpers.py`, with `models/user_model.py` representing user-oriented reads/writes.

#### Primary Control and Data Flow
The main request flow is:
1. `app.py` receives a browser request.
2. A route/controller in `controllers/` handles page, registration, or login behavior.
3. Authentication routes call `models/user_model.py` and `models/db_helpers.py` through the database boundary.
4. SQL schema/data is stored in the database defined by `database/schema.sql`.
5. The controller renders a template from `templates/` or redirects to dashboard/room routes.

#### Runtimes and External Dependencies
The project runs as a Python server application; package dependencies are declared in `requirements.txt`. Its material external service is a SQL database containing the hotel booking data, particularly the `users` table. Browser delivery relies on the server-rendered templates and static CSS assets.

Main entry points: [`app.py`](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/app.py) (Application entry), [`controllers/auth_controller.py`](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/auth_controller.py) (Auth controller), [`controllers/main_controller.py`](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/main_controller.py) (Main controller), [`controllers/db_controller.py`](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/db_controller.py) (DB controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Application entry<br/>Python server<br/>[app.py]"]
  node_requirements["Python dependencies<br/>dependency manifest<br/>[requirements.txt]"]
end

subgraph group_controllers["Controllers"]
  node_main_controller["Main controller<br/>page routes<br/>[main_controller.py]"]
  node_auth_controller["Auth controller<br/>auth routes<br/>[auth_controller.py]"]
  node_db_controller["DB controller<br/>database boundary<br/>[db_controller.py]"]
end

subgraph group_persistence["Persistence"]
  node_user_model["User model<br/>user persistence<br/>[user_model.py]"]
  node_db_helpers["DB helpers<br/>SQL helpers<br/>[db_helpers.py]"]
  node_sql_database[("Hotel booking database<br/>SQL database")]
  node_schema["Database schema<br/>SQL schema<br/>[schema.sql]"]
end

subgraph group_ui["Server-rendered UI"]
  node_login_template["Login page<br/>HTML template<br/>[login.html]"]
  node_register_template["Registration page<br/>HTML template<br/>[register.html]"]
  node_dashboard_template["Dashboard page<br/>HTML template<br/>[dashboard.html]"]
  node_rooms_template["Rooms page<br/>HTML template<br/>[rooms.html]"]
  node_register_css["Registration styles<br/>CSS asset<br/>[register.css]"]
end

node_browser(("Browser<br/>client"))

node_browser -->|"HTTP requests"| node_app
node_app -->|"routes"| node_main_controller
node_app -->|"routes"| node_auth_controller
node_main_controller -->|"renders"| node_dashboard_template
node_main_controller -->|"renders"| node_rooms_template
node_auth_controller -->|"renders"| node_login_template
node_auth_controller -->|"renders"| node_register_template
node_register_template -->|"uses"| node_register_css
node_auth_controller -->|"database access"| node_db_controller
node_db_controller -->|"user queries"| node_user_model
node_user_model -->|"uses"| node_db_helpers
node_db_helpers -->|"SQL"| node_sql_database
node_schema -->|"defines"| node_sql_database
node_requirements -.->|"runtime packages"| node_app
node_app -.->|"HTML responses"| node_login_template

click node_app "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/app.py"
click node_main_controller "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/main_controller.py"
click node_auth_controller "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/auth_controller.py"
click node_db_controller "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/db_controller.py"
click node_user_model "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/models/user_model.py"
click node_db_helpers "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/models/db_helpers.py"
click node_schema "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/database/schema.sql"
click node_login_template "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/login.html"
click node_register_template "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/register.html"
click node_dashboard_template "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/dashboard.html"
click node_rooms_template "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/rooms.html"
click node_register_css "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/static/css/register.css"
click node_requirements "https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/requirements.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_requirements toneBlue
class node_main_controller,node_auth_controller,node_db_controller toneAmber
class node_user_model,node_db_helpers,node_sql_database,node_schema toneMint
class node_login_template,node_register_template,node_dashboard_template,node_rooms_template,node_register_css toneRose
class node_browser toneNeutral
```

## Components

### Web application

- [Application entry](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/app.py): Python server · Wires routes, controllers, UI assets, and persistence. · `app.py`
- [Python dependencies](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/requirements.txt): dependency manifest · `requirements.txt`

### Controllers

- [Main controller](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/main_controller.py): page routes · Serves navigation, dashboard, and room pages. · `controllers/main_controller.py`
- [Auth controller](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/auth_controller.py): auth routes · Handles registration and login flows. · `controllers/auth_controller.py`
- [DB controller](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/controllers/db_controller.py): database boundary · Coordinates controller-facing database access. · `controllers/db_controller.py`

### Persistence

- [User model](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/models/user_model.py): user persistence · Reads and writes user identities. · `models/user_model.py`
- [DB helpers](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/models/db_helpers.py): SQL helpers · `models/db_helpers.py`
- **Hotel booking database**: SQL database · Contains the users table and hotel-booking data.
- [Database schema](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/database/schema.sql): SQL schema · Defines the relational database structure. · `database/schema.sql`

### Server-rendered UI

- [Login page](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/login.html): HTML template · `templates/login.html`
- [Registration page](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/register.html): HTML template · `templates/register.html`
- [Dashboard page](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/dashboard.html): HTML template · `templates/dashboard.html`
- [Rooms page](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/templates/rooms.html): HTML template · `templates/rooms.html`
- [Registration styles](https://github.com/monika-bot-kumari/hotel_room_booking_system/blob/main/static/css/register.css): CSS asset · `static/css/register.css`

### Other components

- **Browser**: client

## Connections

- Browser → Application entry: HTTP requests
- Application entry → Main controller: routes
- Application entry → Auth controller: routes
- Main controller → Dashboard page: renders
- Main controller → Rooms page: renders
- Auth controller → Login page: renders
- Auth controller → Registration page: renders
- Registration page → Registration styles: uses
- Auth controller → DB controller: database access
- DB controller → User model: user queries
- User model → DB helpers: uses
- DB helpers → Hotel booking database: SQL
- Database schema → Hotel booking database: defines
- Python dependencies → Application entry: runtime packages
- Application entry → Login page: HTML responses
