# uep1x/todo-auth architecture

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

- Interactive diagram: https://gitdiagram.com/uep1x/todo-auth
- Repository: https://github.com/uep1x/todo-auth

## Overview

This is a FastAPI backend for account signup, login and logout, plus retrieval of a user’s items using an access cookie. Requests enter through the application router and endpoint handlers; authentication handlers coordinate user/item CRUD, credential encryption and cookie generation, while the item handler retrieves and maps item data. SQLAlchemy models represent users and items, backed by a PostgreSQL-configured engine. The graph follows shown calls and SOURCE INDEX references; it does not infer unshown database wiring beyond the session configuration.

Main entry points: [`backend/app/api/endpoints/auth.py`](https://github.com/uep1x/todo-auth/blob/main/backend/app/api/endpoints/auth.py) (Auth endpoints), [`backend/app/api/endpoints/item.py`](https://github.com/uep1x/todo-auth/blob/main/backend/app/api/endpoints/item.py) (Item endpoint), [`backend/app/main.py`](https://github.com/uep1x/todo-auth/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/schemas/mappers.py`](https://github.com/uep1x/todo-auth/blob/main/backend/app/schemas/mappers.py) (ORM mappers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_app["FastAPI app<br/>[main.py]"]
  node_router["API router<br/>[api.py]"]
  node_db_dep["DB dependency<br/>[deps.py]"]
end

subgraph group_domain["Account and items"]
  node_auth["Auth endpoints<br/>[auth.py]"]
  node_items_api["Item endpoint<br/>[item.py]"]
end

subgraph group_data["Persistence"]
  node_user_crud["User CRUD<br/>[user.py]"]
  node_item_crud["Item CRUD<br/>[item.py]"]
  node_models["ORM models<br/>[models.py]"]
  node_session["DB session<br/>[session.py]"]
end

subgraph group_support["Schemas and security"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_mappers["ORM mappers<br/>[mappers.py]"]
  node_crypt["Credential crypto<br/>[crypt.py]"]
  node_cookie["Cookie generator"]
end

node_client(("API client"))
node_postgres[("PostgreSQL")]

node_client -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_router
node_app -->|"creates tables"| node_session
node_app -->|"creates tables"| node_models
node_router -->|"registers routes"| node_auth
node_router -->|"registers routes"| node_items_api
node_auth -->|"requests session"| node_db_dep
node_items_api -->|"requests session"| node_db_dep
node_db_dep -->|"opens session"| node_session
node_auth -->|"validates payload"| node_schemas
node_items_api -->|"validates payload"| node_schemas
node_auth -->|"manages accounts"| node_user_crud
node_auth -->|"manages cookies"| node_item_crud
node_items_api -->|"fetches items"| node_item_crud
node_auth -->|"checks passwords"| node_crypt
node_auth -->|"generates cookie"| node_cookie
node_cookie -->|"encrypts token"| node_crypt
node_auth -->|"maps user"| node_mappers
node_items_api -->|"maps items"| node_mappers
node_user_crud -->|"queries users"| node_models
node_item_crud -->|"queries items"| node_models
node_mappers -->|"reads ORM fields"| node_models
node_mappers -->|"builds models"| node_schemas
node_session -->|"configures engine"| node_postgres

click node_app "https://github.com/uep1x/todo-auth/blob/main/backend/app/main.py"
click node_router "https://github.com/uep1x/todo-auth/blob/main/backend/app/api/api.py"
click node_auth "https://github.com/uep1x/todo-auth/blob/main/backend/app/api/endpoints/auth.py"
click node_items_api "https://github.com/uep1x/todo-auth/blob/main/backend/app/api/endpoints/item.py"
click node_db_dep "https://github.com/uep1x/todo-auth/blob/main/backend/app/api/deps.py"
click node_user_crud "https://github.com/uep1x/todo-auth/blob/main/backend/app/crud/user.py"
click node_item_crud "https://github.com/uep1x/todo-auth/blob/main/backend/app/crud/item.py"
click node_models "https://github.com/uep1x/todo-auth/blob/main/backend/app/models/models.py"
click node_session "https://github.com/uep1x/todo-auth/blob/main/backend/app/db/session.py"
click node_schemas "https://github.com/uep1x/todo-auth/blob/main/backend/app/schemas/schemas.py"
click node_mappers "https://github.com/uep1x/todo-auth/blob/main/backend/app/schemas/mappers.py"
click node_crypt "https://github.com/uep1x/todo-auth/blob/main/backend/app/services/crypt.py"
click node_cookie "https://github.com/uep1x/todo-auth/blob/main/backend/app/services/generation_cookie.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_router,node_db_dep,node_client toneBlue
class node_auth,node_items_api,node_postgres toneAmber
class node_user_crud,node_item_crud,node_models,node_session toneMint
class node_schemas,node_mappers,node_crypt,node_cookie toneRose
```

## Components

### API entry

- [FastAPI app](https://github.com/uep1x/todo-auth/blob/main/backend/app/main.py): `backend/app/main.py`
- [API router](https://github.com/uep1x/todo-auth/blob/main/backend/app/api/api.py): `backend/app/api/api.py`
- [DB dependency](https://github.com/uep1x/todo-auth/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`

### Account and items

- [Auth endpoints](https://github.com/uep1x/todo-auth/blob/main/backend/app/api/endpoints/auth.py): `backend/app/api/endpoints/auth.py`
- [Item endpoint](https://github.com/uep1x/todo-auth/blob/main/backend/app/api/endpoints/item.py): `backend/app/api/endpoints/item.py`

### Persistence

- [User CRUD](https://github.com/uep1x/todo-auth/blob/main/backend/app/crud/user.py): `backend/app/crud/user.py`
- [Item CRUD](https://github.com/uep1x/todo-auth/blob/main/backend/app/crud/item.py): `backend/app/crud/item.py`
- [ORM models](https://github.com/uep1x/todo-auth/blob/main/backend/app/models/models.py): `backend/app/models/models.py`
- [DB session](https://github.com/uep1x/todo-auth/blob/main/backend/app/db/session.py): `backend/app/db/session.py`

### Schemas and security

- [Request schemas](https://github.com/uep1x/todo-auth/blob/main/backend/app/schemas/schemas.py): `backend/app/schemas/schemas.py`
- [ORM mappers](https://github.com/uep1x/todo-auth/blob/main/backend/app/schemas/mappers.py): `backend/app/schemas/mappers.py`
- [Credential crypto](https://github.com/uep1x/todo-auth/blob/main/backend/app/services/crypt.py): `backend/app/services/crypt.py`
- [Cookie generator](https://github.com/uep1x/todo-auth/blob/main/backend/app/services/generation_cookie.py): `backend/app/services/generation_cookie.py`

### Other components

- **API client**
- **PostgreSQL**

## Connections

- API client → FastAPI app: sends requests
- FastAPI app → API router: mounts routes (evidence: `backend/app/main.py`)
- FastAPI app → DB session: creates tables (evidence: `backend/app/main.py`)
- FastAPI app → ORM models: creates tables (evidence: `backend/app/main.py`)
- API router → Auth endpoints: registers routes (evidence: `backend/app/api/api.py`)
- API router → Item endpoint: registers routes (evidence: `backend/app/api/api.py`)
- Auth endpoints → DB dependency: requests session (evidence: `backend/app/api/endpoints/auth.py`)
- Item endpoint → DB dependency: requests session (evidence: `backend/app/api/endpoints/item.py`)
- DB dependency → DB session: opens session (evidence: `backend/app/api/deps.py`)
- Auth endpoints → Request schemas: validates payload (evidence: `backend/app/api/endpoints/auth.py`)
- Item endpoint → Request schemas: validates payload (evidence: `backend/app/api/endpoints/item.py`)
- Auth endpoints → User CRUD: manages accounts (evidence: `backend/app/api/endpoints/auth.py`)
- Auth endpoints → Item CRUD: manages cookies (evidence: `backend/app/api/endpoints/auth.py`)
- Item endpoint → Item CRUD: fetches items (evidence: `backend/app/api/endpoints/item.py`)
- Auth endpoints → Credential crypto: checks passwords (evidence: `backend/app/api/endpoints/auth.py`)
- Auth endpoints → Cookie generator: generates cookie (evidence: `backend/app/api/endpoints/auth.py`)
- Cookie generator → Credential crypto: encrypts token (evidence: `backend/app/services/generation_cookie.py`)
- Auth endpoints → ORM mappers: maps user (evidence: `backend/app/api/endpoints/auth.py`)
- Item endpoint → ORM mappers: maps items (evidence: `backend/app/api/endpoints/item.py`)
- User CRUD → ORM models: queries users (evidence: `backend/app/crud/user.py`)
- Item CRUD → ORM models: queries items (evidence: `backend/app/crud/item.py`)
- ORM mappers → ORM models: reads ORM fields (evidence: `backend/app/schemas/mappers.py`)
- ORM mappers → Request schemas: builds models (evidence: `backend/app/schemas/mappers.py`)
- DB session → PostgreSQL: configures engine (evidence: `backend/app/db/session.py`)
