# vmkmanoj/hotel-booking-backend-genworx architecture

> Architecture diagram of the GitHub repository vmkmanoj/hotel-booking-backend-genworx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vmkmanoj/hotel-booking-backend-genworx
- Repository: https://github.com/vmkmanoj/hotel-booking-backend-genworx

## Overview

#### Purpose and Entry Points
This is a Python backend for property/rental management: authentication, users/roles/permissions, properties, addresses, amenities, images, favorites, and administrative dashboards. The application entry point is `main.py`; API route composition is centralized in `app/routers.py`.

#### HTTP API Layer
Feature-scoped API modules expose request handlers for domain operations, including auth, properties, addresses, amenities, favorites, and administration. Representative boundaries are `app/api/auth/auth.py`, `app/api/property/property_api.py`, and `app/api/super_admin/super_admin.py`. The API layer should translate HTTP input/output only and delegate business work to services.

#### Service Layer
Services coordinate use cases, validation-oriented schemas, authorization-related logic, and repository calls. Core workflow services are `app/services/auth_service.py`, `app/services/property_service.py`, and `app/services/super_admin_service.py`. Supporting service modules cover address, amenities, property images/amenities, favorites, and dashboard aggregation.

#### Persistence and Domain Model
SQLAlchemy-style database setup is separated into base metadata and engine/session concerns at `app/database/base.py` and `app/database/engine.py`. Persistent domain entities model users/access control and property inventory: `app/models/users.py`, `app/models/property.py`, and `app/models/roles.py`; related models include addresses, amenities, image associations, favorites, permissions, and role-permission mappings.

#### Repository Boundary
Repositories encapsulate database reads/writes and keep query behavior out of HTTP handlers. Important data-access components include `app/repositories/auth_repositories.py`, `app/repositories/property_repository.py`, and `app/repositories/super_admin_repository.py`. The expected flow is API handler → service → repository → database models/session, with schemas carrying typed payloads across API/service boundaries.

#### Identity and Authorization
Authentication uses password hashing and JWT/security utilities in `app/utils/passwordhashing.py`, `app/utils/jwt.py`, and `app/utils/security.py`. Access control is data-driven through user, role, permission, and role-permission entities, grounded in `app/models/users.py`, `app/models/permissions.py`, and `app/models/roles_permission.py`.

#### Schema, Migration, and Operations
Pydantic-like request/response contracts live under `app/schema/`, notably `app/schema/auth.py`, `app/schema/property_schema.py`, and `app/schema/ApiResponce.py`. Alembic manages relational schema evolution from `app/alembic/env.py` and migration versions such as `app/alembic/versions/950d93e97acd_create_property_table.py`. Seed initialization is available at `app/seed/seed_data.py`. Runtime configuration likely comes from environment variables (`.env`); dependency/runtime metadata is in `pyproject.toml` and `uv.lock`.

Main entry points: [`app/routers.py`](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/routers.py) (Router composition), [`app/database/engine.py`](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/database/engine.py) (Database engine and sessions), [`app/api/auth/auth.py`](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/auth/auth.py) (Auth API), [`app/api/property/property_api.py`](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/property/property_api.py) (Property API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application Runtime"]
  node_main["Application entry point<br/>Python application<br/>[main.py]"]
  node_router_composition["Router composition<br/>route registry<br/>[routers.py]"]
end

subgraph group_api["HTTP API"]
  node_auth_api["Auth API<br/>HTTP handlers<br/>[auth.py]"]
  node_property_api["Property API<br/>HTTP handlers<br/>[property_api.py]"]
  node_admin_api["Admin API<br/>HTTP handlers<br/>[super_admin.py]"]
  node_schemas["Request and response schemas<br/>Pydantic contracts<br/>[property_schema.py]"]
end

subgraph group_domain["Services &amp; Data Access"]
  node_auth_service["Auth service<br/>use-case service<br/>[auth_service.py]"]
  node_property_service["Property service<br/>use-case service"]
  node_admin_service["Admin service<br/>use-case service"]
  node_security_utils{{"JWT and password security<br/>security utilities<br/>[jwt.py]"}}
  node_auth_repository["Auth repository<br/>data access"]
  node_property_repository["Property repository<br/>data access"]
  node_admin_repository["Admin repository<br/>data access"]
end

subgraph group_persistence["Persistence &amp; Operations"]
  node_access_models[("Users, roles, permissions<br/>access-control entities<br/>[users.py]")]
  node_property_models[("Property inventory entities<br/>domain entities<br/>[property.py]")]
  node_db_engine[("Database engine and sessions<br/>SQLAlchemy runtime<br/>[engine.py]")]
  node_migrations["Alembic migrations<br/>schema evolution<br/>[env.py]"]
  node_seed_data["Seed initialization<br/>database bootstrap<br/>[seed_data.py]"]
end

node_main -->|"starts"| node_router_composition
node_router_composition -->|"mounts"| node_auth_api
node_router_composition -->|"mounts"| node_property_api
node_router_composition -->|"mounts"| node_admin_api
node_auth_api -->|"validates payloads"| node_schemas
node_property_api -->|"validates payloads"| node_schemas
node_admin_api -->|"uses contracts"| node_schemas
node_auth_api -->|"delegates"| node_auth_service
node_property_api -->|"delegates"| node_property_service
node_admin_api -->|"delegates"| node_admin_service
node_auth_service -->|"hashes and issues tokens"| node_security_utils
node_auth_service -->|"queries identity"| node_auth_repository
node_property_service -->|"manages inventory"| node_property_repository
node_admin_service -->|"aggregates administration"| node_admin_repository
node_auth_repository -->|"persists"| node_access_models
node_property_repository -->|"persists"| node_property_models
node_admin_repository -->|"reads access data"| node_access_models
node_admin_repository -->|"reads inventory data"| node_property_models
node_access_models -->|"uses session"| node_db_engine
node_property_models -->|"uses session"| node_db_engine
node_migrations -->|"evolves schema"| node_db_engine
node_seed_data -->|"initializes data"| node_db_engine

click node_main "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/main.py"
click node_router_composition "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/routers.py"
click node_auth_api "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/auth/auth.py"
click node_property_api "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/property/property_api.py"
click node_admin_api "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/super_admin/super_admin.py"
click node_schemas "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/schema/property_schema.py"
click node_auth_service "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/services/auth_service.py"
click node_property_service "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/services/property_service.py"
click node_admin_service "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/services/super_admin_service.py"
click node_security_utils "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/utils/jwt.py"
click node_auth_repository "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/repositories/auth_repositories.py"
click node_property_repository "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/repositories/property_repository.py"
click node_admin_repository "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/repositories/super_admin_repository.py"
click node_access_models "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/models/users.py"
click node_property_models "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/models/property.py"
click node_db_engine "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/database/engine.py"
click node_migrations "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/alembic/env.py"
click node_seed_data "https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/seed/seed_data.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_main,node_router_composition toneBlue
class node_auth_api,node_property_api,node_admin_api,node_schemas toneAmber
class node_auth_service,node_property_service,node_admin_service,node_security_utils,node_auth_repository,node_property_repository,node_admin_repository toneMint
class node_access_models,node_property_models,node_db_engine,node_migrations,node_seed_data toneRose
```

## Components

### Application Runtime

- [Application entry point](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/main.py): Python application · `main.py`
- [Router composition](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/routers.py): route registry · `app/routers.py`

### HTTP API

- [Auth API](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/auth/auth.py): HTTP handlers · `app/api/auth/auth.py`
- [Property API](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/property/property_api.py): HTTP handlers · `app/api/property/property_api.py`
- [Admin API](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/api/super_admin/super_admin.py): HTTP handlers · `app/api/super_admin/super_admin.py`
- [Request and response schemas](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/schema/property_schema.py): Pydantic contracts · Typed payloads shared by API and services. · `app/schema/property_schema.py`

### Services & Data Access

- [Auth service](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/services/auth_service.py): use-case service · `app/services/auth_service.py`
- [Property service](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/services/property_service.py): use-case service · `app/services/property_service.py`
- [Admin service](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/services/super_admin_service.py): use-case service · Coordinates administrative and dashboard workflows. · `app/services/super_admin_service.py`
- [JWT and password security](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/utils/jwt.py): security utilities · `app/utils/jwt.py`
- [Auth repository](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/repositories/auth_repositories.py): data access · `app/repositories/auth_repositories.py`
- [Property repository](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/repositories/property_repository.py): data access · `app/repositories/property_repository.py`
- [Admin repository](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/repositories/super_admin_repository.py): data access · `app/repositories/super_admin_repository.py`

### Persistence & Operations

- [Users, roles, permissions](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/models/users.py): access-control entities · Data-driven identity and role-permission mappings. · `app/models/users.py`
- [Property inventory entities](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/models/property.py): domain entities · Properties, addresses, amenities, images, and favorites. · `app/models/property.py`
- [Database engine and sessions](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/database/engine.py): SQLAlchemy runtime · `app/database/engine.py`
- [Alembic migrations](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/alembic/env.py): schema evolution · `app/alembic/env.py`
- [Seed initialization](https://github.com/vmkmanoj/hotel-booking-backend-genworx/blob/main/app/seed/seed_data.py): database bootstrap · `app/seed/seed_data.py`

## Connections

- Application entry point → Router composition: starts
- Router composition → Auth API: mounts
- Router composition → Property API: mounts
- Router composition → Admin API: mounts
- Auth API → Request and response schemas: validates payloads
- Property API → Request and response schemas: validates payloads
- Admin API → Request and response schemas: uses contracts
- Auth API → Auth service: delegates
- Property API → Property service: delegates
- Admin API → Admin service: delegates
- Auth service → JWT and password security: hashes and issues tokens
- Auth service → Auth repository: queries identity
- Property service → Property repository: manages inventory
- Admin service → Admin repository: aggregates administration
- Auth repository → Users, roles, permissions: persists
- Property repository → Property inventory entities: persists
- Admin repository → Users, roles, permissions: reads access data
- Admin repository → Property inventory entities: reads inventory data
- Users, roles, permissions → Database engine and sessions: uses session
- Property inventory entities → Database engine and sessions: uses session
- Alembic migrations → Database engine and sessions: evolves schema
- Seed initialization → Database engine and sessions: initializes data
