# tiangolo/full-stack-fastapi-template architecture

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

- Interactive diagram: https://gitdiagram.com/tiangolo/full-stack-fastapi-template
- Repository: https://github.com/tiangolo/full-stack-fastapi-template

## Overview

This is a full-stack FastAPI dashboard template: users sign in or register, then manage their profile, users, and items through a React application backed by a PostgreSQL API. Backend routes validate requests, enforce JWT-based identity and permissions, and use CRUD/model layers for persistence; account flows also support email. The README documents password recovery, dark mode, and email templates. Some frontend route-to-client and recovery wiring is not shown in the sampled source, so those links are documented or marked unverified rather than inferred from imports.

Main entry points: [`backend/app/crud.py`](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/crud.py) (Data operations), [`frontend/src/client/client/client.gen.ts`](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/frontend/src/client/client/client.gen.ts) (Generated API client), [`backend/app/api/main.py`](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/main.py) (API router), [`backend/app/api/deps.py`](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/deps.py) (Auth and sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React dashboard"]
  node_webapp["React application<br/>[main.tsx]"]
  node_authui["Sign-in and signup"]
  node_dashui["Dashboard views"]
  node_adminui["Admin user tools"]
  node_itemui["Item tools"]
  node_settingsui["Account settings"]
  node_client["Generated API client<br/>[client.gen.ts]"]
end

subgraph group_api["FastAPI API"]
  node_apiapp["API application<br/>[main.py]"]
  node_routing["API router<br/>[main.py]"]
  node_login["Login and recovery<br/>[login.py]"]
  node_users["User endpoints<br/>[users.py]"]
  node_items["Item endpoints<br/>[items.py]"]
  node_private["Private utilities<br/>[private.py]"]
end

subgraph group_domain["Identity and data"]
  node_dependencies["Auth and sessions<br/>[deps.py]"]
  node_crud["Data operations<br/>[crud.py]"]
  node_models["User and item models<br/>[models.py]"]
  node_security["JWT and passwords<br/>[security.py]"]
  node_configuration["Runtime configuration<br/>[config.py]"]
end

subgraph group_messaging["Email capabilities"]
  node_emailutils["Email and tokens<br/>[utils.py]"]
  node_emailtemplate["New-account template<br/>[new_account.tsx]"]
end

node_user(("Dashboard user"))
node_database[("PostgreSQL")]
node_mail["SMTP mail service"]

node_user -->|"uses"| node_webapp
node_webapp -->|"configures"| node_client
node_webapp -.->|"routes"| node_authui
node_webapp -.->|"routes"| node_dashui
node_authui -.->|"requests"| node_client
node_dashui -.->|"renders"| node_adminui
node_dashui -.->|"renders"| node_itemui
node_dashui -.->|"renders"| node_settingsui
node_adminui -.->|"requests"| node_client
node_itemui -.->|"requests"| node_client
node_settingsui -.->|"requests"| node_client
node_client -.->|"calls API"| node_apiapp
node_apiapp -->|"mounts"| node_routing
node_routing -->|"registers"| node_login
node_routing -->|"registers"| node_users
node_routing -->|"registers"| node_items
node_routing -->|"registers"| node_private
node_login -->|"authenticates"| node_crud
node_users -->|"uses"| node_crud
node_items -->|"uses"| node_crud
node_login -->|"requires"| node_dependencies
node_users -->|"requires"| node_dependencies
node_items -->|"requires"| node_dependencies
node_dependencies -->|"validates JWT"| node_security
node_crud -->|"hashes passwords"| node_security
node_crud -->|"uses models"| node_models
node_dependencies -->|"opens sessions"| node_database
node_crud -.->|"reads and writes"| node_database
node_apiapp -->|"loads settings"| node_configuration
node_emailutils -->|"reads settings"| node_configuration
node_login -->|"sends recovery email"| node_emailutils
node_users -->|"sends account email"| node_emailutils
node_emailutils -.->|"sends email"| node_mail
node_emailtemplate -.->|"formats email"| node_mail
node_user -.->|"receives recovery"| node_mail

click node_webapp "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/frontend/src/main.tsx"
click node_authui "https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/routes"
click node_dashui "https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/routes/_layout"
click node_adminui "https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/components/Admin"
click node_itemui "https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/components/Items"
click node_settingsui "https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/components/UserSettings"
click node_client "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/frontend/src/client/client/client.gen.ts"
click node_apiapp "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/main.py"
click node_routing "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/main.py"
click node_login "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/login.py"
click node_users "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/users.py"
click node_items "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/items.py"
click node_private "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/private.py"
click node_dependencies "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/deps.py"
click node_crud "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/crud.py"
click node_models "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/models.py"
click node_security "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/core/security.py"
click node_configuration "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/core/config.py"
click node_emailutils "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/utils.py"
click node_emailtemplate "https://github.com/tiangolo/full-stack-fastapi-template/blob/master/packages/react-email/emails/new_account.tsx"

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_webapp,node_authui,node_dashui,node_adminui,node_itemui,node_settingsui,node_client,node_user toneBlue
class node_apiapp,node_routing,node_login,node_users,node_items,node_private,node_database toneAmber
class node_dependencies,node_crud,node_models,node_security,node_configuration toneMint
class node_emailutils,node_emailtemplate toneRose
class node_mail toneIndigo
```

## Components

### React dashboard

- [React application](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Sign-in and signup](https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/routes): `frontend/src/routes`
- [Dashboard views](https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/routes/_layout): `frontend/src/routes/_layout`
- [Admin user tools](https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/components/Admin): `frontend/src/components/Admin`
- [Item tools](https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/components/Items): `frontend/src/components/Items`
- [Account settings](https://github.com/tiangolo/full-stack-fastapi-template/tree/master/frontend/src/components/UserSettings): `frontend/src/components/UserSettings`
- [Generated API client](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/frontend/src/client/client/client.gen.ts): `frontend/src/client/client/client.gen.ts`

### FastAPI API

- [API application](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/main.py): `backend/app/main.py`
- [API router](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/main.py): `backend/app/api/main.py`
- [Login and recovery](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/login.py): `backend/app/api/routes/login.py`
- [User endpoints](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/users.py): `backend/app/api/routes/users.py`
- [Item endpoints](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/items.py): `backend/app/api/routes/items.py`
- [Private utilities](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/routes/private.py): `backend/app/api/routes/private.py`

### Identity and data

- [Auth and sessions](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/api/deps.py): `backend/app/api/deps.py`
- [Data operations](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/crud.py): `backend/app/crud.py`
- [User and item models](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/models.py): `backend/app/models.py`
- [JWT and passwords](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/core/security.py): `backend/app/core/security.py`
- [Runtime configuration](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/core/config.py): `backend/app/core/config.py`

### Email capabilities

- [Email and tokens](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/backend/app/utils.py): `backend/app/utils.py`
- [New-account template](https://github.com/tiangolo/full-stack-fastapi-template/blob/master/packages/react-email/emails/new_account.tsx): `packages/react-email/emails/new_account.tsx`

### Other components

- **Dashboard user**
- **PostgreSQL**
- **SMTP mail service**

## Connections

- Dashboard user → React application: uses (evidence: `README.md`)
- React application → Generated API client: configures (evidence: `frontend/src/main.tsx`)
- React application → Sign-in and signup: routes
- React application → Dashboard views: routes
- Sign-in and signup → Generated API client: requests
- Dashboard views → Admin user tools: renders
- Dashboard views → Item tools: renders
- Dashboard views → Account settings: renders
- Admin user tools → Generated API client: requests
- Item tools → Generated API client: requests
- Account settings → Generated API client: requests
- Generated API client → API application: calls API (evidence: `README.md`)
- API application → API router: mounts (evidence: `backend/app/main.py`)
- API router → Login and recovery: registers (evidence: `backend/app/api/main.py`)
- API router → User endpoints: registers (evidence: `backend/app/api/main.py`)
- API router → Item endpoints: registers (evidence: `backend/app/api/main.py`)
- API router → Private utilities: registers (evidence: `backend/app/api/main.py`)
- Login and recovery → Data operations: authenticates (evidence: `backend/app/api/routes/login.py`)
- User endpoints → Data operations: uses (evidence: `backend/app/api/routes/users.py`)
- Item endpoints → Data operations: uses (evidence: `backend/app/api/routes/items.py`)
- Login and recovery → Auth and sessions: requires (evidence: `backend/app/api/routes/login.py`)
- User endpoints → Auth and sessions: requires (evidence: `backend/app/api/routes/users.py`)
- Item endpoints → Auth and sessions: requires (evidence: `backend/app/api/routes/items.py`)
- Auth and sessions → JWT and passwords: validates JWT (evidence: `backend/app/api/deps.py`)
- Data operations → JWT and passwords: hashes passwords (evidence: `backend/app/crud.py`)
- Data operations → User and item models: uses models (evidence: `backend/app/crud.py`)
- Auth and sessions → PostgreSQL: opens sessions (evidence: `backend/app/api/deps.py`)
- Data operations → PostgreSQL: reads and writes
- API application → Runtime configuration: loads settings (evidence: `backend/app/main.py`)
- Email and tokens → Runtime configuration: reads settings (evidence: `backend/app/utils.py`)
- Login and recovery → Email and tokens: sends recovery email (evidence: `backend/app/api/routes/login.py`)
- User endpoints → Email and tokens: sends account email (evidence: `backend/app/api/routes/users.py`)
- Email and tokens → SMTP mail service: sends email (evidence: `backend/app/utils.py`)
- New-account template → SMTP mail service: formats email (evidence: `README.md`)
- Dashboard user → SMTP mail service: receives recovery (evidence: `README.md`)
