SpendSense is a comprehensive personal finance management application that helps you track expenses, manage budgets, set financial goals, and analyze spending patterns with beautiful visualizations.
- Features
- Demo
- Tech Stack
- Installation
- Usage
- Testing
- Project Structure
- API Documentation
- Screenshots
- Configuration
- Contributing
- License
- Add, Edit, Delete Transactions: Easily manage your financial transactions
- Categorization: Organize expenses into 20+ predefined categories
- Date Filtering: View transactions by month and year
- CSV Export: Download your transaction history for external analysis
- Real-time Updates: Instant dashboard updates when transactions change
- Monthly Budgets: Set overall and category-specific budgets
- Budget Tracking: Monitor spending vs. budget in real-time
- Visual Alerts: Get warnings when approaching or exceeding budgets
- Budget Analysis: Comprehensive budget performance metrics
- Multi-period Comparison: Compare budget performance across months
- Goal Setting: Define savings goals with target amounts and deadlines
- Progress Tracking: Visual progress bars and percentage completion
- Goal Icons: Customize goals with emoji icons
- Contribution Management: Add contributions and track goal milestones
- Achievement System: Mark goals as complete when reached
- Spending Breakdown: Pie charts showing category distribution
- Top Categories: Bar charts highlighting biggest spending areas
- Monthly Trends: Line graphs tracking spending over time
- Historical Analysis: 6-month historical spending overview
- Financial Health Meter: Visual gauge of overall financial position
- Modern Design: Clean, intuitive dashboard with card-based layout
- Responsive: Works seamlessly on desktop and mobile devices
- Dark Mode Ready: Professional color scheme with teal accents
- Interactive Charts: Dynamic visualizations using Matplotlib and Canvas
- Tab Navigation: Easy switching between Transactions, Goals, and History
The dashboard provides an at-a-glance view of your financial health:
- Net position indicator
- Average daily spending
- Active savings goals
- Recent transactions
- Category breakdowns
Set and track budgets with visual progress indicators:
- Total budget vs. actual spending
- Category-level budget tracking
- Budget utilization percentage
- Over/under budget alerts
Create and monitor financial goals:
- Multiple concurrent goals
- Progress visualization
- Deadline tracking
- Contribution history
- Python 3.8+: Core programming language
- Flask 2.0+: Web framework
- Flask-RESTX: REST API with Swagger documentation
- Flask-CORS: Cross-origin resource sharing
- Matplotlib: Chart generation
- NumPy: Statistical calculations
- HTML5/CSS3: Modern web standards
- JavaScript (ES6+): Interactive functionality
- Canvas API: Custom chart rendering
- LocalStorage: Client-side goal persistence
- MVC Pattern: Model-View-Controller separation
- RESTful API: Standard HTTP methods
- Component-based: Modular controller design
- Python 3.8 or higher
- pip (Python package manager)
- Virtual environment (recommended)
git clone https://github.com/ropa1295/SpendSense.git
cd SpendSense# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activatepip install flask flask-restx flask-cors matplotlib numpy# Initialize with sample data and start server
python src/main.py
# Or run the Flask app directly
python src/web_app.pyOpen your web browser and navigate to:
http://localhost:5000
- Click the "+ New Expense" button or "Quick Add" in the sidebar
- Fill in the transaction details:
- Amount
- Category (select from dropdown)
- Date
- Description (optional)
- Click "Add Expense" to save
- Navigate to the Transactions tab
- Use the month selector to choose the budget period
- Enter the budget amount
- Select a category (leave empty for total budget)
- Click "Set Budget"
- Switch to the Goals tab
- Click "+ Set New Goal"
- Enter goal details:
- Goal name
- Target amount
- Current amount
- Target date
- Icon
- Click "Create Goal"
- Go to the History tab
- View 6-month trends
- Analyze spending patterns
- Export reports for external analysis
- Click the CSV export button on any transaction view
- Downloaded file includes all transaction details
- Compatible with Excel, Google Sheets, and other tools
SpendSense includes a comprehensive test suite to ensure code quality and reliability.
The test suite includes:
- Unit Tests: Model and controller tests
- Integration Tests: API endpoint tests
- Coverage: 60+ test cases across 5 test files
# Using the test runner script
python run_tests.py
# Or using unittest directly
python -m unittest discover tests# Using the test runner
python run_tests.py --file test_transaction_model.py
# Using unittest
python -m unittest tests.test_transaction_modelpython run_tests.py --verbosepython run_tests.py --quiettests/
βββ __init__.py
βββ test_transaction_model.py # Transaction model tests (11 cases)
βββ test_budget_model.py # Budget model tests (9 cases)
βββ test_spend_controller.py # Spend controller tests (14 cases)
βββ test_sense_controller.py # Sense controller tests (12 cases)
βββ test_api_endpoints.py # API integration tests (20+ cases)
Model Tests (test_transaction_model.py, test_budget_model.py)
- Data model creation and validation
- Property access and immutability
- Edge cases and error handling
- Data serialization (to_dict)
Controller Tests (test_spend_controller.py, test_sense_controller.py)
- CRUD operations (Create, Read, Update, Delete)
- Business logic validation
- Filtering and search functionality
- CSV export functionality
- Budget calculations and analysis
API Tests (test_api_endpoints.py)
- HTTP endpoint testing
- Request/response validation
- Error handling (404, 400, etc.)
- Integration between layers
- CORS and content-type headers
When adding new features, include corresponding tests:
import unittest
from controllers.spend_controller import SpendController
class TestNewFeature(unittest.TestCase):
def setUp(self):
self.controller = SpendController()
def test_new_functionality(self):
result = self.controller.new_method()
self.assertEqual(result, expected_value)Tests can be integrated into CI/CD pipelines:
# Exit with code 0 if tests pass, 1 if they fail
python run_tests.pySpendSense/
β
βββ src/ # Source code
β βββ main.py # Application entry point
β βββ web_app.py # Flask application & routes
β βββ api.py # REST API endpoints
β β
β βββ controllers/ # Business logic
β β βββ __init__.py
β β βββ spend_controller.py # Transaction management
β β βββ sense_controller.py # Budget management
β β
β βββ models/ # Data models
β β βββ __init__.py
β β βββ transaction.py # Transaction model
β β βββ budget_plan.py # Budget model
β β
β βββ views/ # View layer
β β βββ __init__.py
β β βββ transaction_display.py # Transaction UI
β β βββ visual_analytics.py # Chart generation
β β βββ expense_view.py # Legacy wrapper
β β βββ chart_view.py # Legacy wrapper
β β
β βββ utils/ # Utility functions
β βββ __init__.py
β βββ csv_handler.py # CSV export
β βββ data_validator.py # Input validation
β
βββ tests/ # Test suite
β βββ __init__.py
β βββ test_transaction_model.py # Transaction model tests
β βββ test_budget_model.py # Budget model tests
β βββ test_spend_controller.py # Spend controller tests
β βββ test_sense_controller.py # Sense controller tests
β βββ test_api_endpoints.py # API integration tests
β
βββ templates/ # HTML templates
β βββ index.html # Main dashboard
β
βββ static/ # Static assets
β βββ css/
β β βββ style.css # Application styles
β βββ js/
β βββ app.js # Frontend JavaScript
β
βββ run_tests.py # Test runner script
βββ README.md # This file
βββ WEB_APP.md # Web application architecture documentation
βββ QUICKSTART.md # Quick start guide
βββ requirements.txt # Python dependencies
βββ LICENSE # MIT License
βββ .gitignore # Git ignore file
SpendSense provides a comprehensive REST API with interactive Swagger documentation.
http://localhost:5000/api
Access Swagger UI at:
http://localhost:5000/api/docs/
GET /api/expenses # List all transactions
POST /api/expenses # Create new transaction
GET /api/expenses/{id} # Get transaction details
PUT /api/expenses/{id} # Update transaction
DELETE /api/expenses/{id} # Delete transaction
GET /api/expenses/export/csv # Export to CSV
GET /api/budgets # List all budgets
POST /api/budgets # Create/update budget
GET /api/budgets/analysis/{month} # Get budget analysis
DELETE /api/budgets/{id} # Delete budget
GET /api/stats # Get spending statistics
GET /api/chart/category # Category pie chart
GET /api/chart/budget/{month} # Budget comparison chart
GET /api/chart/monthly-trend # Monthly trend chart
GET /api/health # Service health status
Create a Transaction:
curl -X POST http://localhost:5000/api/expenses \
-H "Content-Type: application/json" \
-d '{
"amount": 45.99,
"category": "Groceries",
"date": "2025-10-24",
"description": "Weekly grocery shopping"
}'Get Budget Analysis:
curl http://localhost:5000/api/budgets/analysis/2025-10Main dashboard with financial health meter, spending habits, and recent transactions.
Visual budget tracking with progress bars and category breakdowns.
Interactive goal cards showing progress and achievement status.
6-month trend charts with spending patterns and top categories.
Default port is 5000. To change:
# In src/web_app.py or src/main.py
app.run(debug=True, host='0.0.0.0', port=YOUR_PORT)The application initializes with sample data for demonstration. To disable:
# In src/main.py, comment out:
# initialize_sample_data()For production deployment, disable debug mode:
app.run(debug=False, host='0.0.0.0', port=5000)Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/AmazingFeature
- Commit your changes
git commit -m 'Add some AmazingFeature' - Push to the branch
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow PEP 8 style guide for Python code
- Write descriptive commit messages
- Add comments for complex logic
- Test thoroughly before submitting
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Flask: Micro web framework
- Matplotlib: Visualization library
- Font Awesome: Icons (if used)
- Community: Open source contributors
Project Maintainer: ropa1295
Repository: https://github.com/ropa1295/SpendSense
Issues: https://github.com/ropa1295/SpendSense/issues
- Multi-currency support
- Recurring transaction templates
- Advanced reporting and analytics
- Mobile app (React Native)
- Bank account integration
- AI-powered spending insights
- Collaborative budgets (family sharing)
- Investment tracking
- Bill reminders and notifications
- Data backup and sync
- Consistent Categorization: Use the same categories for similar expenses
- Regular Updates: Record transactions daily for accurate tracking
- Set Realistic Budgets: Start conservative and adjust based on actual spending
- Use Goals: Break large savings targets into smaller, achievable goals
- Review Monthly: Check your History tab at month-end to identify trends
- Export Data: Regularly backup your data using CSV export
Issue: Port 5000 already in use
# Solution: Use a different port
python src/web_app.py --port 5001Issue: Module not found errors
# Solution: Install missing dependencies
pip install flask flask-restx flask-cors matplotlib numpyIssue: Charts not displaying
# Solution: Ensure matplotlib backend is set correctly
# In web_app.py, verify:
import matplotlib
matplotlib.use('Agg')- WEB_APP.md: Detailed web application architecture and implementation guide
- QUICKSTART.md: 5-minute quick start guide
- Flask Documentation
- Flask-RESTX Documentation
- Matplotlib Documentation
- Personal Finance Best Practices
Made with β€οΈ by the SpendSense Team
β Star us on GitHub if you find this helpful!