# kirillkaszycki/fastapi-course architecture

> Architecture diagram of the GitHub repository kirillkaszycki/fastapi-course, 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/kirillkaszycki/fastapi-course
- Repository: https://github.com/kirillkaszycki/fastapi-course

## Overview

Finance tracker is a FastAPI application for managing users, currency-denominated wallets, income and expenses, transfers, and balances. The principal workflow is an HTTP request through a versioned API route, with database-session and user dependencies, into a service that applies domain rules and coordinates repository access; responses use Pydantic schemas. Wallet balances can be converted using an external exchange-rate service, with fallback rates. The README documents the API/service/repository layers; some user and startup connections are supported only by the SOURCE INDEX, and the frontend’s runtime wiring was not sampled.

Main entry points: [`app/dependency.py`](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/dependency.py) (Request dependencies), [`main.py`](https://github.com/kirillkaszycki/fastapi-course/blob/main/main.py) (FastAPI app), [`app/api/v1/users.py`](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/users.py) (User routes), [`app/api/v1/wallets.py`](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/wallets.py) (Wallet routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP and UI"]
  node_startup["FastAPI app<br/>[main.py]"]
  node_user_api["User routes<br/>[users.py]"]
  node_wallet_api["Wallet routes<br/>[wallets.py]"]
  node_operation_api["Operation routes<br/>[operations.py]"]
  node_web_ui["Static web UI"]
end

subgraph group_domain["Finance services"]
  node_user_service["User service<br/>[users.py]"]
  node_wallet_service["Wallet service<br/>[wallets.py]"]
  node_operation_service["Operation service<br/>[operations.py]"]
  node_exchange["Exchange rates"]
end

subgraph group_data["Persistence"]
  node_user_repo["User repository<br/>[users.py]"]
  node_wallet_repo["Wallet repository<br/>[wallets.py]"]
  node_operation_repo["Operation repository<br/>[operations.py]"]
  node_finance_db[("Finance database")]
end

subgraph group_shared["Shared infrastructure"]
  node_dependencies["Request dependencies<br/>[dependency.py]"]
  node_db_config["DB session setup<br/>[database.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
  node_models["ORM models<br/>[models.py]"]
  node_enums["Currency and operation types<br/>[enum.py]"]
end

node_client(("API client"))
node_rate_api["Exchange-rate API"]

node_client -->|"sends requests"| node_startup
node_startup -->|"registers routes"| node_user_api
node_startup -->|"registers routes"| node_wallet_api
node_startup -->|"registers routes"| node_operation_api
node_user_api -->|"delegates to"| node_user_service
node_wallet_api -->|"delegates to"| node_wallet_service
node_operation_api -->|"delegates to"| node_operation_service
node_user_api -->|"uses auth and DB"| node_dependencies
node_wallet_api -->|"uses DB session"| node_dependencies
node_operation_api -->|"uses auth and DB"| node_dependencies
node_user_service -->|"uses"| node_user_repo
node_wallet_service -->|"uses"| node_wallet_repo
node_operation_service -->|"uses"| node_wallet_repo
node_operation_service -->|"records operations"| node_operation_repo
node_wallet_service -->|"converts balances"| node_exchange
node_operation_service -->|"converts transfers"| node_exchange
node_exchange -->|"requests rates"| node_rate_api
node_dependencies -->|"opens sessions"| node_db_config
node_dependencies -->|"looks up user"| node_user_repo
node_db_config -.->|"configures connection"| node_finance_db
node_user_repo -->|"accesses records"| node_finance_db
node_wallet_repo -->|"accesses records"| node_finance_db
node_operation_repo -->|"accesses records"| node_finance_db
node_models -->|"uses declarative base"| node_db_config
node_user_api -->|"validates and shapes"| node_schemas
node_wallet_api -->|"validates and shapes"| node_schemas
node_operation_api -->|"validates and shapes"| node_schemas
node_web_ui -.->|"serves interface"| node_client

click node_startup "https://github.com/kirillkaszycki/fastapi-course/blob/main/main.py"
click node_user_api "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/users.py"
click node_wallet_api "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/wallets.py"
click node_operation_api "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/operations.py"
click node_web_ui "https://github.com/kirillkaszycki/fastapi-course/tree/main/app/static"
click node_user_service "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/users.py"
click node_wallet_service "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/wallets.py"
click node_operation_service "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/operations.py"
click node_exchange "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/exchange_service.py"
click node_user_repo "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/repository/users.py"
click node_wallet_repo "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/repository/wallets.py"
click node_operation_repo "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/repository/operations.py"
click node_dependencies "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/dependency.py"
click node_db_config "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/database.py"
click node_schemas "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/schemas.py"
click node_models "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/models.py"
click node_enums "https://github.com/kirillkaszycki/fastapi-course/blob/main/app/enum.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_startup,node_user_api,node_wallet_api,node_operation_api,node_web_ui,node_client toneBlue
class node_user_service,node_wallet_service,node_operation_service,node_exchange toneAmber
class node_user_repo,node_wallet_repo,node_operation_repo,node_finance_db,node_rate_api toneMint
class node_dependencies,node_db_config,node_schemas,node_models,node_enums toneRose
```

## Components

### HTTP and UI

- [FastAPI app](https://github.com/kirillkaszycki/fastapi-course/blob/main/main.py): `main.py`
- [User routes](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/users.py): `app/api/v1/users.py`
- [Wallet routes](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/wallets.py): `app/api/v1/wallets.py`
- [Operation routes](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/api/v1/operations.py): `app/api/v1/operations.py`
- [Static web UI](https://github.com/kirillkaszycki/fastapi-course/tree/main/app/static): `app/static`

### Finance services

- [User service](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/users.py): `app/services/users.py`
- [Wallet service](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/wallets.py): `app/services/wallets.py`
- [Operation service](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/operations.py): `app/services/operations.py`
- [Exchange rates](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/services/exchange_service.py): `app/services/exchange_service.py`

### Persistence

- [User repository](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/repository/users.py): `app/repository/users.py`
- [Wallet repository](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/repository/wallets.py): `app/repository/wallets.py`
- [Operation repository](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/repository/operations.py): `app/repository/operations.py`
- **Finance database**

### Shared infrastructure

- [Request dependencies](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/dependency.py): `app/dependency.py`
- [DB session setup](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/database.py): `app/database.py`
- [Request and response schemas](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/schemas.py): `app/schemas.py`
- [ORM models](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/models.py): `app/models.py`
- [Currency and operation types](https://github.com/kirillkaszycki/fastapi-course/blob/main/app/enum.py): `app/enum.py`

### Other components

- **API client**
- **Exchange-rate API**

## Connections

- API client → FastAPI app: sends requests (evidence: `README.md`)
- FastAPI app → User routes: registers routes (evidence: `main.py`)
- FastAPI app → Wallet routes: registers routes (evidence: `main.py`)
- FastAPI app → Operation routes: registers routes (evidence: `main.py`)
- User routes → User service: delegates to (evidence: `app/api/v1/users.py`)
- Wallet routes → Wallet service: delegates to (evidence: `app/api/v1/wallets.py`)
- Operation routes → Operation service: delegates to (evidence: `app/api/v1/operations.py`)
- User routes → Request dependencies: uses auth and DB (evidence: `app/api/v1/users.py`)
- Wallet routes → Request dependencies: uses DB session (evidence: `app/api/v1/wallets.py`)
- Operation routes → Request dependencies: uses auth and DB (evidence: `app/api/v1/operations.py`)
- User service → User repository: uses (evidence: `app/services/users.py`)
- Wallet service → Wallet repository: uses (evidence: `app/services/wallets.py`)
- Operation service → Wallet repository: uses (evidence: `app/services/operations.py`)
- Operation service → Operation repository: records operations (evidence: `app/services/operations.py`)
- Wallet service → Exchange rates: converts balances (evidence: `app/services/wallets.py`)
- Operation service → Exchange rates: converts transfers (evidence: `app/services/operations.py`)
- Exchange rates → Exchange-rate API: requests rates (evidence: `app/services/exchange_service.py`)
- Request dependencies → DB session setup: opens sessions (evidence: `app/dependency.py`)
- Request dependencies → User repository: looks up user (evidence: `app/dependency.py`)
- DB session setup → Finance database: configures connection (evidence: `README.md`)
- User repository → Finance database: accesses records (evidence: `README.md`)
- Wallet repository → Finance database: accesses records (evidence: `README.md`)
- Operation repository → Finance database: accesses records (evidence: `README.md`)
- ORM models → DB session setup: uses declarative base (evidence: `app/models.py`)
- User routes → Request and response schemas: validates and shapes (evidence: `app/api/v1/users.py`)
- Wallet routes → Request and response schemas: validates and shapes (evidence: `app/api/v1/wallets.py`)
- Operation routes → Request and response schemas: validates and shapes (evidence: `app/api/v1/operations.py`)
- Static web UI → API client: serves interface
