A production-ready command-line expense tracker built in C++17 with a SQLite backend. Track daily spending, organize expenses by category, and get automatic insights โ category breakdowns, monthly reports, and smart budget warnings.
โจ Perfect for learning: OOP design patterns, database management, and CLI applications in modern C++!
This is a C++ rewrite of an earlier Python/Pandas version, redesigned around object-oriented principles, raw SQL with prepared statements, and a custom in-memory analytics engine (no external data processing libraries).
- โ Full CRUD Operations โ Add, view, update, and delete expense records with SQLite persistence
- ๐ Smart Filtering โ Filter expenses by category or date range
- ๐ Advanced Analytics Engine โ Category breakdowns, monthly reports, weekly (ISO week) reports, and summary insights
- ๐ก Budget Alerts โ Set monthly budgets per category and get notifications when you exceed them
- ๐ก๏ธ Data Validation โ Strict validation for amounts, dates, and categories
- โ๏ธ Optimized Database โ Normalized schema with indexed queries for lightning-fast performance
| Layer | Technology |
|---|---|
| Language | C++17 (Modern C++) |
| Database | SQLite3 (via official C API) |
| Build System | Make + g++ |
| Architecture | OOP with Clean Code Principles |
Expense-Tracker/
โโโ include/
โ โโโ Expense.h # Data model for a single expense
โ โโโ Database.h # SQLite wrapper - schema, CRUD, queries
โ โโโ Analytics.h # Insights engine - breakdowns, reports
โ โโโ Tracker.h # Application controller / CLI logic
โโโ src/
โ โโโ Expense.cpp
โ โโโ Database.cpp
โ โโโ Analytics.cpp
โ โโโ Tracker.cpp
โ โโโ main.cpp # CLI entry point & menu system
โโโ Makefile
โโโ LICENSE # MIT License
โโโ README.md
Expenseโ Plain data class representing a single transaction (id, amount, category, description, date)Databaseโ Manages SQLite connection, schema creation, and prepared-statement CRUD operationsAnalyticsโ Computes category totals, monthly/weekly aggregates, top spending, and budget comparisonsTrackerโ Controller class that validates input and orchestrates Database & Analytics operations
CREATE TABLE categories (
name TEXT PRIMARY KEY,
budget_limit REAL DEFAULT 0
);
CREATE TABLE expenses (
id INTEGER PRIMARY KEY AUTOINCREMENT,
amount REAL NOT NULL,
category TEXT NOT NULL,
description TEXT,
date TEXT NOT NULL,
FOREIGN KEY (category) REFERENCES categories(name)
);
CREATE INDEX idx_expenses_category ON expenses(category);
CREATE INDEX idx_expenses_date ON expenses(date);Default Categories: Food, Transport, Utilities, Entertainment, Health, Shopping, Other
- C++17 compiler (
g++9+ or equivalent) makebuild tool- SQLite3 development headers
Ubuntu/Debian:
sudo apt update
sudo apt install build-essential libsqlite3-devmacOS (Homebrew):
brew install sqlite3# Clone the repository
git clone https://github.com/yashkumar3006/Expense-Tracker.git
cd Expense-Tracker
# Build the project
make
# Run the application
./expense_tracker
# or simply: make runA SQLite database (expenses.db) is created automatically on first run.
make clean================ SMART EXPENSE TRACKER ================
1. Add Expense
2. View All Expenses
3. View Expenses by Category
4. View Expenses by Date Range
5. Update Expense
6. Delete Expense
--------------------------------------------------------
7. Summary Report (full insights)
8. Category Breakdown
9. Monthly Report
10. Weekly Report
11. Budget Warnings
--------------------------------------------------------
12. List Categories
13. Set Category Budget
0. Exit
=========================================================
Select an option: 1
Enter amount: 450
Enter category: Food
Enter description: Lunch at a cafe
Enter date (YYYY-MM-DD): 2026-07-24
โ Expense added successfully.
========== EXPENSE SUMMARY REPORT ==========
Total Spend: Rs. 3000.00
Total Records: 4
Top Category: Food
--- Category Breakdown ---
Entertainment Rs. 800.00 (26.7%)
Food Rs. 2000.00 (66.7%)
Transport Rs. 200.00 (6.7%)
--- Monthly Report ---
2026-06 : Rs. 3000.00
--- Weekly Report ---
2026-W23 : Rs. 700.00
2026-W24 : Rs. 2300.00
--- Budget Warnings ---
Food: Spent Rs. 2000.00 / Budget Rs. 1500.00 โ ๏ธ OVER BUDGET!
==============================================
This project demonstrates:
- โ Modern C++17 features and best practices
- โ Object-Oriented Design principles
- โ SQL database integration and query optimization
- โ CLI application development
- โ Error handling and validation
- โ Memory management and resource cleanup
Perfect for students and developers looking to strengthen their C++ skills!
- ๐ Export reports to CSV/PDF
- ๐ฅ Multi-user support with authentication
- ๐ Recurring expense management
- ๐จ TUI interface using ncurses
- ๐ฑ REST API wrapper
- ๐ Data encryption support
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -m 'Add awesome feature') - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
This project is licensed under the MIT License โ see the LICENSE file for details.
If you find this project helpful, please give it a โญ star on GitHub! It helps increase visibility and lets others discover it.
Have feedback or ideas? Feel free to open an Issue or start a Discussion.
- GitHub: @yashkumar3006
- Questions? Open an issue or discussion in the repository
Made with โค๏ธ by Yash Kumar