Skip to content

suyXcode/Finance_Tracker

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° Personal Finance Tracker

A production-ready full-stack Django 4.x web application for tracking income, expenses, budgets, and financial analytics.


✨ Features

Module Capabilities
Auth Register Β· Login Β· Logout Β· Password change
Transactions Add Β· Edit Β· Delete Β· Filter by type/category/date/search Β· Pagination
Categories 15 predefined global categories + unlimited custom categories
Budgets Monthly budgets per category Β· Progress bars Β· 80%/100% email alerts
Analytics Google Charts: Pie (category spend) Β· Line (monthly trend) Β· Bar (weekly spend)
Exports CSV (all transactions) Β· PDF (monthly report via ReportLab)
Dashboard Income Β· Expense Β· Net balance Β· Budget progress Β· Recent transactions

πŸ“Έ Screenshots

Dashboard

Dashboard

Login Page

Login

Add value

Reports


πŸ›  Tech Stack

  • Backend: Django 4.2, Python 3.11+
  • Database: SQLite3
  • Frontend: Bootstrap 5.3, Vanilla JS (ES6+)
  • Charts: Google Charts API
  • Email: Django SMTP (console backend for dev)
  • PDF: ReportLab 4.x
  • CSV: Python csv module

πŸš€ Quick Start

1. Install dependencies

pip install -r requirements.txt

2. Configure environment

cp .env.example .env
# Open .env and set:
#   SECRET_KEY=<generate with: python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())">
#   EMAIL_HOST_USER / EMAIL_HOST_PASSWORD  (or leave console backend for dev)

3. Run migrations

python manage.py migrate

This applies two migrations:

  • 0001_initial β€” creates all tables with indexes & constraints
  • 0002_seed_predefined_categories β€” inserts 15 global categories

4. (Optional) Load demo data

python manage.py seed_demo
# Creates user: demo / Demo@1234
# Populates 3 months of sample transactions and budgets

5. Create your own superuser

python manage.py createsuperuser

6. Start the server

python manage.py runserver

Visit: http://127.0.0.1:8000


πŸ—‚ Project Structure

finance_tracker/
β”œβ”€β”€ manage.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example
β”‚
β”œβ”€β”€ finance_tracker/          ← Django project package
β”‚   β”œβ”€β”€ settings.py           ← All configuration (uses python-decouple)
β”‚   β”œβ”€β”€ urls.py               ← Root URL router
β”‚   β”œβ”€β”€ wsgi.py / asgi.py
β”‚
β”œβ”€β”€ tracker/                  ← Main Django app
β”‚   β”œβ”€β”€ models.py             ← Category, Transaction, Budget
β”‚   β”œβ”€β”€ forms.py              ← All ModelForms + filter form
β”‚   β”œβ”€β”€ services.py           ← Business logic (summaries, chart data)
β”‚   β”œβ”€β”€ signals.py            ← post_save β†’ budget alert emails
β”‚   β”œβ”€β”€ admin.py              ← Rich admin interface
β”‚   β”œβ”€β”€ apps.py               ← AppConfig (registers signals)
β”‚   β”œβ”€β”€ templatetags/
β”‚   β”‚   └── finance_tags.py   ← currency, percentage, income_color filters
β”‚   β”œβ”€β”€ migrations/
β”‚   β”‚   β”œβ”€β”€ 0001_initial.py
β”‚   β”‚   └── 0002_seed_predefined_categories.py
β”‚   β”œβ”€β”€ views/
β”‚   β”‚   β”œβ”€β”€ auth_views.py
β”‚   β”‚   β”œβ”€β”€ dashboard_views.py
β”‚   β”‚   β”œβ”€β”€ transaction_views.py
β”‚   β”‚   β”œβ”€β”€ category_views.py
β”‚   β”‚   β”œβ”€β”€ budget_views.py
β”‚   β”‚   β”œβ”€β”€ chart_views.py     ← JSON endpoints for Google Charts
β”‚   β”‚   β”œβ”€β”€ analytics_views.py
β”‚   β”‚   └── export_views.py    ← CSV + PDF
β”‚   β”œβ”€β”€ urls/
β”‚   β”‚   β”œβ”€β”€ auth_urls.py       ← /auth/…
β”‚   β”‚   └── app_urls.py        ← /dashboard/, /transactions/, /api/…
β”‚   └── management/commands/
β”‚       └── seed_demo.py
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ base.html              ← Master layout (sidebar + topbar)
β”‚   β”œβ”€β”€ registration/          ← login, register, password_change
β”‚   └── email/                 ← budget_warning.html, budget_critical.html
β”‚
β”œβ”€β”€ tracker/templates/tracker/
β”‚   β”œβ”€β”€ dashboard.html
β”‚   β”œβ”€β”€ analytics.html         ← Google Charts page
β”‚   β”œβ”€β”€ transactions/          ← list, form, confirm_delete
β”‚   β”œβ”€β”€ categories/            ← list, form, confirm_delete
β”‚   └── budgets/               ← list, form, confirm_delete
β”‚
└── static/
    β”œβ”€β”€ css/main.css           ← Custom styles on Bootstrap 5
    └── js/main.js             ← Sidebar, animations, UX helpers

πŸ”— URL Map

URL View Description
/ Redirect β†’ /dashboard/
/auth/register/ RegisterView Create account
/auth/login/ CustomLoginView Sign in
/auth/logout/ CustomLogoutView Sign out
/dashboard/ DashboardView Main overview
/analytics/ AnalyticsView Google Charts page
/transactions/ TransactionListView Filtered paginated list
/transactions/add/ TransactionCreateView Add transaction
/transactions/<pk>/edit/ TransactionUpdateView Edit transaction
/transactions/<pk>/delete/ TransactionDeleteView Delete transaction
/categories/ CategoryListView List all categories
/budgets/ BudgetListView Current month budgets
/export/csv/ ExportCSVView Download all transactions
/export/pdf/ ExportPDFView Download monthly PDF report
/api/charts/category-spending/ CategorySpendingAPIView JSON for pie chart
/api/charts/monthly-trend/ MonthlyTrendAPIView JSON for line chart
/api/charts/weekly-spending/ WeeklySpendingAPIView JSON for bar chart
/admin/ Django Admin Admin panel

βš™οΈ Email Configuration

Development (default β€” prints to console):

EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend

Production (Gmail example):

EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password   # Use Gmail App Password, not main password
DEFAULT_FROM_EMAIL=Finance Tracker <your-email@gmail.com>

Budget alert emails fire automatically via Django signals when:

  • A transaction pushes category spending to β‰₯ 80% of the budget β†’ warning email
  • A transaction pushes category spending to β‰₯ 100% of the budget β†’ critical email

Each alert is sent once per budget period (tracked via warning_sent/critical_sent flags).


πŸ“Š Chart API Reference

All endpoints require login (@login_required).

GET /api/charts/category-spending/?month=M&year=Y

{
  "data": [["Category", "Amount"], ["Food & Dining", 4200.0], ["Transport", 1500.0]],
  "status": "ok"
}

GET /api/charts/monthly-trend/?months=6

{
  "labels": ["Nov 24", "Dec 24", "Jan 25"],
  "income":  [65000.0, 70000.0, 68000.0],
  "expense": [28000.0, 35000.0, 29000.0],
  "status": "ok"
}

GET /api/charts/weekly-spending/?weeks=8

{
  "data": [["Week Starting", "Expenses"], ["Apr 01", 3200.0], ["Apr 08", 4100.0]],
  "status": "ok"
}

πŸ§ͺ Testing Checklist

After python manage.py runserver:

  • Register a new account β†’ redirected to dashboard
  • Login / Logout works
  • Add income transaction β†’ balance increases
  • Add expense transaction β†’ balance decreases
  • Filter transactions by type, category, date range, search
  • Create a budget β†’ progress bar appears on dashboard
  • Add expense that crosses 80% β†’ warning email in console
  • Add expense that crosses 100% β†’ critical email in console
  • Analytics page loads all 3 Google Charts
  • Change month selector on analytics β†’ pie chart refreshes
  • Download CSV β†’ file opens in spreadsheet app
  • Download PDF β†’ clean formatted report with tables
  • Admin panel at /admin/ β€” verify all models visible
  • Mobile layout β€” sidebar collapses, hamburger appears
  • python manage.py seed_demo β†’ demo/Demo@1234 works

πŸ”’ Security Notes

  • All views behind LoginRequiredMixin or @login_required
  • CSRF protection on all POST forms ({% csrf_token %})
  • Users can only access their own data (queryset filtered by user=request.user)
  • PermissionDenied raised if user tries to edit/delete another user's data
  • Predefined categories are read-only (protected in view layer)
  • Passwords hashed with Django's default PBKDF2+SHA256

πŸ“„ License

MIT β€” free to use, modify, and distribute.


🀝 Collaborative Project

This project was developed as a collaborative effort by multiple contributors. Each team member contributed to different aspects of the application, including backend development, frontend development, database design, testing, deployment, and documentation.

πŸ‘‘ Maintained by

Project Owner: Mr. Jitendra Kumar Barik (https://github.com/py-007)

  • Feature-based development
  • Git branches for each contributor
  • Pull Requests for code review
  • GitHub Issues for task tracking
  • Collaborative testing before merging

🀝 Contributors

Suyash Singh (https://github.com/suyXcode)

  • Designed responsive UI
  • Implemented dashboard
  • Testing
  • Deployment

About

πŸ’° Personal Finance Tracker A production-ready full-stack Django 4.x web application for tracking income, expenses, budgets, and financial analytics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Python 58.0%
  • HTML 32.4%
  • CSS 7.5%
  • JavaScript 2.0%
  • Shell 0.1%