# v0410/expense-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/v0410/expense-tracker
- Repository: https://github.com/v0410/expense-tracker

## Overview

This is a Flask expense-tracking REST API with user registration and JWT-protected, per-user expense management. The main workflow is register or log in, receive a token, then submit validated expense requests for CRUD and filtered retrieval; routes persist and read records through SQLAlchemy backed by SQLite. The README also describes a CLI, but its entry point is absent from the supplied tree, so it is not mapped. The graph follows sampled runtime code; database migrations and tests are omitted.

Main entry points: [`app/extensions.py`](https://github.com/v0410/expense-tracker/blob/main/app/extensions.py) (ORM Extension), [`app/routes.py`](https://github.com/v0410/expense-tracker/blob/main/app/routes.py) (API Routes), [`app/__init__.py`](https://github.com/v0410/expense-tracker/blob/main/app/__init__.py) (App Factory), [`app/config.py`](https://github.com/v0410/expense-tracker/blob/main/app/config.py) (Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_factory["App Factory<br/>[__init__.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_routes["API Routes<br/>[routes.py]"]
end

subgraph group_identity["Identity"]
  node_register["Registration<br/>[routes.py]"]
  node_login["Login<br/>[routes.py]"]
  node_jwt["JWT Handling<br/>[routes.py]"]
end

subgraph group_expense["Expense Management"]
  node_validation["Expense Validation<br/>[validation.py]"]
  node_create["Create Expense<br/>[routes.py]"]
  node_read["Read Expenses<br/>[routes.py]"]
  node_filter["Filter Expenses<br/>[routes.py]"]
  node_update["Update Expense<br/>[routes.py]"]
  node_delete["Delete Expense<br/>[routes.py]"]
end

subgraph group_storage["Persistence"]
  node_models["Data Models<br/>[models.py]"]
  node_orm["ORM Extension<br/>[extensions.py]"]
  node_sqlite[("SQLite Database<br/>[config.py]")]
end

node_client(("API Client"))

node_client -->|"starts"| node_factory
node_factory -->|"loads"| node_config
node_factory -->|"initializes"| node_orm
node_factory -->|"registers"| node_routes
node_client -->|"submits credentials"| node_register
node_register -->|"queries and saves"| node_orm
node_register -->|"confirms registration"| node_client
node_client -->|"submits credentials"| node_login
node_login -->|"queries user"| node_orm
node_login -->|"issues token"| node_jwt
node_jwt -->|"returns token"| node_client
node_client -->|"sends authorized requests"| node_routes
node_routes -->|"checks token"| node_jwt
node_routes -->|"dispatches"| node_create
node_routes -->|"dispatches"| node_read
node_routes -->|"dispatches"| node_filter
node_routes -->|"dispatches"| node_update
node_routes -->|"dispatches"| node_delete
node_create -->|"validates"| node_validation
node_update -->|"validates"| node_validation
node_create -->|"saves"| node_orm
node_read -->|"queries"| node_orm
node_filter -->|"queries"| node_orm
node_update -->|"queries and saves"| node_orm
node_delete -->|"queries and deletes"| node_orm
node_orm -->|"maps entities"| node_models
node_orm -->|"reads and writes"| node_sqlite
node_config -->|"configures"| node_sqlite

click node_factory "https://github.com/v0410/expense-tracker/blob/main/app/__init__.py"
click node_config "https://github.com/v0410/expense-tracker/blob/main/app/config.py"
click node_routes "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_validation "https://github.com/v0410/expense-tracker/blob/main/app/validation.py"
click node_register "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_login "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_jwt "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_create "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_read "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_filter "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_update "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_delete "https://github.com/v0410/expense-tracker/blob/main/app/routes.py"
click node_models "https://github.com/v0410/expense-tracker/blob/main/app/models.py"
click node_orm "https://github.com/v0410/expense-tracker/blob/main/app/extensions.py"
click node_sqlite "https://github.com/v0410/expense-tracker/blob/main/app/config.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_factory,node_config,node_routes,node_client toneBlue
class node_register,node_login,node_jwt toneAmber
class node_validation,node_create,node_read,node_filter,node_update,node_delete toneMint
class node_models,node_orm,node_sqlite toneRose
```

## Components

### REST API

- [App Factory](https://github.com/v0410/expense-tracker/blob/main/app/__init__.py): `app/__init__.py`
- [Configuration](https://github.com/v0410/expense-tracker/blob/main/app/config.py): `app/config.py`
- [API Routes](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`

### Identity

- [Registration](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`
- [Login](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`
- [JWT Handling](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`

### Expense Management

- [Expense Validation](https://github.com/v0410/expense-tracker/blob/main/app/validation.py): `app/validation.py`
- [Create Expense](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`
- [Read Expenses](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`
- [Filter Expenses](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`
- [Update Expense](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`
- [Delete Expense](https://github.com/v0410/expense-tracker/blob/main/app/routes.py): `app/routes.py`

### Persistence

- [Data Models](https://github.com/v0410/expense-tracker/blob/main/app/models.py): `app/models.py`
- [ORM Extension](https://github.com/v0410/expense-tracker/blob/main/app/extensions.py): `app/extensions.py`
- [SQLite Database](https://github.com/v0410/expense-tracker/blob/main/app/config.py): `app/config.py`

### Other components

- **API Client**

## Connections

- API Client → App Factory: starts
- App Factory → Configuration: loads
- App Factory → ORM Extension: initializes
- App Factory → API Routes: registers
- API Client → Registration: submits credentials
- Registration → ORM Extension: queries and saves
- Registration → API Client: confirms registration
- API Client → Login: submits credentials
- Login → ORM Extension: queries user
- Login → JWT Handling: issues token
- JWT Handling → API Client: returns token
- API Client → API Routes: sends authorized requests
- API Routes → JWT Handling: checks token
- API Routes → Create Expense: dispatches
- API Routes → Read Expenses: dispatches
- API Routes → Filter Expenses: dispatches
- API Routes → Update Expense: dispatches
- API Routes → Delete Expense: dispatches
- Create Expense → Expense Validation: validates
- Update Expense → Expense Validation: validates
- Create Expense → ORM Extension: saves
- Read Expenses → ORM Extension: queries
- Filter Expenses → ORM Extension: queries
- Update Expense → ORM Extension: queries and saves
- Delete Expense → ORM Extension: queries and deletes
- ORM Extension → Data Models: maps entities
- ORM Extension → SQLite Database: reads and writes
- Configuration → SQLite Database: configures
