# bounlaiygame01/expense_tracker_lao architecture

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

- Interactive diagram: https://gitdiagram.com/bounlaiygame01/expense_tracker_lao
- Repository: https://github.com/bounlaiygame01/expense_tracker_lao

## Overview

This repository contains a Flutter expense-tracking app and a FastAPI backend. The backend exposes category, transaction, and budget CRUD endpoints backed by SQLAlchemy and MySQL; the sampled backend code also initializes tables and seeds default categories. The Flutter source is listed in the tree but was not sampled, and the README is empty, so its screens and exact API-call flow cannot be verified. The graph focuses on the evidenced backend workflow and its documented Flutter client boundary.

Main entry points: [`backend/app/main.py`](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/database.py`](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/database.py) (DB sessions), [`backend/app/models.py`](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/models.py) (Domain models), [`backend/app/routers/categories.py`](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/routers/categories.py) (Category endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API routing"]
  node_app["FastAPI app<br/>[main.py]"]
  node_categories["Category endpoints<br/>[categories.py]"]
  node_transactions["Transaction endpoints<br/>[transactions.py]"]
  node_budgets["Budget endpoints<br/>[budgets.py]"]
end

subgraph group_domain["Expense data"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_models["Domain models<br/>[models.py]"]
end

subgraph group_persistence["Persistence"]
  node_dbsession["DB sessions<br/>[database.py]"]
  node_mysql[("MySQL database")]
end

node_flutter(("Flutter client"))

node_flutter -->|"calls API"| node_app
node_app -->|"registers routes"| node_categories
node_app -->|"registers routes"| node_transactions
node_app -->|"registers routes"| node_budgets
node_app -->|"creates tables"| node_models
node_app -->|"uses engine"| node_dbsession
node_categories -->|"validates payloads"| node_schemas
node_categories -->|"queries and updates"| node_models
node_categories -->|"opens sessions"| node_dbsession
node_transactions -->|"validates payloads"| node_schemas
node_transactions -->|"queries and updates"| node_models
node_transactions -->|"opens sessions"| node_dbsession
node_budgets -->|"validates payloads"| node_schemas
node_budgets -->|"queries and updates"| node_models
node_budgets -->|"opens sessions"| node_dbsession
node_models -->|"uses model base"| node_dbsession
node_dbsession -->|"connects to"| node_mysql

click node_app "https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/main.py"
click node_categories "https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/routers/categories.py"
click node_transactions "https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/routers/transactions.py"
click node_budgets "https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/routers/budgets.py"
click node_schemas "https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/schemas.py"
click node_models "https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/models.py"
click node_dbsession "https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/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_app,node_categories,node_transactions,node_budgets,node_flutter toneBlue
class node_schemas,node_models toneAmber
class node_dbsession,node_mysql toneMint
```

## Components

### API routing

- [FastAPI app](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/main.py): `backend/app/main.py`
- [Category endpoints](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/routers/categories.py): `backend/app/routers/categories.py`
- [Transaction endpoints](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/routers/transactions.py): `backend/app/routers/transactions.py`
- [Budget endpoints](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/routers/budgets.py): `backend/app/routers/budgets.py`

### Expense data

- [Request schemas](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Domain models](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/models.py): `backend/app/models.py`

### Persistence

- [DB sessions](https://github.com/bounlaiygame01/expense_tracker_lao/blob/main/backend/app/database.py): `backend/app/database.py`
- **MySQL database**

### Other components

- **Flutter client**

## Connections

- Flutter client → FastAPI app: calls API (evidence: `backend/app/main.py`)
- FastAPI app → Category endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Transaction endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Budget endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Domain models: creates tables (evidence: `backend/app/main.py`)
- FastAPI app → DB sessions: uses engine (evidence: `backend/app/main.py`)
- Category endpoints → Request schemas: validates payloads (evidence: `backend/app/routers/categories.py`)
- Category endpoints → Domain models: queries and updates (evidence: `backend/app/routers/categories.py`)
- Category endpoints → DB sessions: opens sessions (evidence: `backend/app/routers/categories.py`)
- Transaction endpoints → Request schemas: validates payloads (evidence: `backend/app/routers/transactions.py`)
- Transaction endpoints → Domain models: queries and updates (evidence: `backend/app/routers/transactions.py`)
- Transaction endpoints → DB sessions: opens sessions (evidence: `backend/app/routers/transactions.py`)
- Budget endpoints → Request schemas: validates payloads (evidence: `backend/app/routers/budgets.py`)
- Budget endpoints → Domain models: queries and updates (evidence: `backend/app/routers/budgets.py`)
- Budget endpoints → DB sessions: opens sessions (evidence: `backend/app/routers/budgets.py`)
- Domain models → DB sessions: uses model base (evidence: `backend/app/models.py`)
- DB sessions → MySQL database: connects to (evidence: `backend/app/database.py`)
