Skip to content

LegendarySumit/Syntecxhub_ExpenseTrackerCLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💰 Expense Tracker CLI

Smart Personal Finance Management Right from Your Terminal

Python SQLite Matplotlib License

Track Income • Manage Expenses • Generate Reports • Visualize Analytics

Quick StartFeaturesTech StackUsage


📖 About

Expense Tracker CLI is a lightweight, command-line personal finance management tool that makes tracking your income and expenses effortless. Built with Python and SQLite, it provides a simple yet powerful interface to manage your finances without leaving the terminal.

Whether you're a student managing monthly budgets, a freelancer tracking multiple income streams, or someone who simply wants better control over their spending, Expense Tracker CLI offers all the tools you need in an intuitive, interactive environment.

With features like monthly summaries, category-wise breakdowns, CSV exports, and visual pie charts, you can understand your financial patterns at a glance and make informed decisions about your money.


✨ Features

  • Add Income — Track multiple income sources (Salary, Freelance, Investment, etc.)
  • Add Expenses — Log expenses with categories (Food, Transport, Entertainment, etc.)
  • View Transactions — Browse all transactions with detailed information
  • Monthly Summary — Get total income, expenses, and balance for any month
  • Category-wise Summary — Analyze spending patterns by category
  • Export to CSV — Download transaction data for external analysis
  • Generate Pie Charts — Visualize expense breakdown with beautiful charts
  • SQLite Storage — Persistent data storage with no external dependencies
  • Interactive CLI — User-friendly menu-driven interface
  • Date Flexibility — Default to current date or specify custom dates

🛠️ Tech Stack

Core Technologies

  • Python 3.8+ — Modern, readable, and powerful programming language
  • SQLite3 — Lightweight, serverless database for reliable data persistence
  • Matplotlib — Professional data visualization for charts and graphs
  • CSV — Standard format for data export and analysis

Features Leveraged

  • Python's datetime module for date handling
  • SQL for structured data queries
  • Matplotlib's pie chart capabilities for visual analytics

📁 Project Structure

Syntecxhub_ExpenseTrackerCLI/
├── expense_tracker.py          # Main application file
├── requirements.txt            # Python dependencies
├── README.md                   # Project documentation
├── LICENSE                     # MIT License
├── .gitignore                  # Git ignore rules
├── data/                       # Database storage
│   └── expenses.db            # SQLite database (auto-created)
└── reports/                    # Generated reports
    ├── expenses_*.csv         # Exported transactions
    └── expense_chart_*.png    # Generated pie charts

🚀 Quick Start

Prerequisites

  • Python 3.8 or higher installed on your system
  • Git (for cloning the repository)

Installation

# Clone the repository
git clone https://github.com/LegendarySumit/Syntecxhub_ExpenseTrackerCLI.git
cd Syntecxhub_ExpenseTrackerCLI

# Install dependencies
pip install -r requirements.txt

Running the Application

# On Windows
python expense_tracker.py

# On macOS/Linux
python3 expense_tracker.py

The interactive menu will appear, and you can start managing your finances!


⚙️ Configuration

Database Location

By default, the SQLite database is stored in data/expenses.db. The application automatically creates the necessary directories and tables on first run.

Custom Database Path

You can modify the database location by editing expense_tracker.py:

# Line 244: Modify the db_path parameter
tracker = ExpenseTracker(db_path="your/custom/path/expenses.db")

Environment Requirements

  • No environment variables required
  • No API keys needed
  • Works offline with local SQLite database

📚 Usage

Main Menu

When you run the application, you'll see:

==================================================
💰 EXPENSE TRACKER CLI - Main Menu
==================================================
1. ➕ Add Income
2. ➖ Add Expense
3. 📋 View Transactions
4. 📊 Monthly Summary
5. 🏷️  Category Summary
6. 📁 Export to CSV
7. 📈 Generate Pie Chart
8. ❌ Exit
==================================================

Adding a Transaction

Add Income Example:

Select an option (1-8): 1
Enter date (YYYY-MM-DD) [Today]: 2024-06-15
Enter income category (Salary/Freelance/Investment/Other): Freelance
Enter amount: $1500
Enter description (optional): Web Development Project
✅ Income of $1500.00 added successfully!

Add Expense Example:

Select an option (1-8): 2
Enter date (YYYY-MM-DD) [Today]: 2024-06-15
Enter expense category (Food/Transport/Entertainment/Utilities/Health/Other): Food
Enter amount: $25.50
Enter description (optional): Lunch
✅ Expense of $25.50 added successfully!

Viewing Transactions

Select an option (1-8): 3
View last N transactions (press Enter for all): 10

================================================================================
ID    Date         Type       Category        Amount       Description
================================================================================
1     2024-06-15   💸 expense Food                   $25.50 Lunch
2     2024-06-15   💰 income  Freelance            $1500.00 Web Development Project
================================================================================

Monthly Summary

Select an option (1-8): 4
Enter month (1-12) [Current]: 6
Enter year [Current]: 2024

==================================================
📊 Monthly Summary - June 2024
==================================================
💰 Total Income:          $1500.00
💸 Total Expenses:          $25.50
📈 Balance:              $1474.50
==================================================

Category-wise Summary

Select an option (1-8): 5
Enter month (1-12) [Current]: 6
Enter year [Current]: 2024

==================================================
🏷️  Category Summary - June 2024
==================================================

💰 INCOME:
--------------------------------------------------
  Freelance                    $1500.00

💸 EXPENSE:
--------------------------------------------------
  Food                           $25.50

==================================================

Export to CSV

Select an option (1-8): 6
✅ Exported 15 transactions to reports/expenses_20240615_143022.csv

The CSV file contains all transactions in a format compatible with Excel, Google Sheets, and other spreadsheet applications.

Generate Pie Chart

Select an option (1-8): 7
Enter month (1-12) [Current]: 6
Enter year [Current]: 2024
✅ Pie chart saved to reports/expense_chart_20240615_143022.png

A beautiful pie chart visualizing your expense breakdown is generated and displayed.


🔄 Workflow Example

Here's a typical workflow using the application:

# 1. Start the application
python expense_tracker.py

# 2. Add your monthly income
# Menu option 1

# 3. Add daily expenses throughout the month
# Menu option 2

# 4. Check your progress
# Menu option 3 or 4

# 5. Analyze spending patterns
# Menu option 5

# 6. Export data for records
# Menu option 6

# 7. Visualize your spending
# Menu option 7

📊 Project Statistics

Metric Details
Lines of Code ~390 LOC
Python Version 3.8+
Dependencies 1 (matplotlib)
Database SQLite3 (Built-in)
Memory Footprint ~5MB
Setup Time <2 minutes

🎯 Key Features Explained

Database Architecture

  • SQLite3 for lightweight, file-based persistence
  • Single transactions table storing all records
  • No server required, data stored locally
  • Automatic schema creation on first run

Data Validation

  • Date format validation (YYYY-MM-DD)
  • Amount validation (numeric values)
  • Month range validation (1-12)
  • Graceful error handling for invalid inputs

Report Generation

  • CSV Export — Compatible with all spreadsheet applications
  • Pie Charts — Visual representation of expense categories
  • Monthly Reports — Income vs. Expense summaries
  • Category Reports — Spending breakdown by category

🔮 Future Enhancements

  • Budget setting and alerts
  • Multi-user support with authentication
  • Advanced filtering and search
  • Recurring transactions automation
  • Tax category tagging
  • Financial goals tracking
  • Year-on-year comparisons
  • Web-based dashboard interface
  • Mobile app version
  • Bank statement import

🐛 Troubleshooting

Issue: "ModuleNotFoundError: No module named 'matplotlib'"

Solution:

pip install -r requirements.txt
# or
pip install matplotlib==3.8.2

Issue: "No module named '_tkinter'" (macOS/Linux)

Solution:

# macOS
brew install python-tk@3.9

# Ubuntu/Debian
sudo apt-get install python3-tk

# Fedora
sudo dnf install python3-tkinter

Issue: Database file is locked

Solution: Ensure only one instance of the application is running. Close any other terminals running the app.

Issue: Cannot write to data/ or reports/ directories

Solution: Check folder permissions:

chmod 755 data/
chmod 755 reports/

📝 Sample Data

Want to test the application? Here's sample data you can enter:

Income Entries:
- Date: 2024-06-01, Category: Salary, Amount: $3000
- Date: 2024-06-15, Category: Freelance, Amount: $500

Expense Entries:
- Date: 2024-06-02, Category: Food, Amount: $45
- Date: 2024-06-05, Category: Transport, Amount: $30
- Date: 2024-06-10, Category: Entertainment, Amount: $60
- Date: 2024-06-15, Category: Utilities, Amount: $120
- Date: 2024-06-20, Category: Health, Amount: $50

🔐 Security & Privacy

  • Local Storage — All data stored locally on your machine
  • No Cloud Upload — Your financial data never leaves your computer
  • No Tracking — Application collects no usage analytics
  • Open Source — Full code transparency, audit the code yourself

💡 Best Practices

  1. Regular Backups — Periodically copy your data/expenses.db file
  2. Consistent Categories — Use the same category names for better analysis
  3. Detailed Descriptions — Add descriptions for future reference
  4. Monthly Reviews — Check your monthly summary regularly
  5. Export Archives — Export CSV files monthly for historical records

📄 License

This project is licensed under the MIT License — you are free to use, modify, and distribute this software. See the LICENSE file for details.


👨‍💻 Author

LegendarySumit


🙏 Contributing

Found a bug? Have an idea? Contributions are welcome!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

💰 Smart Finance Management Starts Here

Master your money, one transaction at a time


If you find this project helpful, please star this repository!

Happy Tracking! 🎉

About

Expense Tracker CLI is a lightweight, command-line personal finance management tool that makes tracking your income and expenses effortless.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages