# tugrulsimsirli/hotel_reservation architecture

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

- Interactive diagram: https://gitdiagram.com/tugrulsimsirli/hotel_reservation
- Repository: https://github.com/tugrulsimsirli/hotel_reservation

## Overview

This is a FastAPI hotel-reservation API whose implemented workflow is user signup and login: requests enter through registered routes, authentication services validate or create users, and responses carry user data or tokens. The sampled hotel route only exposes a hello endpoint; the README provides no further feature detail, so no reservation workflow is inferred. The graph includes configuration, persistence, security, response handling, and the global error middleware. Relationships are limited to those shown in the sampled source and SOURCE INDEX.

Main entry points: [`app/api/routes/v1/auth_routes.py`](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/api/routes/v1/auth_routes.py) (Auth routes), [`app/main.py`](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/main.py) (FastAPI app), [`app/services/auth_service.py`](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/services/auth_service.py) (Auth service), [`app/db/base.py`](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/db/base.py) (DB sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_main["FastAPI app<br/>[main.py]"]
  node_auth_routes["Auth routes<br/>[auth_routes.py]"]
  node_hotel_routes["Hotel route<br/>[hotel_routes.py]"]
  node_error_handler["Error middleware<br/>[error_handler.py]"]
end

subgraph group_identity["Identity and responses"]
  node_auth_service["Auth service<br/>[auth_service.py]"]
  node_user_schema["User schemas<br/>[user.py]"]
  node_user_response_model["User response model<br/>[user_model.py]"]
  node_generic_models["Response models<br/>[generic.py]"]
  node_security["Password and tokens<br/>[security.py]"]
end

subgraph group_platform["Persistence and configuration"]
  node_db_base["DB sessions<br/>[base.py]"]
  node_user_table["User table<br/>[user.py]"]
  node_database[("PostgreSQL")]
  node_config["Settings<br/>[config.py]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_main
node_main -->|"registers routes"| node_auth_routes
node_main -->|"registers routes"| node_hotel_routes
node_main -->|"installs middleware"| node_error_handler
node_main -->|"creates tables"| node_db_base
node_auth_routes -->|"calls auth"| node_auth_service
node_auth_routes -->|"creates tokens"| node_security
node_auth_routes -->|"decodes refresh"| node_security
node_auth_routes -->|"gets session"| node_db_base
node_auth_routes -->|"accepts signup data"| node_user_schema
node_auth_routes -->|"returns envelope"| node_generic_models
node_auth_service -->|"queries and writes"| node_user_table
node_auth_service -->|"verifies and hashes"| node_security
node_auth_service -->|"builds responses"| node_generic_models
node_auth_service -->|"validates user"| node_user_response_model
node_user_table -->|"extends base"| node_db_base
node_db_base -->|"loads database URL"| node_config
node_db_base -->|"connects"| node_database
node_security -->|"loads auth settings"| node_config
node_error_handler -->|"formats errors"| node_generic_models

click node_main "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/main.py"
click node_auth_routes "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/api/routes/v1/auth_routes.py"
click node_hotel_routes "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/api/routes/v1/hotel_routes.py"
click node_error_handler "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/middlewares/error_handler.py"
click node_auth_service "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/services/auth_service.py"
click node_user_schema "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/schemas/user.py"
click node_user_response_model "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/models/user_model.py"
click node_generic_models "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/models/generic.py"
click node_security "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/utils/security.py"
click node_db_base "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/db/base.py"
click node_user_table "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/db/user.py"
click node_config "https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/core/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_main,node_auth_routes,node_hotel_routes,node_error_handler,node_client toneBlue
class node_auth_service,node_user_schema,node_user_response_model,node_generic_models,node_security toneAmber
class node_db_base,node_user_table,node_database,node_config toneMint
```

## Components

### API entry

- [FastAPI app](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/main.py): `app/main.py`
- [Auth routes](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/api/routes/v1/auth_routes.py): `app/api/routes/v1/auth_routes.py`
- [Hotel route](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/api/routes/v1/hotel_routes.py): `app/api/routes/v1/hotel_routes.py`
- [Error middleware](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/middlewares/error_handler.py): `app/middlewares/error_handler.py`

### Identity and responses

- [Auth service](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/services/auth_service.py): `app/services/auth_service.py`
- [User schemas](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/schemas/user.py): `app/schemas/user.py`
- [User response model](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/models/user_model.py): `app/models/user_model.py`
- [Response models](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/models/generic.py): `app/models/generic.py`
- [Password and tokens](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/utils/security.py): `app/utils/security.py`

### Persistence and configuration

- [DB sessions](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/db/base.py): `app/db/base.py`
- [User table](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/db/user.py): `app/db/user.py`
- **PostgreSQL**
- [Settings](https://github.com/tugrulsimsirli/hotel_reservation/blob/master/app/core/config.py): `app/core/config.py`

### Other components

- **API client**

## Connections

- API client → FastAPI app: sends requests (evidence: `app/main.py`)
- FastAPI app → Auth routes: registers routes (evidence: `app/main.py`)
- FastAPI app → Hotel route: registers routes (evidence: `app/main.py`)
- FastAPI app → Error middleware: installs middleware (evidence: `app/main.py`)
- FastAPI app → DB sessions: creates tables (evidence: `app/main.py`)
- Auth routes → Auth service: calls auth (evidence: `app/api/routes/v1/auth_routes.py`)
- Auth routes → Password and tokens: creates tokens (evidence: `app/api/routes/v1/auth_routes.py`)
- Auth routes → Password and tokens: decodes refresh (evidence: `app/api/routes/v1/auth_routes.py`)
- Auth routes → DB sessions: gets session (evidence: `app/api/routes/v1/auth_routes.py`)
- Auth routes → User schemas: accepts signup data (evidence: `app/api/routes/v1/auth_routes.py`)
- Auth routes → Response models: returns envelope (evidence: `app/api/routes/v1/auth_routes.py`)
- Auth service → User table: queries and writes (evidence: `app/services/auth_service.py`)
- Auth service → Password and tokens: verifies and hashes (evidence: `app/services/auth_service.py`)
- Auth service → Response models: builds responses (evidence: `app/services/auth_service.py`)
- Auth service → User response model: validates user (evidence: `app/services/auth_service.py`)
- User table → DB sessions: extends base (evidence: `app/db/user.py`)
- DB sessions → Settings: loads database URL (evidence: `app/db/base.py`)
- DB sessions → PostgreSQL: connects (evidence: `app/db/base.py`)
- Password and tokens → Settings: loads auth settings (evidence: `app/utils/security.py`)
- Error middleware → Response models: formats errors (evidence: `app/middlewares/error_handler.py`)
