# thalath/budget-and-expense-thracking architecture

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

- Interactive diagram: https://gitdiagram.com/thalath/budget-and-expense-thracking
- Repository: https://github.com/thalath/budget-and-expense-thracking

## Overview

This is a Flask expense-tracking application with user authentication and administration. Users register or sign in, then access CRUD workflows for users, roles, permissions, categories, and expenses; service classes perform domain operations against SQLAlchemy models. The model layer also represents budgets and many-to-many relationships. Budget services and forms appear in the source index, but no budget route or user-facing workflow is shown, so that branch is included without inferring a route. The README is empty; connections for unsampled modules rely on source-index references.

Main entry points: [`app/models`](https://github.com/thalath/budget-and-expense-thracking/tree/main/app/models) (Identity and access), [`app/forms`](https://github.com/thalath/budget-and-expense-thracking/tree/main/app/forms) (Workflow forms), [`app/routes/auth_routes.py`](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/auth_routes.py) (Authentication), [`app/routes/user_routes.py`](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/user_routes.py) (User management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_auth["Authentication<br/>[auth_routes.py]"]
  node_user_routes["User management<br/>[user_routes.py]"]
  node_role_routes["Role management<br/>[role_routes.py]"]
  node_permission_routes["Permission management"]
  node_category_routes["Category management<br/>[category_routes.py]"]
  node_expense_routes["Expense management<br/>[expense_routes.py]"]
  node_forms["Workflow forms"]
end

subgraph group_services["Domain services"]
  node_user_service["User service<br/>[user_services.py]"]
  node_role_service["Role service<br/>[role_service.py]"]
  node_permission_service["Permission service"]
  node_category_service["Category service"]
  node_expense_service["Expense service"]
  node_budget_service["Budget service<br/>[budget_services.py]"]
end

subgraph group_models["Domain models"]
  node_identity_models["Identity and access"]
  node_expense_models["Expense records"]
  node_budget_model["Budget model<br/>[budgets.py]"]
  node_associations["Relationship tables<br/>[associations.py]"]
end

subgraph group_infra["Persistence and security"]
  node_sqlalchemy["SQLAlchemy extension<br/>[extensions.py]"]
  node_sqlite[("SQLite database")]
end

node_user(("User"))

node_user -->|"signs in"| node_auth
node_user -.->|"manages records"| node_user_routes
node_auth -->|"creates account"| node_user_service
node_auth -->|"checks credentials"| node_identity_models
node_user_routes -->|"validates input"| node_forms
node_user_routes -->|"manages users"| node_user_service
node_role_routes -->|"validates input"| node_forms
node_role_routes -->|"manages roles"| node_role_service
node_permission_routes -->|"validates input"| node_forms
node_permission_routes -->|"manages permissions"| node_permission_service
node_category_routes -->|"validates input"| node_forms
node_category_routes -->|"manages categories"| node_category_service
node_expense_routes -->|"validates input"| node_forms
node_expense_routes -->|"manages expenses"| node_expense_service
node_user_service -->|"reads and writes"| node_identity_models
node_role_service -->|"reads and writes"| node_identity_models
node_permission_service -->|"reads and writes"| node_identity_models
node_category_service -->|"reads and writes"| node_expense_models
node_expense_service -->|"reads and writes"| node_expense_models
node_budget_service -->|"reads and writes"| node_budget_model
node_budget_service -->|"uses expenses"| node_expense_models
node_identity_models -->|"links roles"| node_associations
node_expense_models -->|"links categories"| node_associations
node_budget_model -->|"links expenses"| node_associations
node_sqlalchemy -.->|"backs ORM"| node_sqlite

click node_auth "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/auth_routes.py"
click node_user_routes "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/user_routes.py"
click node_role_routes "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/role_routes.py"
click node_permission_routes "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/permission_routes.py"
click node_category_routes "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/category_routes.py"
click node_expense_routes "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/expense_routes.py"
click node_forms "https://github.com/thalath/budget-and-expense-thracking/tree/main/app/forms"
click node_user_service "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/user_services.py"
click node_role_service "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/role_service.py"
click node_permission_service "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/permission_service.py"
click node_category_service "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/category_services.py"
click node_expense_service "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/expense_services.py"
click node_budget_service "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/budget_services.py"
click node_identity_models "https://github.com/thalath/budget-and-expense-thracking/tree/main/app/models"
click node_expense_models "https://github.com/thalath/budget-and-expense-thracking/tree/main/app/models"
click node_budget_model "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/models/budgets.py"
click node_associations "https://github.com/thalath/budget-and-expense-thracking/blob/main/app/models/associations.py"
click node_sqlalchemy "https://github.com/thalath/budget-and-expense-thracking/blob/main/extensions.py"
click node_sqlite "https://github.com/thalath/budget-and-expense-thracking/blob/main/instance/expense_tracking_system.db"

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_auth,node_user_routes,node_role_routes,node_permission_routes,node_category_routes,node_expense_routes,node_forms,node_user toneBlue
class node_user_service,node_role_service,node_permission_service,node_category_service,node_expense_service,node_budget_service toneAmber
class node_identity_models,node_expense_models,node_budget_model,node_associations toneMint
class node_sqlalchemy,node_sqlite toneRose
```

## Components

### Web workflows

- [Authentication](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/auth_routes.py): `app/routes/auth_routes.py`
- [User management](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/user_routes.py): `app/routes/user_routes.py`
- [Role management](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/role_routes.py): `app/routes/role_routes.py`
- [Permission management](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/permission_routes.py): `app/routes/permission_routes.py`
- [Category management](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/category_routes.py): `app/routes/category_routes.py`
- [Expense management](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/routes/expense_routes.py): `app/routes/expense_routes.py`
- [Workflow forms](https://github.com/thalath/budget-and-expense-thracking/tree/main/app/forms): `app/forms`

### Domain services

- [User service](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/user_services.py): `app/services/user_services.py`
- [Role service](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/role_service.py): `app/services/role_service.py`
- [Permission service](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/permission_service.py): `app/services/permission_service.py`
- [Category service](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/category_services.py): `app/services/category_services.py`
- [Expense service](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/expense_services.py): `app/services/expense_services.py`
- [Budget service](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/services/budget_services.py): `app/services/budget_services.py`

### Domain models

- [Identity and access](https://github.com/thalath/budget-and-expense-thracking/tree/main/app/models): `app/models`
- [Expense records](https://github.com/thalath/budget-and-expense-thracking/tree/main/app/models): `app/models`
- [Budget model](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/models/budgets.py): `app/models/budgets.py`
- [Relationship tables](https://github.com/thalath/budget-and-expense-thracking/blob/main/app/models/associations.py): `app/models/associations.py`

### Persistence and security

- [SQLAlchemy extension](https://github.com/thalath/budget-and-expense-thracking/blob/main/extensions.py): `extensions.py`
- [SQLite database](https://github.com/thalath/budget-and-expense-thracking/blob/main/instance/expense_tracking_system.db): `instance/expense_tracking_system.db`

### Other components

- **User**

## Connections

- User → Authentication: signs in (evidence: `app/routes/auth_routes.py`)
- User → User management: manages records
- Authentication → User service: creates account (evidence: `app/routes/auth_routes.py`)
- Authentication → Identity and access: checks credentials (evidence: `app/routes/auth_routes.py`)
- User management → Workflow forms: validates input (evidence: `app/routes/user_routes.py`)
- User management → User service: manages users (evidence: `app/routes/user_routes.py`)
- Role management → Workflow forms: validates input (evidence: `app/routes/role_routes.py`)
- Role management → Role service: manages roles (evidence: `app/routes/role_routes.py`)
- Permission management → Workflow forms: validates input (evidence: `app/routes/permission_routes.py`)
- Permission management → Permission service: manages permissions (evidence: `app/routes/permission_routes.py`)
- Category management → Workflow forms: validates input (evidence: `app/routes/category_routes.py`)
- Category management → Category service: manages categories (evidence: `app/routes/category_routes.py`)
- Expense management → Workflow forms: validates input (evidence: `app/routes/expense_routes.py`)
- Expense management → Expense service: manages expenses (evidence: `app/routes/expense_routes.py`)
- User service → Identity and access: reads and writes (evidence: `app/services/user_services.py`)
- Role service → Identity and access: reads and writes (evidence: `app/services/role_service.py`)
- Permission service → Identity and access: reads and writes (evidence: `app/services/permission_service.py`)
- Category service → Expense records: reads and writes (evidence: `app/services/category_services.py`)
- Expense service → Expense records: reads and writes (evidence: `app/services/expense_services.py`)
- Budget service → Budget model: reads and writes (evidence: `app/services/budget_services.py`)
- Budget service → Expense records: uses expenses (evidence: `app/services/budget_services.py`)
- Identity and access → Relationship tables: links roles (evidence: `app/models/user.py`)
- Expense records → Relationship tables: links categories (evidence: `app/models/expenses.py`)
- Budget model → Relationship tables: links expenses (evidence: `app/models/budgets.py`)
- SQLAlchemy extension → SQLite database: backs ORM
