# devthayron/fastapi-delivery-api architecture

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

- Interactive diagram: https://gitdiagram.com/devthayron/fastapi-delivery-api
- Repository: https://github.com/devthayron/fastapi-delivery-api

## Overview

This is a FastAPI delivery-order backend. Clients register or log in to obtain tokens; authenticated users create and manage orders, while authorization checks enforce ownership and admin access. The order workflow covers creating orders, adding or removing priced items, viewing and listing orders, and changing status. SQLAlchemy models provide the persistence layer, and Pydantic schemas validate inputs and shape selected responses. The database connection and configuration files are present in the tree but were not sampled, so their internal behavior is not detailed here.

Main entry points: [`routes/auth.py`](https://github.com/devthayron/fastapi-delivery-api/blob/main/routes/auth.py) (Auth Routes), [`routes/orders.py`](https://github.com/devthayron/fastapi-delivery-api/blob/main/routes/orders.py) (Order Routes), [`dependencies.py`](https://github.com/devthayron/fastapi-delivery-api/blob/main/dependencies.py) (Auth Dependencies), [`models/users.py`](https://github.com/devthayron/fastapi-delivery-api/blob/main/models/users.py) (User Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Entry Points"]
  node_app["FastAPI App<br/>[main.py]"]
  node_auth_routes["Auth Routes<br/>[auth.py]"]
  node_order_routes["Order Routes<br/>[orders.py]"]
end

subgraph group_identity["Identity and Access"]
  node_auth_schemas["User Schemas<br/>[users.py]"]
  node_dependencies["Auth Dependencies<br/>[dependencies.py]"]
  node_security["Token Security<br/>[security.py]"]
  node_config["Security Config<br/>[config.py]"]
end

subgraph group_orders["Order Management"]
  node_order_schemas["Order Schemas<br/>[orders.py]"]
end

subgraph group_persistence["Persistence"]
  node_user_model["User Model<br/>[users.py]"]
  node_order_model["Order Models<br/>[orders.py]"]
  node_base["ORM Base<br/>[base.py]"]
  node_db_connection["Database Connection<br/>[connection.py]"]
end

node_client(("API Client"))
node_database[("SQLite Database")]

node_client -->|"sends requests"| node_app
node_app -->|"mounts router"| node_auth_routes
node_app -->|"mounts router"| node_order_routes
node_auth_routes -->|"validates inputs"| node_auth_schemas
node_auth_routes -->|"uses sessions and verification"| node_dependencies
node_auth_routes -->|"queries and creates users"| node_user_model
node_auth_routes -->|"creates tokens"| node_security
node_auth_routes -->|"returns auth results"| node_client
node_dependencies -->|"decodes tokens"| node_security
node_dependencies -->|"loads token user"| node_user_model
node_dependencies -->|"binds sessions"| node_db_connection
node_security -->|"uses signing settings"| node_config
node_order_routes -->|"requires verified user"| node_dependencies
node_order_routes -->|"validates and shapes data"| node_order_schemas
node_order_routes -->|"queries and changes orders"| node_order_model
node_order_routes -->|"checks ownership"| node_user_model
node_order_model -->|"inherits ORM fields"| node_base
node_user_model -->|"inherits ORM fields"| node_base
node_db_connection -->|"connects to"| node_database

click node_app "https://github.com/devthayron/fastapi-delivery-api/blob/main/main.py"
click node_auth_routes "https://github.com/devthayron/fastapi-delivery-api/blob/main/routes/auth.py"
click node_order_routes "https://github.com/devthayron/fastapi-delivery-api/blob/main/routes/orders.py"
click node_auth_schemas "https://github.com/devthayron/fastapi-delivery-api/blob/main/schemas/users.py"
click node_order_schemas "https://github.com/devthayron/fastapi-delivery-api/blob/main/schemas/orders.py"
click node_dependencies "https://github.com/devthayron/fastapi-delivery-api/blob/main/dependencies.py"
click node_security "https://github.com/devthayron/fastapi-delivery-api/blob/main/core/security.py"
click node_config "https://github.com/devthayron/fastapi-delivery-api/blob/main/core/config.py"
click node_user_model "https://github.com/devthayron/fastapi-delivery-api/blob/main/models/users.py"
click node_order_model "https://github.com/devthayron/fastapi-delivery-api/blob/main/models/orders.py"
click node_base "https://github.com/devthayron/fastapi-delivery-api/blob/main/database/base.py"
click node_db_connection "https://github.com/devthayron/fastapi-delivery-api/blob/main/database/connection.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_auth_routes,node_order_routes,node_client toneBlue
class node_auth_schemas,node_dependencies,node_security,node_config,node_database toneAmber
class node_order_schemas toneMint
class node_user_model,node_order_model,node_base,node_db_connection toneRose
```

## Components

### API Entry Points

- [FastAPI App](https://github.com/devthayron/fastapi-delivery-api/blob/main/main.py): `main.py`
- [Auth Routes](https://github.com/devthayron/fastapi-delivery-api/blob/main/routes/auth.py): `routes/auth.py`
- [Order Routes](https://github.com/devthayron/fastapi-delivery-api/blob/main/routes/orders.py): `routes/orders.py`

### Identity and Access

- [User Schemas](https://github.com/devthayron/fastapi-delivery-api/blob/main/schemas/users.py): `schemas/users.py`
- [Auth Dependencies](https://github.com/devthayron/fastapi-delivery-api/blob/main/dependencies.py): `dependencies.py`
- [Token Security](https://github.com/devthayron/fastapi-delivery-api/blob/main/core/security.py): `core/security.py`
- [Security Config](https://github.com/devthayron/fastapi-delivery-api/blob/main/core/config.py): `core/config.py`

### Order Management

- [Order Schemas](https://github.com/devthayron/fastapi-delivery-api/blob/main/schemas/orders.py): `schemas/orders.py`

### Persistence

- [User Model](https://github.com/devthayron/fastapi-delivery-api/blob/main/models/users.py): `models/users.py`
- [Order Models](https://github.com/devthayron/fastapi-delivery-api/blob/main/models/orders.py): `models/orders.py`
- [ORM Base](https://github.com/devthayron/fastapi-delivery-api/blob/main/database/base.py): `database/base.py`
- [Database Connection](https://github.com/devthayron/fastapi-delivery-api/blob/main/database/connection.py): `database/connection.py`

### Other components

- **API Client**
- **SQLite Database**

## Connections

- API Client → FastAPI App: sends requests
- FastAPI App → Auth Routes: mounts router
- FastAPI App → Order Routes: mounts router
- Auth Routes → User Schemas: validates inputs
- Auth Routes → Auth Dependencies: uses sessions and verification
- Auth Routes → User Model: queries and creates users
- Auth Routes → Token Security: creates tokens
- Auth Routes → API Client: returns auth results
- Auth Dependencies → Token Security: decodes tokens
- Auth Dependencies → User Model: loads token user
- Auth Dependencies → Database Connection: binds sessions
- Token Security → Security Config: uses signing settings
- Order Routes → Auth Dependencies: requires verified user
- Order Routes → Order Schemas: validates and shapes data
- Order Routes → Order Models: queries and changes orders
- Order Routes → User Model: checks ownership
- Order Models → ORM Base: inherits ORM fields
- User Model → ORM Base: inherits ORM fields
- Database Connection → SQLite Database: connects to
