# sarmad426/fastapi architecture

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

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

## Overview

This repository is a collection of independent FastAPI learning examples and small web apps, not one integrated service. In the sampled CRUD flows, a client request reaches an API handler, which validates or shapes data and uses a database session to read or write records; the SQLModel example also models Team–Hero relationships. Other branches cover authentication, quizzes, tweets with image uploads, image background removal, music recommendations, and practical FastAPI topics such as WebSockets and OAuth. Several subsystems are represented by paths and filenames only; their internal calls and client-to-server wiring are not asserted.

Main entry points: [`Back-end/poetry-class/poetryclass/tweets-app/main.py`](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/main.py) (Tweets API), [`1-Learn/fastapi-sqlmodel/main.py`](https://github.com/sarmad426/fastapi/blob/main/1-Learn/fastapi-sqlmodel/main.py) (Teams and heroes API), [`Back-end/poetry-class/poetryclass/todo_app/main.py`](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/todo_app/main.py) (Todo API), [`Back-end/poetry-class/poetryclass/auth-app/main.py`](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/auth-app/main.py) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_crud["CRUD examples"]
  node_sqlapi["Teams and heroes API<br/>[main.py]"]
  node_sqlmodels["Team and hero models<br/>[schema.py]"]
  node_sqldb[("SQLModel database<br/>[db_connection.py]")]
  node_todoapi["Todo API<br/>[main.py]"]
  node_tododb[("Todo database<br/>[database.py]")]
end

subgraph group_apps["Web applications"]
  node_authapi["Authentication API<br/>[main.py]"]
  node_authdb[("User database and models<br/>[db.py]")]
  node_quizapi["Quiz app<br/>[main.py]"]
  node_quizdb[("Quiz database<br/>[database.py]")]
  node_tweetsapi["Tweets API<br/>[main.py]"]
  node_tweetmodels["Tweet model<br/>[models.py]"]
  node_tweetdb[("Tweets database<br/>[database.py]")]
  node_imagefiles["Image upload helper<br/>[utils.py]"]
  node_bgremove["Background removal API<br/>[main.py]"]
  node_music["Music recommender<br/>[main.py]"]
end

subgraph group_practical["FastAPI topics"]
  node_practical["Practical API examples"]
  node_websockets["WebSocket examples"]
end

subgraph group_clients["Browser clients"]
  node_authclient["Login and registration UI<br/>[script.js]"]
  node_todoclient["Todo UI"]
  node_quizclient["Quiz UI"]
  node_tweetsclient["Tweets UI"]
  node_imageclient["Background remover UI<br/>[script.js]"]
  node_musicclient["Music recommender UI<br/>[script.js]"]
end

node_user(("User"))

node_user -->|"sends requests"| node_sqlapi
node_sqlapi -->|"uses models"| node_sqlmodels
node_sqlapi -->|"gets sessions"| node_sqldb
node_user -->|"sends requests"| node_todoapi
node_todoapi -->|"gets sessions"| node_tododb
node_user -.->|"uses"| node_authclient
node_authclient -->|"calls login"| node_authapi
node_authapi -->|"uses database"| node_authdb
node_user -.->|"uses"| node_quizapi
node_user -->|"sends requests"| node_tweetsapi
node_tweetsapi -->|"uses model"| node_tweetmodels
node_tweetsapi -->|"gets database"| node_tweetdb
node_tweetsapi -->|"saves images"| node_imagefiles
node_user -->|"uploads image"| node_bgremove
node_user -.->|"uses"| node_music
node_user -.->|"uses examples"| node_practical
node_user -.->|"uses examples"| node_websockets

click node_sqlapi "https://github.com/sarmad426/fastapi/blob/main/1-Learn/fastapi-sqlmodel/main.py"
click node_sqlmodels "https://github.com/sarmad426/fastapi/blob/main/1-Learn/fastapi-sqlmodel/schema.py"
click node_sqldb "https://github.com/sarmad426/fastapi/blob/main/1-Learn/fastapi-sqlmodel/db_connection.py"
click node_todoapi "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/todo_app/main.py"
click node_tododb "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/todo_app/database.py"
click node_authapi "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/auth-app/main.py"
click node_authdb "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/auth-app/db.py"
click node_quizapi "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/quiz-app/main.py"
click node_quizdb "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/quiz-app/database.py"
click node_tweetsapi "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/main.py"
click node_tweetmodels "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/models.py"
click node_tweetdb "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/database.py"
click node_imagefiles "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/utils.py"
click node_bgremove "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/img-bg-remover/main.py"
click node_music "https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/music_recommender/main.py"
click node_practical "https://github.com/sarmad426/fastapi/tree/main/Back-end/poetry-class/poetryclass/practical"
click node_websockets "https://github.com/sarmad426/fastapi/tree/main/Back-end/poetry-class/poetryclass/practical/web-sockets"
click node_authclient "https://github.com/sarmad426/fastapi/blob/main/Front-end/auth-app/script.js"
click node_todoclient "https://github.com/sarmad426/fastapi/tree/main/Front-end/todo-app"
click node_quizclient "https://github.com/sarmad426/fastapi/tree/main/Front-end/quiz-app/scripts"
click node_tweetsclient "https://github.com/sarmad426/fastapi/tree/main/Front-end/tweets-app"
click node_imageclient "https://github.com/sarmad426/fastapi/blob/main/Front-end/img-bg-remover/script.js"
click node_musicclient "https://github.com/sarmad426/fastapi/blob/main/Front-end/music-recommender/script.js"

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_sqlapi,node_sqlmodels,node_sqldb,node_todoapi,node_tododb,node_user toneBlue
class node_authapi,node_authdb,node_quizapi,node_quizdb,node_tweetsapi,node_tweetmodels,node_tweetdb,node_imagefiles,node_bgremove,node_music toneAmber
class node_practical,node_websockets toneMint
class node_authclient,node_todoclient,node_quizclient,node_tweetsclient,node_imageclient,node_musicclient toneRose
```

## Components

### CRUD examples

- [Teams and heroes API](https://github.com/sarmad426/fastapi/blob/main/1-Learn/fastapi-sqlmodel/main.py): `1-Learn/fastapi-sqlmodel/main.py`
- [Team and hero models](https://github.com/sarmad426/fastapi/blob/main/1-Learn/fastapi-sqlmodel/schema.py): `1-Learn/fastapi-sqlmodel/schema.py`
- [SQLModel database](https://github.com/sarmad426/fastapi/blob/main/1-Learn/fastapi-sqlmodel/db_connection.py): `1-Learn/fastapi-sqlmodel/db_connection.py`
- [Todo API](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/todo_app/main.py): `Back-end/poetry-class/poetryclass/todo_app/main.py`
- [Todo database](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/todo_app/database.py): `Back-end/poetry-class/poetryclass/todo_app/database.py`

### Web applications

- [Authentication API](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/auth-app/main.py): `Back-end/poetry-class/poetryclass/auth-app/main.py`
- [User database and models](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/auth-app/db.py): `Back-end/poetry-class/poetryclass/auth-app/db.py`
- [Quiz app](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/quiz-app/main.py): `Back-end/poetry-class/poetryclass/quiz-app/main.py`
- [Quiz database](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/quiz-app/database.py): `Back-end/poetry-class/poetryclass/quiz-app/database.py`
- [Tweets API](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/main.py): `Back-end/poetry-class/poetryclass/tweets-app/main.py`
- [Tweet model](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/models.py): `Back-end/poetry-class/poetryclass/tweets-app/models.py`
- [Tweets database](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/database.py): `Back-end/poetry-class/poetryclass/tweets-app/database.py`
- [Image upload helper](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/tweets-app/utils.py): `Back-end/poetry-class/poetryclass/tweets-app/utils.py`
- [Background removal API](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/img-bg-remover/main.py): `Back-end/poetry-class/poetryclass/img-bg-remover/main.py`
- [Music recommender](https://github.com/sarmad426/fastapi/blob/main/Back-end/poetry-class/poetryclass/music_recommender/main.py): `Back-end/poetry-class/poetryclass/music_recommender/main.py`

### FastAPI topics

- [Practical API examples](https://github.com/sarmad426/fastapi/tree/main/Back-end/poetry-class/poetryclass/practical): `Back-end/poetry-class/poetryclass/practical`
- [WebSocket examples](https://github.com/sarmad426/fastapi/tree/main/Back-end/poetry-class/poetryclass/practical/web-sockets): `Back-end/poetry-class/poetryclass/practical/web-sockets`

### Browser clients

- [Login and registration UI](https://github.com/sarmad426/fastapi/blob/main/Front-end/auth-app/script.js): `Front-end/auth-app/script.js`
- [Todo UI](https://github.com/sarmad426/fastapi/tree/main/Front-end/todo-app): `Front-end/todo-app`
- [Quiz UI](https://github.com/sarmad426/fastapi/tree/main/Front-end/quiz-app/scripts): `Front-end/quiz-app/scripts`
- [Tweets UI](https://github.com/sarmad426/fastapi/tree/main/Front-end/tweets-app): `Front-end/tweets-app`
- [Background remover UI](https://github.com/sarmad426/fastapi/blob/main/Front-end/img-bg-remover/script.js): `Front-end/img-bg-remover/script.js`
- [Music recommender UI](https://github.com/sarmad426/fastapi/blob/main/Front-end/music-recommender/script.js): `Front-end/music-recommender/script.js`

### Other components

- **User**

## Connections

- User → Teams and heroes API: sends requests (evidence: `1-Learn/fastapi-sqlmodel/main.py`)
- Teams and heroes API → Team and hero models: uses models (evidence: `1-Learn/fastapi-sqlmodel/main.py`)
- Teams and heroes API → SQLModel database: gets sessions (evidence: `1-Learn/fastapi-sqlmodel/main.py`)
- User → Todo API: sends requests (evidence: `Back-end/poetry-class/poetryclass/todo_app/main.py`)
- Todo API → Todo database: gets sessions (evidence: `Back-end/poetry-class/poetryclass/todo_app/main.py`)
- User → Login and registration UI: uses
- Login and registration UI → Authentication API: calls login (evidence: `Front-end/auth-app/script.js`)
- Authentication API → User database and models: uses database (evidence: `Back-end/poetry-class/poetryclass/auth-app/main.py`)
- User → Quiz app: uses
- User → Tweets API: sends requests (evidence: `Back-end/poetry-class/poetryclass/tweets-app/main.py`)
- Tweets API → Tweet model: uses model (evidence: `Back-end/poetry-class/poetryclass/tweets-app/main.py`)
- Tweets API → Tweets database: gets database (evidence: `Back-end/poetry-class/poetryclass/tweets-app/main.py`)
- Tweets API → Image upload helper: saves images (evidence: `Back-end/poetry-class/poetryclass/tweets-app/main.py`)
- User → Background removal API: uploads image (evidence: `Back-end/poetry-class/poetryclass/img-bg-remover/main.py`)
- User → Music recommender: uses
- User → Practical API examples: uses examples
- User → WebSocket examples: uses examples
