# venkateshpulakala/expense-tracker architecture

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

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

## Overview

Expense Tracker is a browser-based personal finance app backed by a FastAPI API and MySQL. Users register or log in, then use the dashboard to manage income and expenses, filter transactions, view monthly totals and charts, and manage monthly budgets with overspending status. The API authenticates protected requests with JWTs and scopes financial records to the current user. The README documents charts and the broader feature set; frontend source is partial, so links reflect only visible request behavior and documented capabilities.

Main entry points: [`frontend/script.js`](https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/script.js) (Browser logic), [`backend/main.py`](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/main.py) (FastAPI app), [`backend/database.py`](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/database.py) (Database sessions), [`backend/auth.py`](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/auth.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_pages["Web pages<br/>[index.html]"]
  node_dashboard["Dashboard page<br/>[dashboard.html]"]
  node_frontend["Browser logic<br/>[script.js]"]
end

subgraph group_identity["Identity and API"]
  node_api["FastAPI app<br/>[main.py]"]
  node_users["Account routes<br/>[users.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
end

subgraph group_finance["Finance features"]
  node_transactions["Transactions<br/>[transactions.py]"]
  node_summary["Monthly summary<br/>[summary.py]"]
  node_budgets["Budgets and status<br/>[budgets.py]"]
  node_charts["Expense charts<br/>[script.js]"]
end

subgraph group_persistence["Persistence"]
  node_models["Data models<br/>[models.py]"]
  node_database["Database sessions<br/>[database.py]"]
end

node_person(("User"))
node_mysql[("MySQL database")]

node_person -->|"uses"| node_pages
node_person -->|"uses"| node_dashboard
node_pages -->|"loads"| node_frontend
node_dashboard -->|"loads"| node_frontend
node_frontend -->|"sends requests"| node_api
node_api -->|"dispatches"| node_users
node_api -->|"dispatches"| node_transactions
node_api -->|"dispatches"| node_summary
node_api -->|"dispatches"| node_budgets
node_users -->|"hashes and signs"| node_auth
node_transactions -->|"validates token"| node_auth
node_summary -->|"validates token"| node_auth
node_budgets -->|"validates token"| node_auth
node_users -->|"gets session"| node_database
node_auth -->|"gets session"| node_database
node_transactions -->|"gets session"| node_database
node_summary -->|"gets session"| node_database
node_budgets -->|"gets session"| node_database
node_users -->|"queries and writes"| node_models
node_auth -->|"looks up user"| node_models
node_transactions -->|"queries and writes"| node_models
node_summary -->|"aggregates transactions"| node_models
node_budgets -->|"queries and writes"| node_models
node_api -->|"creates tables"| node_database
node_database -->|"connects"| node_mysql
node_frontend -->|"renders"| node_charts
node_charts -->|"fetches transactions"| node_api
node_frontend -->|"requests totals"| node_summary
node_frontend -->|"manages records"| node_transactions
node_frontend -->|"manages budgets"| node_budgets
node_frontend -->|"registers and logs in"| node_users

click node_pages "https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/index.html"
click node_dashboard "https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/dashboard.html"
click node_frontend "https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/script.js"
click node_api "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/main.py"
click node_users "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/users.py"
click node_auth "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/auth.py"
click node_schemas "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/schemas.py"
click node_transactions "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/transactions.py"
click node_summary "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/summary.py"
click node_budgets "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/budgets.py"
click node_charts "https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/script.js"
click node_models "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/models.py"
click node_database "https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/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_pages,node_dashboard,node_frontend,node_person toneBlue
class node_api,node_users,node_auth,node_schemas,node_mysql toneAmber
class node_transactions,node_summary,node_budgets,node_charts toneMint
class node_models,node_database toneRose
```

## Components

### Browser experience

- [Web pages](https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/index.html): `frontend/index.html`
- [Dashboard page](https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/dashboard.html): `frontend/dashboard.html`
- [Browser logic](https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/script.js): `frontend/script.js`

### Identity and API

- [FastAPI app](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/main.py): `backend/main.py`
- [Account routes](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/users.py): `backend/routers/users.py`
- [Authentication](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/auth.py): `backend/auth.py`
- [Request schemas](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/schemas.py): `backend/schemas.py`

### Finance features

- [Transactions](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/transactions.py): `backend/routers/transactions.py`
- [Monthly summary](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/summary.py): `backend/routers/summary.py`
- [Budgets and status](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/routers/budgets.py): `backend/routers/budgets.py`
- [Expense charts](https://github.com/venkateshpulakala/expense-tracker/blob/main/frontend/script.js): `frontend/script.js`

### Persistence

- [Data models](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/models.py): `backend/models.py`
- [Database sessions](https://github.com/venkateshpulakala/expense-tracker/blob/main/backend/database.py): `backend/database.py`

### Other components

- **User**
- **MySQL database**

## Connections

- User → Web pages: uses
- User → Dashboard page: uses
- Web pages → Browser logic: loads
- Dashboard page → Browser logic: loads
- Browser logic → FastAPI app: sends requests
- FastAPI app → Account routes: dispatches
- FastAPI app → Transactions: dispatches
- FastAPI app → Monthly summary: dispatches
- FastAPI app → Budgets and status: dispatches
- Account routes → Authentication: hashes and signs
- Transactions → Authentication: validates token
- Monthly summary → Authentication: validates token
- Budgets and status → Authentication: validates token
- Account routes → Database sessions: gets session
- Authentication → Database sessions: gets session
- Transactions → Database sessions: gets session
- Monthly summary → Database sessions: gets session
- Budgets and status → Database sessions: gets session
- Account routes → Data models: queries and writes
- Authentication → Data models: looks up user
- Transactions → Data models: queries and writes
- Monthly summary → Data models: aggregates transactions
- Budgets and status → Data models: queries and writes
- FastAPI app → Database sessions: creates tables
- Database sessions → MySQL database: connects
- Browser logic → Expense charts: renders
- Expense charts → FastAPI app: fetches transactions
- Browser logic → Monthly summary: requests totals
- Browser logic → Transactions: manages records
- Browser logic → Budgets and status: manages budgets
- Browser logic → Account routes: registers and logs in
