# sgtp3pp3r/api-de-recuperacion-de-cuentas architecture

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

- Interactive diagram: https://gitdiagram.com/sgtp3pp3r/api-de-recuperacion-de-cuentas
- Repository: https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas

## Overview

This is a FastAPI account-authentication and password-recovery API. Clients register or log in, use JWTs for protected profile and password-change operations, and can request an emailed reset token and submit it with a new password. The documented reset token is six digits and expires after 15 minutes. The graph reflects the endpoint-to-service-to-repository flow visible in excerpts; the README documents the API capabilities and Gmail SMTP integration. The separate core configuration and security modules are present, but their runtime use is not established by the excerpts.

Main entry points: [`app/services/user_service.py`](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/user_service.py) (User workflows), [`app/services/auth_service.py`](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/auth_service.py) (JWT and password auth), [`app/endpoints/auth.py`](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/endpoints/auth.py) (Auth endpoints), [`app/database.py`](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/database.py) (SQL database and sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_application["FastAPI application<br/>[main.py]"]
  node_auth_routes["Auth endpoints<br/>[auth.py]"]
  node_schemas["Request and response schemas<br/>[user.py]"]
end

subgraph group_accounts["Account workflows"]
  node_user_workflows["User workflows<br/>[user_service.py]"]
  node_auth_service["JWT and password auth<br/>[auth_service.py]"]
  node_email_service["Recovery email<br/>[email_service.py]"]
end

subgraph group_persistence["Persistence"]
  node_user_repository["User repository<br/>[user_repository.py]"]
  node_user_model["User ORM model<br/>[user.py]"]
  node_database[("SQL database and sessions<br/>[database.py]")]
end

subgraph group_configuration["Configuration and security"]
  node_settings["Application settings<br/>[config.py]"]
  node_core_settings["Core settings<br/>[config.py]"]
  node_core_security["Core security module<br/>[security.py]"]
end

node_client(("API client"))
node_smtp["Gmail SMTP"]

node_client -->|"sends HTTP requests"| node_application
node_application -->|"registers router"| node_auth_routes
node_application -->|"creates tables"| node_database
node_auth_routes -->|"dispatches workflows"| node_user_workflows
node_auth_routes -->|"resolves current user"| node_auth_service
node_auth_routes -->|"validates and responds"| node_schemas
node_user_workflows -->|"reads and writes users"| node_user_repository
node_user_workflows -->|"hashes and verifies passwords"| node_auth_service
node_user_workflows -->|"sends recovery notices"| node_email_service
node_email_service -->|"sends email"| node_smtp
node_auth_service -->|"looks up current user"| node_user_repository
node_auth_service -->|"injects session"| node_database
node_user_repository -->|"queries and updates"| node_user_model
node_user_model -->|"uses declarative base"| node_database
node_database -->|"loads database URL"| node_settings
node_auth_service -->|"loads JWT settings"| node_settings
node_user_workflows -->|"loads reset expiry"| node_settings
node_email_service -->|"loads mail settings"| node_settings
node_core_security -->|"imports settings"| node_core_settings

click node_application "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/main.py"
click node_auth_routes "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/endpoints/auth.py"
click node_schemas "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/schemas/user.py"
click node_user_workflows "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/user_service.py"
click node_auth_service "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/auth_service.py"
click node_email_service "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/email_service.py"
click node_user_repository "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/repositories/user_repository.py"
click node_user_model "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/models/user.py"
click node_database "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/database.py"
click node_settings "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/config.py"
click node_core_settings "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/core/config.py"
click node_core_security "https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/core/security.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_application,node_auth_routes,node_schemas,node_client toneBlue
class node_user_workflows,node_auth_service,node_email_service toneAmber
class node_user_repository,node_user_model,node_database toneMint
class node_settings,node_core_settings,node_core_security toneRose
class node_smtp toneIndigo
```

## Components

### HTTP API

- [FastAPI application](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/main.py): `app/main.py`
- [Auth endpoints](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/endpoints/auth.py): `app/endpoints/auth.py`
- [Request and response schemas](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/schemas/user.py): `app/schemas/user.py`

### Account workflows

- [User workflows](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/user_service.py): `app/services/user_service.py`
- [JWT and password auth](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/auth_service.py): `app/services/auth_service.py`
- [Recovery email](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/services/email_service.py): `app/services/email_service.py`

### Persistence

- [User repository](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/repositories/user_repository.py): `app/repositories/user_repository.py`
- [User ORM model](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/models/user.py): `app/models/user.py`
- [SQL database and sessions](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/database.py): `app/database.py`

### Configuration and security

- [Application settings](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/config.py): `app/config.py`
- [Core settings](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/core/config.py): `app/core/config.py`
- [Core security module](https://github.com/sgtp3pp3r/api-de-recuperacion-de-cuentas/blob/main/app/core/security.py): `app/core/security.py`

### Other components

- **API client**
- **Gmail SMTP**

## Connections

- API client → FastAPI application: sends HTTP requests (evidence: `README.md`)
- FastAPI application → Auth endpoints: registers router (evidence: `app/main.py`)
- FastAPI application → SQL database and sessions: creates tables (evidence: `app/main.py`)
- Auth endpoints → User workflows: dispatches workflows (evidence: `app/endpoints/auth.py`)
- Auth endpoints → JWT and password auth: resolves current user (evidence: `app/endpoints/auth.py`)
- Auth endpoints → Request and response schemas: validates and responds (evidence: `app/endpoints/auth.py`)
- User workflows → User repository: reads and writes users (evidence: `app/services/user_service.py`)
- User workflows → JWT and password auth: hashes and verifies passwords (evidence: `app/services/user_service.py`)
- User workflows → Recovery email: sends recovery notices (evidence: `app/services/user_service.py`)
- Recovery email → Gmail SMTP: sends email (evidence: `app/services/email_service.py`)
- JWT and password auth → User repository: looks up current user (evidence: `app/services/auth_service.py`)
- JWT and password auth → SQL database and sessions: injects session (evidence: `app/services/auth_service.py`)
- User repository → User ORM model: queries and updates (evidence: `app/repositories/user_repository.py`)
- User ORM model → SQL database and sessions: uses declarative base (evidence: `app/models/user.py`)
- SQL database and sessions → Application settings: loads database URL (evidence: `app/database.py`)
- JWT and password auth → Application settings: loads JWT settings (evidence: `app/services/auth_service.py`)
- User workflows → Application settings: loads reset expiry (evidence: `app/services/user_service.py`)
- Recovery email → Application settings: loads mail settings (evidence: `app/services/email_service.py`)
- Core security module → Core settings: imports settings (evidence: `app/core/security.py`)
