A command-line based Expense Tracker built in Python to help you log and manage your expenses locally. Supports adding, updating, deleting, and summarizing expenses, with all data stored in a simple JSON file from your Terminal.
- Add, update, and delete expense records
- View all expenses in a readable table format
- Filter by category
- Get total or monthly summaries
- Data stored persistently in
expenses.json - Auto-generates unique IDs
- Lightweight and fast – no external dependencies
- Language: Python 3.8+
- Libraries: Standard Library only (
argparse,json,datetime,os) - Storage: JSON-based (
expenses.json)
expense-tracker-cli/
├── main.py # Entry point: CLI interface using argparse
├── expense.py # ExpenseManager class (handles business logic)
├── file.py # Handles loading/saving data and ID generation
├── expenses.json # Local JSON database (auto-generated)
└── README.md
git clone https://github.com/prakh0/Expense_Tracker_cli.git
cd expense-tracker-cliMake sure you have Python 3 installed.
python3 main.py --helppython3 main.py add --description "Lunch" --amount 12.5 --category FoodOutput:
Expense added successfully (ID: 1)
python3 main.py listOutput:
| ID | Date | Description | Amount | Category |
|-----|------------|-------------------|---------|-----------|
| 1 | 2025-08-02 | Bought vegetables | $250.0 | Groceries |
| 2 | 2025-08-02 | test | $1500.0 | unknown |
| 3 | 2025-08-02 | Lunch | $12.5 | Food |
python3 main.py summaryOutput:
Total expenses: $1762.50
python3 main.py monthly-summary --month 8Output:
Total expenses for August: $1762.50
python3 main.py delete --id 1Output:
Expense with ID 1 deleted successfully.
python3 main.py update --id "2" --description "OTT" --amount 1500 --category Entertainment Output:
Expense with ID 2 updated successfully.
python3 main.py filter-category --category Food-
You can run
--helpwith any subcommand to see its arguments:python3 main.py --help