# msbharath1998-sketch/fastapi-todo architecture

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

- Interactive diagram: https://gitdiagram.com/msbharath1998-sketch/fastapi-todo
- Repository: https://github.com/msbharath1998-sketch/fastapi-todo

## Overview

This repository is a small FastAPI todo CRUD service. A client sends requests to the API, which validates and shapes data with Pydantic schemas, uses SQLAlchemy models and a request-scoped session to perform create, list, retrieve, update, and delete operations, then returns results. Database configuration and engine setup live separately from the route handlers. The excerpts show the route-to-model and session interactions; the configured database’s actual product and deployment are not specified.

Main entry points: [`main.py`](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/main.py) (Todo routes), [`database.py`](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/database.py) (Session and engine setup), [`models.py`](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/models.py) (Todo ORM model), [`schemas.py`](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/schemas.py) (Request and response schemas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_routes["Todo routes<br/>[main.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
end

subgraph group_domain["Todo Data"]
  node_todo_model["Todo ORM model<br/>[models.py]"]
end

subgraph group_persistence["Persistence"]
  node_db_session["Session and engine setup<br/>[database.py]"]
  node_todo_store[("Todo database")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_routes
node_routes -->|"validates and shapes"| node_schemas
node_routes -->|"creates and queries"| node_todo_model
node_routes -->|"opens session"| node_db_session
node_routes -->|"reads and writes"| node_todo_store
node_db_session -->|"connects engine"| node_todo_store
node_todo_model -->|"uses base"| node_db_session

click node_routes "https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/main.py"
click node_schemas "https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/schemas.py"
click node_todo_model "https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/models.py"
click node_db_session "https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/database.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_routes,node_schemas,node_client toneBlue
class node_todo_model toneAmber
class node_db_session,node_todo_store toneMint
```

## Components

### HTTP API

- [Todo routes](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/main.py): `main.py`
- [Request and response schemas](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/schemas.py): `schemas.py`

### Todo Data

- [Todo ORM model](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/models.py): `models.py`

### Persistence

- [Session and engine setup](https://github.com/msbharath1998-sketch/fastapi-todo/blob/main/database.py): `database.py`
- **Todo database**

### Other components

- **API client**

## Connections

- API client → Todo routes: sends requests (evidence: `main.py`)
- Todo routes → Request and response schemas: validates and shapes (evidence: `main.py`)
- Todo routes → Todo ORM model: creates and queries (evidence: `main.py`)
- Todo routes → Session and engine setup: opens session (evidence: `main.py`)
- Todo routes → Todo database: reads and writes (evidence: `main.py`)
- Session and engine setup → Todo database: connects engine (evidence: `database.py`)
- Todo ORM model → Session and engine setup: uses base (evidence: `models.py`)
