# rudranshbhajni/python-expense-tracker architecture

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

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

## Overview

This is a small Python command-line expense tracker. A user selects an action in the menu; the app routes add and view requests to expense management, and total-spend requests to analysis. Adding validates the amount before saving a comma-separated record; viewing and analysis read saved records, with analysis summing their amounts. The README documents these capabilities and terminal launch. The local data file is named in source but is not present in the repository tree.

Main entry points: [`expense_manager.py`](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/expense_manager.py) (Expense manager), [`file_handler.py`](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/file_handler.py) (File handler), [`main.py`](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/main.py) (CLI menu), [`analysis.py`](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/analysis.py) (Total analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI interaction"]
  node_menu["CLI menu<br/>[main.py]"]
end

subgraph group_expense["Expense management"]
  node_manager["Expense manager<br/>[expense_manager.py]"]
  node_validation["Amount validation<br/>[validation.py]"]
end

subgraph group_records["Records and totals"]
  node_analysis["Total analysis<br/>[analysis.py]"]
  node_file_handler["File handler<br/>[file_handler.py]"]
  node_data_file[("Expense text file")]
end

node_user(("User"))

node_user -->|"chooses actions"| node_menu
node_menu -->|"routes add/view"| node_manager
node_menu -->|"routes total"| node_analysis
node_manager -->|"checks amount"| node_validation
node_manager -->|"saves records"| node_file_handler
node_manager -->|"reads records"| node_file_handler
node_analysis -->|"reads records"| node_file_handler
node_file_handler -->|"reads/writes"| node_data_file

click node_menu "https://github.com/rudranshbhajni/python-expense-tracker/blob/main/main.py"
click node_manager "https://github.com/rudranshbhajni/python-expense-tracker/blob/main/expense_manager.py"
click node_validation "https://github.com/rudranshbhajni/python-expense-tracker/blob/main/validation.py"
click node_analysis "https://github.com/rudranshbhajni/python-expense-tracker/blob/main/analysis.py"
click node_file_handler "https://github.com/rudranshbhajni/python-expense-tracker/blob/main/file_handler.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_menu,node_user toneBlue
class node_manager,node_validation toneAmber
class node_analysis,node_file_handler,node_data_file toneMint
```

## Components

### CLI interaction

- [CLI menu](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/main.py): `main.py`

### Expense management

- [Expense manager](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/expense_manager.py): `expense_manager.py`
- [Amount validation](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/validation.py): `validation.py`

### Records and totals

- [Total analysis](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/analysis.py): `analysis.py`
- [File handler](https://github.com/rudranshbhajni/python-expense-tracker/blob/main/file_handler.py): `file_handler.py`
- **Expense text file**

### Other components

- **User**

## Connections

- User → CLI menu: chooses actions (evidence: `main.py`)
- CLI menu → Expense manager: routes add/view (evidence: `main.py`)
- CLI menu → Total analysis: routes total (evidence: `main.py`)
- Expense manager → Amount validation: checks amount (evidence: `expense_manager.py`)
- Expense manager → File handler: saves records (evidence: `expense_manager.py`)
- Expense manager → File handler: reads records (evidence: `expense_manager.py`)
- Total analysis → File handler: reads records (evidence: `analysis.py`)
- File handler → Expense text file: reads/writes (evidence: `file_handler.py`)
