https://github.com/cps7/expense-tracker-cli
Expense-Tracker-CLI is a powerful command-line personal finance manager built with Python and SQLite. It allows you to track, analyze, and visualize your expenses with advanced features like budgeting, trend charts, and encrypted notes—all from the terminal.
https://github.com/cps7/expense-tracker-cli
budgeting cli code encryption expense-tracker finance-management fpdf matplotlib openpyxl personal-finance productivity-tools python rich sqlalchemy sqlite terminal-app
Last synced: 2 months ago
JSON representation
Expense-Tracker-CLI is a powerful command-line personal finance manager built with Python and SQLite. It allows you to track, analyze, and visualize your expenses with advanced features like budgeting, trend charts, and encrypted notes—all from the terminal.
- Host: GitHub
- URL: https://github.com/cps7/expense-tracker-cli
- Owner: CPS7
- Created: 2025-11-16T07:25:14.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-11-16T08:57:15.000Z (3 months ago)
- Last Synced: 2025-11-16T09:17:42.408Z (3 months ago)
- Topics: budgeting, cli, code, encryption, expense-tracker, finance-management, fpdf, matplotlib, openpyxl, personal-finance, productivity-tools, python, rich, sqlalchemy, sqlite, terminal-app
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
# Expense Tracker CLI

A Python CLI app to manage personal expenses with budgets, analytics, exports, and optional encrypted notes.
---
If you like this tool, ⭐ it on GitHub!
## **Features**
* Add, update, and soft-delete expenses
* Categorize expenses and track monthly budgets
* View monthly totals per category
* Filter/search expenses by category, date, amount, or keyword
* Export to **Excel (.xlsx)** and **PDF (.pdf)**
* Optional **note encryption** using Fernet
* Spending trend visualization (ASCII + chart embedded in PDF)
* Rich interactive CLI with tables, prompts, and panels
---
## **Tech Stack**
* **Python 3.10+**
* **SQLite** via **SQLAlchemy ORM**
* CLI UI: [`rich`](https://github.com/Textualize/rich)
* PDF export: [`fpdf`](https://pypi.org/project/fpdf/)
* Excel export: [`openpyxl`](https://pypi.org/project/openpyxl/)
* Charting: [`matplotlib`](https://matplotlib.org/)
* Optional encryption: [`cryptography`](https://cryptography.io/)
---
## **Setup**
1. **Clone repo**
```bash
git clone https://github.com/CPS7/Expense-Tracker-CLI.git
cd Expense-Tracker-CLI
```
2. **Create virtual environment**
```bash
python -m venv venv
source venv/bin/activate # Linux / macOS
venv\Scripts\activate # Windows
```
3. **Install dependencies**
```bash
pip install -r requirements.txt
```
4. **Optional: Enable note encryption**
Create a `.env` file with:
```
EXPENSE_ENCRYPT_NOTES=1
EXPENSE_KEY=
```
> Key must be **32 url-safe base64 bytes**. Encryption can be disabled by setting `EXPENSE_ENCRYPT_NOTES=0` or leaving `EXPENSE_KEY` empty.
---
## **Usage**
Run the CLI app:
```bash
python main.py
```
You’ll see a menu like:
```
1. Add Expense
2. View Expenses
3. Soft Delete Expense
...
14. Exit
```
* Navigate with number input
* Follow prompts for amount, date, note, category, etc.
* Export options available for Excel and PDF reports
---
## **Examples**
**Add an expense:**
```text
Amount (₹): 500
Note: Groceries
Date (YYYY-MM-DD): 2025-11-15
Category: Food
Currency: INR
✔ Expense saved (id: 1)
```
**View monthly category totals:**
```text
Category Totals - November 2025
-------------------------------
Food 1500.00
Transport 800.00
Utilities 300.00
-------------------------------
Total all categories: 2600.00
```
**Export filtered expenses to PDF with trend chart**
```
Search & Export -> Export as PDF -> Embed trend chart: Yes
✔ PDF exported: expenses_report_20251115_221530.pdf
```
---
## **Database Schema**
* `categories` → Expense categories
* `expenses` → Stores individual expenses
* `budgets` → Monthly budgets per category
* `expense_history` → Tracks create/update/delete actions
* `meta_info` → Schema version info
---
## **Notes**
* Soft delete sets `deleted=True`; hard delete removes record.
* Notes cannot be searched reliably if encryption is enabled.
* Budgets trigger warnings at **80% spent** and **100% exceeded**.
* Trend charts are embedded in PDF; temporary files are cleaned automatically.
---
## **License**
MIT License © 2025 CPS7
---