๐ฐ Monthly Expenses Tracker (Flask Web App)
A clean, modern web dashboard to track monthly income and expenses โ built with Flask and local JSON storage.
๐ Overview
Monthly Expenses Tracker (Web) is a Flask-based web application that provides a modern admin dashboard for managing monthly budgets. It is a full migration of the original Python CLI tool into a browser-based interface โ no databases or external services required.
This project demonstrates:
- Flask web application structure (Blueprint, app factory pattern)
- Jinja2 templating with a shared base layout
- File-based data persistence (JSON)
- Separation of concerns: routes, data logic, templates, and static assets
โจ Features
- ๐ Live dashboard with stat cards and a spending doughnut chart
- โ Add, edit, and delete expenses via modal forms
- ๐๏ธ Category-based spending breakdown with progress bars
- ๐ฐ Savings rate calculation
- ๐ฅ Export full summary to CSV
- โ๏ธ Settings page to update salary and reset all data
- ๐จ Dark theme UI with no external CSS framework dependencies
๐งฐ Tech Stack Used
- Backend: Python, Flask 3.0+
- Templating: Jinja2
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Charts: Chart.js (CDN)
- Data Storage: JSON (local filesystem)
๐ Getting Started (Local Setup)
๐ ๏ธ Prerequisites
- Python 3.8+ installed
๐ฆ Installation
git clone https://github.com/NHasan143/monthly-expenses-tracker.git
cd monthly-expenses-tracker
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
โถ๏ธ Usage
Run the development server:
python run.py
Then open your browser and go to:
http://localhost:5000
โ ๏ธ If port 5000 is in use change the port in
run.py:app.run(debug=True, port=5001)
๐๏ธ Project Structure
monthly-expenses-tracker/
โโโ run.py # App entry point
โโโ requirements.txt # Python dependencies
โโโ budget_data.json # Local data storage (auto-created)
โโโ app/
โโโ __init__.py # Flask app factory
โโโ routes.py # All URL routes (Blueprint)
โโโ data.py # Data logic: load, save, calculate
โโโ templates/
โ โโโ base.html # Shared layout (sidebar, topbar, flash messages)
โ โโโ dashboard.html # Stat cards, chart, recent expenses
โ โโโ expenses.html # Full expense table with edit/delete
โ โโโ settings.html # Salary update, CSV export, data reset
โโโ static/
โโโ css/
โ โโโ main.css # All styles (variables, layout, components)
โโโ js/
โโโ modals.js # Shared modal open/close logic
โโโ dashboard.js # Chart.js doughnut chart
โโโ expenses.js # Edit modal population
๐พ Data Storage
This project uses a local JSON file (budget_data.json) to store income and expenses.
All financial data is kept on your machine, making the application:
- Easy to reset (delete the JSON file and restart)
- Transparent and portable
- Suitable for fully offline use
๐ Pages
| Route | Page | Description |
|---|---|---|
/ |
Dashboard | Overview with stats, chart, and recent expenses |
/expenses |
Expenses | Full table with add, edit, and delete |
/settings |
Settings | Update salary, export CSV, reset all data |
/export |
โ | Downloads budget_export.csv directly |
๐ฎ Roadmap & Future Enhancements
- [Added] Flask web interface dashboard
- [Added] Spending breakdown by category with chart
- [Added] Edit existing expenses
- [Added] Export summary to CSV
- [Added] Savings rate calculation
- [ ] User authentication (login/logout)
- [ ] Monthly history (track across multiple months)
- [ ] Mobile responsive layout
- [ ] Dark/light theme toggle
๐ค Contributing
Contributions are welcome.
- Fork the repo
- Create a branch:
git checkout -b feature/my-change - Commit changes:
git commit -m "Add my change" - Push:
git push origin feature/my-change - Open a Pull Request
๐ License
Licensed under the MIT License. See LICENSE.
๐ค Author
Naymul Hasan GitHub: https://github.com/NHasan143