# metoo8803/expense_tracker architecture

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

- Interactive diagram: https://gitdiagram.com/metoo8803/expense_tracker
- Repository: https://github.com/metoo8803/expense_tracker

## Overview

This is a small expense-tracking web app: a user loads the frontend, then can list, create, edit, or delete expenses through HTTP endpoints. The FastAPI handlers validate and shape data with Pydantic schemas and use SQLite for persistence. The frontend’s fetch calls and the backend’s routes are shown in source; the HTML file exists in the tree but its contents were not provided, so no HTML-to-script relationship is asserted.

Main entry points: [`main.py`](https://github.com/metoo8803/expense_tracker/blob/main/main.py) (FastAPI routes), [`database.py`](https://github.com/metoo8803/expense_tracker/blob/main/database.py) (SQLite connection and setup), [`static/app.js`](https://github.com/metoo8803/expense_tracker/blob/main/static/app.js) (Expense interface), [`static/index.html`](https://github.com/metoo8803/expense_tracker/blob/main/static/index.html) (Frontend page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_html["Frontend page<br/>[index.html]"]
  node_expense_ui["Expense interface<br/>[app.js]"]
end

subgraph group_backend["API and validation"]
  node_web_api["FastAPI routes<br/>[main.py]"]
  node_schemas["Expense schemas<br/>[schemas.py]"]
end

subgraph group_storage["Persistence"]
  node_db_helpers["SQLite connection and setup<br/>[database.py]"]
  node_expense_store[("Expenses database<br/>[expenses.db]")]
end

node_user(("User"))

node_user -->|"opens app"| node_web_api
node_web_api -->|"serves page"| node_frontend_html
node_expense_ui -->|"calls CRUD routes"| node_web_api
node_web_api -->|"validates and shapes"| node_schemas
node_web_api -->|"gets connections"| node_db_helpers
node_db_helpers -->|"opens database"| node_expense_store

click node_web_api "https://github.com/metoo8803/expense_tracker/blob/main/main.py"
click node_frontend_html "https://github.com/metoo8803/expense_tracker/blob/main/static/index.html"
click node_expense_ui "https://github.com/metoo8803/expense_tracker/blob/main/static/app.js"
click node_schemas "https://github.com/metoo8803/expense_tracker/blob/main/schemas.py"
click node_db_helpers "https://github.com/metoo8803/expense_tracker/blob/main/database.py"
click node_expense_store "https://github.com/metoo8803/expense_tracker/blob/main/expenses.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_frontend_html,node_expense_ui,node_user toneBlue
class node_web_api,node_schemas toneAmber
class node_db_helpers,node_expense_store toneMint
```

## Components

### Frontend

- [Frontend page](https://github.com/metoo8803/expense_tracker/blob/main/static/index.html): `static/index.html`
- [Expense interface](https://github.com/metoo8803/expense_tracker/blob/main/static/app.js): `static/app.js`

### API and validation

- [FastAPI routes](https://github.com/metoo8803/expense_tracker/blob/main/main.py): `main.py`
- [Expense schemas](https://github.com/metoo8803/expense_tracker/blob/main/schemas.py): `schemas.py`

### Persistence

- [SQLite connection and setup](https://github.com/metoo8803/expense_tracker/blob/main/database.py): `database.py`
- [Expenses database](https://github.com/metoo8803/expense_tracker/blob/main/expenses.db): `expenses.db`

### Other components

- **User**

## Connections

- User → FastAPI routes: opens app (evidence: `main.py`)
- FastAPI routes → Frontend page: serves page (evidence: `main.py`)
- Expense interface → FastAPI routes: calls CRUD routes (evidence: `static/app.js`)
- FastAPI routes → Expense schemas: validates and shapes (evidence: `main.py`)
- FastAPI routes → SQLite connection and setup: gets connections (evidence: `main.py`)
- SQLite connection and setup → Expenses database: opens database (evidence: `database.py`)
