# dimaszelm/hotelspet architecture

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

- Interactive diagram: https://gitdiagram.com/dimaszelm/hotelspet
- Repository: https://github.com/dimaszelm/hotelspet

## Overview

This is a FastAPI hotel-booking service. Clients authenticate, browse available hotels and rooms, create or cancel bookings, and receive booking-confirmation email; administrators have a separate management interface. The application entry point registers the API routers and initializes Redis-backed caching, metrics, and admin views. Persistence is organized around SQLAlchemy models and DAO access. The README is empty, so broader capability details come from the file tree and source index; unsampled integrations are shown only where their wiring is evidenced.

Main entry points: [`app/main.py`](https://github.com/dimaszelm/hotelspet/blob/main/app/main.py) (FastAPI application), [`app/admin/views.py`](https://github.com/dimaszelm/hotelspet/blob/main/app/admin/views.py) (Admin interface), [`app/tasks/tasks.py`](https://github.com/dimaszelm/hotelspet/blob/main/app/tasks/tasks.py) (Background tasks), [`app/users/router.py`](https://github.com/dimaszelm/hotelspet/blob/main/app/users/router.py) (User API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry and operations"]
  node_app["FastAPI application<br/>[main.py]"]
  node_metrics["Metrics endpoints<br/>[router.py]"]
  node_admin["Admin interface<br/>[views.py]"]
  node_pages["Page routes<br/>[router.py]"]
  node_settings["Application settings<br/>[config.py]"]
end

subgraph group_identity["Users and authentication"]
  node_auth_admin["Admin authentication<br/>[auth.py]"]
  node_user_api["User API<br/>[router.py]"]
  node_user_auth["Token authentication<br/>[auth.py]"]
  node_user_deps["Current-user dependency<br/>[dependencies.py]"]
end

subgraph group_catalog["Hotel and room catalog"]
  node_hotel_api["Hotel API<br/>[router.py]"]
  node_hotel_dao["Hotel availability<br/>[dao.py]"]
  node_room_api["Room API<br/>[router.py]"]
  node_room_dao["Room data access<br/>[dao.py]"]
  node_image_api["Image upload API<br/>[router.py]"]
end

subgraph group_booking["Booking and notifications"]
  node_booking_api["Booking API<br/>[router.py]"]
  node_booking_dao["Booking operations<br/>[dao.py]"]
  node_tasks["Background tasks<br/>[tasks.py]"]
  node_task_runtime["Task runtime"]
  node_email_templates["Email templates<br/>[email_templates.py]"]
end

subgraph group_persistence["Persistence"]
  node_user_dao["User data access<br/>[dao.py]"]
  node_user_model[("User records<br/>[models.py]")]
  node_hotel_model[("Hotel records<br/>[models.py]")]
  node_room_model[("Room records<br/>[models.py]")]
  node_booking_model[("Booking records<br/>[models.py]")]
  node_db[("SQLAlchemy sessions<br/>[database.py]")]
  node_dao_base["Base DAO<br/>[base.py]"]
end

node_client(("API client"))
node_redis[("Redis cache")]
node_smtp["SMTP service"]

node_client -->|"sends requests"| node_app
node_app -->|"registers router"| node_user_api
node_app -->|"registers router"| node_booking_api
node_app -->|"registers router"| node_hotel_api
node_app -->|"registers router"| node_room_api
node_app -->|"registers router"| node_image_api
node_app -->|"registers router"| node_pages
node_app -->|"registers router"| node_metrics
node_app -->|"registers views"| node_admin
node_app -->|"configures authentication"| node_auth_admin
node_app -->|"uses engine"| node_db
node_app -->|"initializes cache"| node_redis
node_app -->|"reads settings"| node_settings
node_user_api -->|"authenticates users"| node_user_auth
node_user_api -->|"requires current user"| node_user_deps
node_user_api -->|"queries users"| node_user_dao
node_user_deps -->|"loads user"| node_user_dao
node_user_dao -->|"accesses records"| node_user_model
node_hotel_api -->|"queries availability"| node_hotel_dao
node_hotel_dao -->|"accesses records"| node_hotel_model
node_room_api -->|"queries rooms"| node_room_dao
node_room_dao -->|"accesses records"| node_room_model
node_booking_api -->|"requires current user"| node_user_deps
node_booking_api -->|"creates and queries"| node_booking_dao
node_booking_dao -->|"accesses records"| node_booking_model
node_booking_api -->|"queues confirmation"| node_tasks
node_tasks -->|"registers tasks"| node_task_runtime
node_tasks -->|"builds message"| node_email_templates
node_tasks -->|"sends email"| node_smtp
node_dao_base -->|"opens sessions"| node_db
node_user_dao -.->|"inherits access"| node_dao_base
node_admin -->|"manages records"| node_user_model
node_admin -->|"manages records"| node_booking_model
node_admin -->|"manages records"| node_hotel_model
node_admin -->|"manages records"| node_room_model
node_image_api -.->|"may queue processing"| node_tasks

click node_app "https://github.com/dimaszelm/hotelspet/blob/main/app/main.py"
click node_metrics "https://github.com/dimaszelm/hotelspet/blob/main/app/prometheus/router.py"
click node_admin "https://github.com/dimaszelm/hotelspet/blob/main/app/admin/views.py"
click node_auth_admin "https://github.com/dimaszelm/hotelspet/blob/main/app/admin/auth.py"
click node_user_api "https://github.com/dimaszelm/hotelspet/blob/main/app/users/router.py"
click node_user_auth "https://github.com/dimaszelm/hotelspet/blob/main/app/users/auth.py"
click node_user_deps "https://github.com/dimaszelm/hotelspet/blob/main/app/users/dependencies.py"
click node_user_dao "https://github.com/dimaszelm/hotelspet/blob/main/app/users/dao.py"
click node_user_model "https://github.com/dimaszelm/hotelspet/blob/main/app/users/models.py"
click node_hotel_api "https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/router.py"
click node_hotel_dao "https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/dao.py"
click node_hotel_model "https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/models.py"
click node_room_api "https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/rooms/router.py"
click node_room_dao "https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/rooms/dao.py"
click node_room_model "https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/rooms/models.py"
click node_booking_api "https://github.com/dimaszelm/hotelspet/blob/main/app/bookings/router.py"
click node_booking_dao "https://github.com/dimaszelm/hotelspet/blob/main/app/bookings/dao.py"
click node_booking_model "https://github.com/dimaszelm/hotelspet/blob/main/app/bookings/models.py"
click node_tasks "https://github.com/dimaszelm/hotelspet/blob/main/app/tasks/tasks.py"
click node_task_runtime "https://github.com/dimaszelm/hotelspet/blob/main/app/tasks/background_tasks.py"
click node_email_templates "https://github.com/dimaszelm/hotelspet/blob/main/app/tasks/email_templates.py"
click node_image_api "https://github.com/dimaszelm/hotelspet/blob/main/app/images/router.py"
click node_pages "https://github.com/dimaszelm/hotelspet/blob/main/app/pages/router.py"
click node_db "https://github.com/dimaszelm/hotelspet/blob/main/app/database.py"
click node_dao_base "https://github.com/dimaszelm/hotelspet/blob/main/app/DAO/base.py"
click node_settings "https://github.com/dimaszelm/hotelspet/blob/main/app/config.py"

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_metrics,node_admin,node_pages,node_settings,node_client toneBlue
class node_auth_admin,node_user_api,node_user_auth,node_user_deps,node_redis toneAmber
class node_hotel_api,node_hotel_dao,node_room_api,node_room_dao,node_image_api toneMint
class node_booking_api,node_booking_dao,node_tasks,node_task_runtime,node_email_templates toneRose
class node_user_dao,node_user_model,node_hotel_model,node_room_model,node_booking_model,node_db,node_dao_base,node_smtp toneIndigo
```

## Components

### API entry and operations

- [FastAPI application](https://github.com/dimaszelm/hotelspet/blob/main/app/main.py): `app/main.py`
- [Metrics endpoints](https://github.com/dimaszelm/hotelspet/blob/main/app/prometheus/router.py): `app/prometheus/router.py`
- [Admin interface](https://github.com/dimaszelm/hotelspet/blob/main/app/admin/views.py): `app/admin/views.py`
- [Page routes](https://github.com/dimaszelm/hotelspet/blob/main/app/pages/router.py): `app/pages/router.py`
- [Application settings](https://github.com/dimaszelm/hotelspet/blob/main/app/config.py): `app/config.py`

### Users and authentication

- [Admin authentication](https://github.com/dimaszelm/hotelspet/blob/main/app/admin/auth.py): `app/admin/auth.py`
- [User API](https://github.com/dimaszelm/hotelspet/blob/main/app/users/router.py): `app/users/router.py`
- [Token authentication](https://github.com/dimaszelm/hotelspet/blob/main/app/users/auth.py): `app/users/auth.py`
- [Current-user dependency](https://github.com/dimaszelm/hotelspet/blob/main/app/users/dependencies.py): `app/users/dependencies.py`

### Hotel and room catalog

- [Hotel API](https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/router.py): `app/hotels/router.py`
- [Hotel availability](https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/dao.py): `app/hotels/dao.py`
- [Room API](https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/rooms/router.py): `app/hotels/rooms/router.py`
- [Room data access](https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/rooms/dao.py): `app/hotels/rooms/dao.py`
- [Image upload API](https://github.com/dimaszelm/hotelspet/blob/main/app/images/router.py): `app/images/router.py`

### Booking and notifications

- [Booking API](https://github.com/dimaszelm/hotelspet/blob/main/app/bookings/router.py): `app/bookings/router.py`
- [Booking operations](https://github.com/dimaszelm/hotelspet/blob/main/app/bookings/dao.py): `app/bookings/dao.py`
- [Background tasks](https://github.com/dimaszelm/hotelspet/blob/main/app/tasks/tasks.py): `app/tasks/tasks.py`
- [Task runtime](https://github.com/dimaszelm/hotelspet/blob/main/app/tasks/background_tasks.py): `app/tasks/background_tasks.py`
- [Email templates](https://github.com/dimaszelm/hotelspet/blob/main/app/tasks/email_templates.py): `app/tasks/email_templates.py`

### Persistence

- [User data access](https://github.com/dimaszelm/hotelspet/blob/main/app/users/dao.py): `app/users/dao.py`
- [User records](https://github.com/dimaszelm/hotelspet/blob/main/app/users/models.py): `app/users/models.py`
- [Hotel records](https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/models.py): `app/hotels/models.py`
- [Room records](https://github.com/dimaszelm/hotelspet/blob/main/app/hotels/rooms/models.py): `app/hotels/rooms/models.py`
- [Booking records](https://github.com/dimaszelm/hotelspet/blob/main/app/bookings/models.py): `app/bookings/models.py`
- [SQLAlchemy sessions](https://github.com/dimaszelm/hotelspet/blob/main/app/database.py): `app/database.py`
- [Base DAO](https://github.com/dimaszelm/hotelspet/blob/main/app/DAO/base.py): `app/DAO/base.py`

### Other components

- **API client**
- **Redis cache**
- **SMTP service**

## Connections

- API client → FastAPI application: sends requests (evidence: `app/main.py`)
- FastAPI application → User API: registers router (evidence: `app/main.py`)
- FastAPI application → Booking API: registers router (evidence: `app/main.py`)
- FastAPI application → Hotel API: registers router (evidence: `app/main.py`)
- FastAPI application → Room API: registers router (evidence: `app/main.py`)
- FastAPI application → Image upload API: registers router (evidence: `app/main.py`)
- FastAPI application → Page routes: registers router (evidence: `app/main.py`)
- FastAPI application → Metrics endpoints: registers router (evidence: `app/main.py`)
- FastAPI application → Admin interface: registers views (evidence: `app/main.py`)
- FastAPI application → Admin authentication: configures authentication (evidence: `app/main.py`)
- FastAPI application → SQLAlchemy sessions: uses engine (evidence: `app/main.py`)
- FastAPI application → Redis cache: initializes cache (evidence: `app/main.py`)
- FastAPI application → Application settings: reads settings (evidence: `app/main.py`)
- User API → Token authentication: authenticates users (evidence: `app/users/router.py`)
- User API → Current-user dependency: requires current user (evidence: `app/users/router.py`)
- User API → User data access: queries users (evidence: `app/users/router.py`)
- Current-user dependency → User data access: loads user (evidence: `app/users/dependencies.py`)
- User data access → User records: accesses records (evidence: `app/users/dao.py`)
- Hotel API → Hotel availability: queries availability (evidence: `app/hotels/router.py`)
- Hotel availability → Hotel records: accesses records (evidence: `app/hotels/dao.py`)
- Room API → Room data access: queries rooms (evidence: `app/hotels/rooms/router.py`)
- Room data access → Room records: accesses records (evidence: `app/hotels/rooms/dao.py`)
- Booking API → Current-user dependency: requires current user (evidence: `app/bookings/router.py`)
- Booking API → Booking operations: creates and queries (evidence: `app/bookings/router.py`)
- Booking operations → Booking records: accesses records (evidence: `app/bookings/dao.py`)
- Booking API → Background tasks: queues confirmation (evidence: `app/bookings/router.py`)
- Background tasks → Task runtime: registers tasks (evidence: `app/tasks/tasks.py`)
- Background tasks → Email templates: builds message (evidence: `app/tasks/tasks.py`)
- Background tasks → SMTP service: sends email (evidence: `app/tasks/tasks.py`)
- Base DAO → SQLAlchemy sessions: opens sessions (evidence: `app/DAO/base.py`)
- User data access → Base DAO: inherits access (evidence: `app/users/dao.py`)
- Admin interface → User records: manages records (evidence: `app/admin/views.py`)
- Admin interface → Booking records: manages records (evidence: `app/admin/views.py`)
- Admin interface → Hotel records: manages records (evidence: `app/admin/views.py`)
- Admin interface → Room records: manages records (evidence: `app/admin/views.py`)
- Image upload API → Background tasks: may queue processing (evidence: `app/images/router.py`)
