# siamonas/expense-tracker-cli architecture

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

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

## Overview

This is a small Python expense-tracking CLI: users invoke commands to add, list, summarize, or delete expenses. The CLI dispatches to command handlers, which read or update JSON-backed expense data; listing and summary format results for display. The README also advertises categorization and period reports, though the sampled add handler does not accept or persist a category, and the CLI only exposes month filtering. Relationships below follow the shown calls; the runtime JSON file is not part of the repository tree.

Main entry points: [`expense-tracker.py`](https://github.com/siamonas/expense-tracker-cli/blob/master/expense-tracker.py) (Argument dispatch), [`commands/utils.py`](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/utils.py) (JSON utilities), [`commands/add.py`](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/add.py) (Add expense), [`commands/list.py`](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/list.py) (List expenses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["Argument dispatch<br/>[expense-tracker.py]"]
end

subgraph group_commands["Expense commands"]
  node_add["Add expense<br/>[add.py]"]
  node_list["List expenses<br/>[list.py]"]
  node_summary["Expense summary<br/>[summary.py]"]
  node_delete["Delete expense<br/>[delete.py]"]
end

subgraph group_storage["Expense storage"]
  node_storage_io["JSON utilities<br/>[utils.py]"]
  node_expense_data[("Expense records")]
end

node_user(("CLI user"))
node_rich["Rich display"]

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches add"| node_add
node_cli -->|"dispatches list"| node_list
node_cli -->|"dispatches summary"| node_summary
node_cli -->|"dispatches delete"| node_delete
node_add -->|"reads and writes"| node_storage_io
node_list -->|"reads"| node_storage_io
node_summary -->|"reads"| node_storage_io
node_delete -->|"reads and writes"| node_storage_io
node_storage_io -->|"reads and writes"| node_expense_data
node_add -->|"prints status"| node_rich
node_list -->|"renders table"| node_rich
node_summary -->|"prints totals"| node_rich
node_delete -->|"prints status"| node_rich

click node_cli "https://github.com/siamonas/expense-tracker-cli/blob/master/expense-tracker.py"
click node_add "https://github.com/siamonas/expense-tracker-cli/blob/master/commands/add.py"
click node_list "https://github.com/siamonas/expense-tracker-cli/blob/master/commands/list.py"
click node_summary "https://github.com/siamonas/expense-tracker-cli/blob/master/commands/summary.py"
click node_delete "https://github.com/siamonas/expense-tracker-cli/blob/master/commands/delete.py"
click node_storage_io "https://github.com/siamonas/expense-tracker-cli/blob/master/commands/utils.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_cli,node_user toneBlue
class node_add,node_list,node_summary,node_delete toneAmber
class node_storage_io,node_expense_data toneMint
class node_rich toneIndigo
```

## Components

### CLI entry

- [Argument dispatch](https://github.com/siamonas/expense-tracker-cli/blob/master/expense-tracker.py): `expense-tracker.py`

### Expense commands

- [Add expense](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/add.py): `commands/add.py`
- [List expenses](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/list.py): `commands/list.py`
- [Expense summary](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/summary.py): `commands/summary.py`
- [Delete expense](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/delete.py): `commands/delete.py`

### Expense storage

- [JSON utilities](https://github.com/siamonas/expense-tracker-cli/blob/master/commands/utils.py): `commands/utils.py`
- **Expense records**

### Other components

- **CLI user**
- **Rich display**

## Connections

- CLI user → Argument dispatch: runs commands (evidence: `README.md`)
- Argument dispatch → Add expense: dispatches add (evidence: `expense-tracker.py`)
- Argument dispatch → List expenses: dispatches list (evidence: `expense-tracker.py`)
- Argument dispatch → Expense summary: dispatches summary (evidence: `expense-tracker.py`)
- Argument dispatch → Delete expense: dispatches delete (evidence: `expense-tracker.py`)
- Add expense → JSON utilities: reads and writes (evidence: `commands/add.py`)
- List expenses → JSON utilities: reads (evidence: `commands/list.py`)
- Expense summary → JSON utilities: reads (evidence: `commands/summary.py`)
- Delete expense → JSON utilities: reads and writes (evidence: `commands/delete.py`)
- JSON utilities → Expense records: reads and writes (evidence: `commands/utils.py`)
- Add expense → Rich display: prints status (evidence: `commands/add.py`)
- List expenses → Rich display: renders table (evidence: `commands/list.py`)
- Expense summary → Rich display: prints totals (evidence: `commands/summary.py`)
- Delete expense → Rich display: prints status (evidence: `commands/delete.py`)
