# dv0retsky/fastapi-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/dv0retsky/fastapi-tutorial
- Repository: https://github.com/dv0retsky/fastapi-tutorial

## Overview

This repository is a Russian-language FastAPI learning course, not a runnable application. Its main workflow is for a learner to follow lessons from API basics through authentication, persistence, testing, and deployment, then practice with control assignments. The README establishes the course contents and order; sampled code shows a role-based authorization example. Connections inside that example are limited to imports and calls visible in the excerpts.

Main entry points: [`README.md`](https://github.com/dv0retsky/fastapi-tutorial/blob/main/README.md) (Course index), [`FAPI7_Roles/project_example/main.py`](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/main.py) (RBAC API example), [`FAPI7_Roles/project_example/dependencies.py`](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/dependencies.py) (Current-user dependency), [`FAPI7_Roles/project_example/db.py`](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/db.py) (User data lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_basics["API basics"]
  node_intro["FastAPI introduction"]
  node_endpoints["Endpoints and parameters"]
end

subgraph group_http["Request handling"]
  node_processing["Request processing"]
  node_postman["Postman<br/>[FAPI4_Postman.md]"]
  node_async["Async and cookies"]
end

subgraph group_securitydata["Security and data"]
  node_authentication["Authentication"]
  node_roles["Role-based access<br/>[FAPI7_Roles.md]"]
  node_database["Database CRUD<br/>[FAPI8_Database.md]"]
  node_migration["Database migrations<br/>[FAPI9_Migration.md]"]
  node_app["RBAC API example<br/>[main.py]"]
  node_auth["JWT security<br/>[security.py]"]
  node_userdeps["Current-user dependency<br/>[dependencies.py]"]
  node_userstore[("User data lookup<br/>[db.py]")]
  node_usermodel["User models<br/>[models.py]"]
  node_rbac["Role checker<br/>[rbac.py]"]
end

subgraph group_quality["Testing and deployment"]
  node_errors["Validation errors<br/>[FAPI10_Errors.md]"]
  node_testing["Application testing<br/>[FAPI11_Testing.md]"]
  node_integration["Integration testing"]
  node_deployment["Docker deployment"]
end

subgraph group_advanced["Advanced topics"]
  node_websocket["WebSocket support"]
  node_dependencies["Dependency injection"]
  node_conclusion["Course conclusion"]
  node_kr1["Assignment 1<br/>[FAPI_KR1.md]"]
  node_kr2["Assignment 2<br/>[FAPI_KR2.md]"]
  node_kr3["Assignment 3<br/>[FAPI_KR3.md]"]
  node_kr4["Assignment 4<br/>[FAPI_KR4.md]"]
  node_kr5["Assignment 5<br/>[FAPI_KR5.md]"]
end

node_learner(("Learner"))
node_course["Course index<br/>[README.md]"]

node_learner -->|"opens"| node_course
node_course -->|"links to"| node_intro
node_course -->|"links to"| node_endpoints
node_course -->|"links to"| node_processing
node_course -->|"links to"| node_postman
node_course -->|"links to"| node_async
node_course -->|"links to"| node_authentication
node_course -->|"links to"| node_roles
node_course -->|"links to"| node_database
node_course -->|"links to"| node_migration
node_course -->|"links to"| node_errors
node_course -->|"links to"| node_testing
node_course -->|"links to"| node_integration
node_course -->|"links to"| node_deployment
node_course -->|"links to"| node_websocket
node_course -->|"links to"| node_dependencies
node_course -->|"links to"| node_conclusion
node_course -->|"links to"| node_kr1
node_course -->|"links to"| node_kr2
node_course -->|"links to"| node_kr3
node_course -->|"links to"| node_kr4
node_course -->|"links to"| node_kr5
node_app -->|"creates token"| node_auth
node_app -->|"depends on"| node_userdeps
node_app -->|"reads users"| node_userstore
node_app -->|"uses models"| node_usermodel
node_app -->|"guards routes"| node_rbac
node_userdeps -->|"extracts identity"| node_auth
node_userdeps -->|"looks up user"| node_userstore
node_userdeps -->|"returns user"| node_usermodel
node_userstore -->|"constructs"| node_usermodel

click node_course "https://github.com/dv0retsky/fastapi-tutorial/blob/main/README.md"
click node_intro "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI1_Introduction/FAPI1_Introduction.md"
click node_endpoints "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI2_Endpoints%20and%20Parameters/FAPI2_Endpoints%20and%20Parameters.md"
click node_processing "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI3_Processing%20requests/FAPI3_Processing%20requests.md"
click node_postman "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI4_Postman/FAPI4_Postman.md"
click node_async "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI5_Async%20Types%20Cookies/FAPI5_Async%20Types%20Cookies.md"
click node_authentication "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI6_Authentication/FAPI6_Authentication.md"
click node_roles "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/FAPI7_Roles.md"
click node_database "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI8_Database/FAPI8_Database.md"
click node_migration "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI9_Migration/FAPI9_Migration.md"
click node_errors "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI10_Errors/FAPI10_Errors.md"
click node_testing "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI11_Testing/FAPI11_Testing.md"
click node_integration "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI12_Integration/FAPI12_Integration.md"
click node_deployment "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI13_Deployment/FAPI13_Deployment.md"
click node_websocket "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI14_WebSocket/FAPI14_WebSocket.md"
click node_dependencies "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI15_Implementation/FAPI15_Implementation.md"
click node_conclusion "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI16_Conclusion/FAPI16_Conclusion.md"
click node_kr1 "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR1/FAPI_KR1.md"
click node_kr2 "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR2/FAPI_KR2.md"
click node_kr3 "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR3/FAPI_KR3.md"
click node_kr4 "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR4/FAPI_KR4.md"
click node_kr5 "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR5/FAPI_KR5.md"
click node_app "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/main.py"
click node_auth "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/security.py"
click node_userdeps "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/dependencies.py"
click node_userstore "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/db.py"
click node_usermodel "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/models.py"
click node_rbac "https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/rbac.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_intro,node_endpoints toneBlue
class node_processing,node_postman,node_async toneAmber
class node_authentication,node_roles,node_database,node_migration,node_app,node_auth,node_userdeps,node_userstore,node_usermodel,node_rbac toneMint
class node_errors,node_testing,node_integration,node_deployment toneRose
class node_websocket,node_dependencies,node_conclusion,node_kr1,node_kr2,node_kr3,node_kr4,node_kr5,node_learner toneIndigo
class node_course toneTeal
```

## Components

### API basics

- [FastAPI introduction](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI1_Introduction/FAPI1_Introduction.md): `FAPI1_Introduction/FAPI1_Introduction.md`
- [Endpoints and parameters](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI2_Endpoints%20and%20Parameters/FAPI2_Endpoints%20and%20Parameters.md): `FAPI2_Endpoints and Parameters/FAPI2_Endpoints and Parameters.md`

### Request handling

- [Request processing](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI3_Processing%20requests/FAPI3_Processing%20requests.md): `FAPI3_Processing requests/FAPI3_Processing requests.md`
- [Postman](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI4_Postman/FAPI4_Postman.md): `FAPI4_Postman/FAPI4_Postman.md`
- [Async and cookies](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI5_Async%20Types%20Cookies/FAPI5_Async%20Types%20Cookies.md): `FAPI5_Async Types Cookies/FAPI5_Async Types Cookies.md`

### Security and data

- [Authentication](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI6_Authentication/FAPI6_Authentication.md): `FAPI6_Authentication/FAPI6_Authentication.md`
- [Role-based access](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/FAPI7_Roles.md): `FAPI7_Roles/FAPI7_Roles.md`
- [Database CRUD](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI8_Database/FAPI8_Database.md): `FAPI8_Database/FAPI8_Database.md`
- [Database migrations](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI9_Migration/FAPI9_Migration.md): `FAPI9_Migration/FAPI9_Migration.md`
- [RBAC API example](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/main.py): `FAPI7_Roles/project_example/main.py`
- [JWT security](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/security.py): `FAPI7_Roles/project_example/security.py`
- [Current-user dependency](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/dependencies.py): `FAPI7_Roles/project_example/dependencies.py`
- [User data lookup](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/db.py): `FAPI7_Roles/project_example/db.py`
- [User models](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/models.py): `FAPI7_Roles/project_example/models.py`
- [Role checker](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI7_Roles/project_example/rbac.py): `FAPI7_Roles/project_example/rbac.py`

### Testing and deployment

- [Validation errors](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI10_Errors/FAPI10_Errors.md): `FAPI10_Errors/FAPI10_Errors.md`
- [Application testing](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI11_Testing/FAPI11_Testing.md): `FAPI11_Testing/FAPI11_Testing.md`
- [Integration testing](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI12_Integration/FAPI12_Integration.md): `FAPI12_Integration/FAPI12_Integration.md`
- [Docker deployment](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI13_Deployment/FAPI13_Deployment.md): `FAPI13_Deployment/FAPI13_Deployment.md`

### Advanced topics

- [WebSocket support](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI14_WebSocket/FAPI14_WebSocket.md): `FAPI14_WebSocket/FAPI14_WebSocket.md`
- [Dependency injection](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI15_Implementation/FAPI15_Implementation.md): `FAPI15_Implementation/FAPI15_Implementation.md`
- [Course conclusion](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI16_Conclusion/FAPI16_Conclusion.md): `FAPI16_Conclusion/FAPI16_Conclusion.md`
- [Assignment 1](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR1/FAPI_KR1.md): `FAPI_KR1/FAPI_KR1.md`
- [Assignment 2](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR2/FAPI_KR2.md): `FAPI_KR2/FAPI_KR2.md`
- [Assignment 3](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR3/FAPI_KR3.md): `FAPI_KR3/FAPI_KR3.md`
- [Assignment 4](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR4/FAPI_KR4.md): `FAPI_KR4/FAPI_KR4.md`
- [Assignment 5](https://github.com/dv0retsky/fastapi-tutorial/blob/main/FAPI_KR5/FAPI_KR5.md): `FAPI_KR5/FAPI_KR5.md`

### Other components

- **Learner**
- [Course index](https://github.com/dv0retsky/fastapi-tutorial/blob/main/README.md): `README.md`

## Connections

- Learner → Course index: opens (evidence: `README.md`)
- Course index → FastAPI introduction: links to (evidence: `README.md`)
- Course index → Endpoints and parameters: links to (evidence: `README.md`)
- Course index → Request processing: links to (evidence: `README.md`)
- Course index → Postman: links to (evidence: `README.md`)
- Course index → Async and cookies: links to (evidence: `README.md`)
- Course index → Authentication: links to (evidence: `README.md`)
- Course index → Role-based access: links to (evidence: `README.md`)
- Course index → Database CRUD: links to (evidence: `README.md`)
- Course index → Database migrations: links to (evidence: `README.md`)
- Course index → Validation errors: links to (evidence: `README.md`)
- Course index → Application testing: links to (evidence: `README.md`)
- Course index → Integration testing: links to (evidence: `README.md`)
- Course index → Docker deployment: links to (evidence: `README.md`)
- Course index → WebSocket support: links to (evidence: `README.md`)
- Course index → Dependency injection: links to (evidence: `README.md`)
- Course index → Course conclusion: links to (evidence: `README.md`)
- Course index → Assignment 1: links to (evidence: `README.md`)
- Course index → Assignment 2: links to (evidence: `README.md`)
- Course index → Assignment 3: links to (evidence: `README.md`)
- Course index → Assignment 4: links to (evidence: `README.md`)
- Course index → Assignment 5: links to (evidence: `README.md`)
- RBAC API example → JWT security: creates token (evidence: `FAPI7_Roles/project_example/main.py`)
- RBAC API example → Current-user dependency: depends on (evidence: `FAPI7_Roles/project_example/main.py`)
- RBAC API example → User data lookup: reads users (evidence: `FAPI7_Roles/project_example/main.py`)
- RBAC API example → User models: uses models (evidence: `FAPI7_Roles/project_example/main.py`)
- RBAC API example → Role checker: guards routes (evidence: `FAPI7_Roles/project_example/main.py`)
- Current-user dependency → JWT security: extracts identity (evidence: `FAPI7_Roles/project_example/dependencies.py`)
- Current-user dependency → User data lookup: looks up user (evidence: `FAPI7_Roles/project_example/dependencies.py`)
- Current-user dependency → User models: returns user (evidence: `FAPI7_Roles/project_example/dependencies.py`)
- User data lookup → User models: constructs (evidence: `FAPI7_Roles/project_example/db.py`)
