# ssag-amja/video_back architecture

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

- Interactive diagram: https://gitdiagram.com/ssag-amja/video_back
- Repository: https://github.com/ssag-amja/video_back

## Overview

Pinlm is a FastAPI user identity backend. Its principal workflow covers account registration, password hashing and persistence, password-based login with JWT issuance, and bearer-token authentication for the current-user endpoint. The graph also includes database session/model handling and the documented Alembic schema-migration capability. Relationships are limited to shown calls and README statements; migration internals were not sampled.

Main entry points: [`app/api/v1/endpoints/login.py`](https://github.com/ssag-amja/video_back/blob/main/app/api/v1/endpoints/login.py) (Login endpoint), [`app/api/deps.py`](https://github.com/ssag-amja/video_back/blob/main/app/api/deps.py) (Auth dependencies), [`app/crud/user.py`](https://github.com/ssag-amja/video_back/blob/main/app/crud/user.py) (User operations), [`app/api/v1/routers.py`](https://github.com/ssag-amja/video_back/blob/main/app/api/v1/routers.py) (API router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_router["API router<br/>[routers.py]"]
  node_signup["Registration endpoint<br/>[user.py]"]
  node_login["Login endpoint<br/>[login.py]"]
  node_me["Current-user endpoint<br/>[user.py]"]
  node_user_schema["User schemas<br/>[user.py]"]
end

subgraph group_identity["Identity and Security"]
  node_deps["Auth dependencies<br/>[deps.py]"]
  node_token_schema["Token schema<br/>[token.py]"]
  node_security["Password and JWT security<br/>[security.py]"]
end

subgraph group_persistence["Persistence"]
  node_crud["User operations<br/>[user.py]"]
  node_session["Database sessions<br/>[session.py]"]
  node_user_model["User model<br/>[user.py]"]
  node_base_class["ORM base<br/>[base_class.py]"]
  node_db_base["Model registry<br/>[base.py]"]
  node_migrations["Schema migrations"]
end

subgraph group_runtime["Application Runtime"]
  node_main["FastAPI app<br/>[main.py]"]
  node_config["Application settings<br/>[config.py]"]
end

node_client(("API client"))
node_database[("PostgreSQL database")]

node_client -->|"sends requests"| node_main
node_main -->|"mounts routes"| node_router
node_router -->|"routes users"| node_signup
node_router -->|"routes users"| node_me
node_router -->|"routes login"| node_login
node_signup -->|"validates input"| node_user_schema
node_signup -->|"creates user"| node_crud
node_signup -->|"opens session"| node_deps
node_login -->|"finds account"| node_crud
node_login -->|"checks password"| node_security
node_login -->|"issues token"| node_security
node_login -->|"returns token"| node_token_schema
node_login -->|"opens session"| node_deps
node_me -->|"requires identity"| node_deps
node_deps -->|"creates session"| node_session
node_deps -->|"reads JWT settings"| node_config
node_deps -->|"loads user"| node_crud
node_crud -->|"hashes password"| node_security
node_crud -->|"queries and persists"| node_user_model
node_crud -->|"accepts input"| node_user_schema
node_user_model -->|"extends base"| node_base_class
node_session -->|"uses database URL"| node_config
node_session -->|"connects to"| node_database
node_security -->|"uses signing settings"| node_config
node_db_base -->|"registers model"| node_user_model
node_migrations -->|"applies schema"| node_database

click node_main "https://github.com/ssag-amja/video_back/blob/main/app/main.py"
click node_router "https://github.com/ssag-amja/video_back/blob/main/app/api/v1/routers.py"
click node_signup "https://github.com/ssag-amja/video_back/blob/main/app/api/v1/endpoints/user.py"
click node_login "https://github.com/ssag-amja/video_back/blob/main/app/api/v1/endpoints/login.py"
click node_me "https://github.com/ssag-amja/video_back/blob/main/app/api/v1/endpoints/user.py"
click node_deps "https://github.com/ssag-amja/video_back/blob/main/app/api/deps.py"
click node_user_schema "https://github.com/ssag-amja/video_back/blob/main/app/schemas/user.py"
click node_token_schema "https://github.com/ssag-amja/video_back/blob/main/app/schemas/token.py"
click node_crud "https://github.com/ssag-amja/video_back/blob/main/app/crud/user.py"
click node_security "https://github.com/ssag-amja/video_back/blob/main/app/core/security.py"
click node_config "https://github.com/ssag-amja/video_back/blob/main/app/core/config.py"
click node_session "https://github.com/ssag-amja/video_back/blob/main/app/db/session.py"
click node_user_model "https://github.com/ssag-amja/video_back/blob/main/app/models/user.py"
click node_base_class "https://github.com/ssag-amja/video_back/blob/main/app/db/base_class.py"
click node_db_base "https://github.com/ssag-amja/video_back/blob/main/app/db/base.py"
click node_migrations "https://github.com/ssag-amja/video_back/tree/main/app/db/alembic"

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_router,node_signup,node_login,node_me,node_user_schema,node_client toneBlue
class node_deps,node_token_schema,node_security,node_database toneAmber
class node_crud,node_session,node_user_model,node_base_class,node_db_base,node_migrations toneMint
class node_main,node_config toneRose
```

## Components

### HTTP API

- [API router](https://github.com/ssag-amja/video_back/blob/main/app/api/v1/routers.py): `app/api/v1/routers.py`
- [Registration endpoint](https://github.com/ssag-amja/video_back/blob/main/app/api/v1/endpoints/user.py): `app/api/v1/endpoints/user.py`
- [Login endpoint](https://github.com/ssag-amja/video_back/blob/main/app/api/v1/endpoints/login.py): `app/api/v1/endpoints/login.py`
- [Current-user endpoint](https://github.com/ssag-amja/video_back/blob/main/app/api/v1/endpoints/user.py): `app/api/v1/endpoints/user.py`
- [User schemas](https://github.com/ssag-amja/video_back/blob/main/app/schemas/user.py): `app/schemas/user.py`

### Identity and Security

- [Auth dependencies](https://github.com/ssag-amja/video_back/blob/main/app/api/deps.py): `app/api/deps.py`
- [Token schema](https://github.com/ssag-amja/video_back/blob/main/app/schemas/token.py): `app/schemas/token.py`
- [Password and JWT security](https://github.com/ssag-amja/video_back/blob/main/app/core/security.py): `app/core/security.py`

### Persistence

- [User operations](https://github.com/ssag-amja/video_back/blob/main/app/crud/user.py): `app/crud/user.py`
- [Database sessions](https://github.com/ssag-amja/video_back/blob/main/app/db/session.py): `app/db/session.py`
- [User model](https://github.com/ssag-amja/video_back/blob/main/app/models/user.py): `app/models/user.py`
- [ORM base](https://github.com/ssag-amja/video_back/blob/main/app/db/base_class.py): `app/db/base_class.py`
- [Model registry](https://github.com/ssag-amja/video_back/blob/main/app/db/base.py): `app/db/base.py`
- [Schema migrations](https://github.com/ssag-amja/video_back/tree/main/app/db/alembic): `app/db/alembic`

### Application Runtime

- [FastAPI app](https://github.com/ssag-amja/video_back/blob/main/app/main.py): `app/main.py`
- [Application settings](https://github.com/ssag-amja/video_back/blob/main/app/core/config.py): `app/core/config.py`

### Other components

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

## Connections

- API client → FastAPI app: sends requests (evidence: `app/main.py`)
- FastAPI app → API router: mounts routes (evidence: `app/main.py`)
- API router → Registration endpoint: routes users (evidence: `app/api/v1/routers.py`)
- API router → Current-user endpoint: routes users (evidence: `app/api/v1/routers.py`)
- API router → Login endpoint: routes login (evidence: `app/api/v1/routers.py`)
- Registration endpoint → User schemas: validates input (evidence: `app/api/v1/endpoints/user.py`)
- Registration endpoint → User operations: creates user (evidence: `app/api/v1/endpoints/user.py`)
- Registration endpoint → Auth dependencies: opens session (evidence: `app/api/v1/endpoints/user.py`)
- Login endpoint → User operations: finds account (evidence: `app/api/v1/endpoints/login.py`)
- Login endpoint → Password and JWT security: checks password (evidence: `app/api/v1/endpoints/login.py`)
- Login endpoint → Password and JWT security: issues token (evidence: `app/api/v1/endpoints/login.py`)
- Login endpoint → Token schema: returns token (evidence: `app/api/v1/endpoints/login.py`)
- Login endpoint → Auth dependencies: opens session (evidence: `app/api/v1/endpoints/login.py`)
- Current-user endpoint → Auth dependencies: requires identity (evidence: `app/api/v1/endpoints/user.py`)
- Auth dependencies → Database sessions: creates session (evidence: `app/api/deps.py`)
- Auth dependencies → Application settings: reads JWT settings (evidence: `app/api/deps.py`)
- Auth dependencies → User operations: loads user (evidence: `app/api/deps.py`)
- User operations → Password and JWT security: hashes password (evidence: `app/crud/user.py`)
- User operations → User model: queries and persists (evidence: `app/crud/user.py`)
- User operations → User schemas: accepts input (evidence: `app/crud/user.py`)
- User model → ORM base: extends base (evidence: `app/models/user.py`)
- Database sessions → Application settings: uses database URL (evidence: `app/db/session.py`)
- Database sessions → PostgreSQL database: connects to (evidence: `app/db/session.py`)
- Password and JWT security → Application settings: uses signing settings (evidence: `app/core/security.py`)
- Model registry → User model: registers model (evidence: `app/db/base.py`)
- Schema migrations → PostgreSQL database: applies schema (evidence: `README.md`)
