Skip to content

Budget tracker (NYU SP’25 SE) with Flask, MongoDB & Docker; CI/CD via GitHub Actions auto-builds and pushes images to Docker Hub and deploys to DigitalOcean.

License

Notifications You must be signed in to change notification settings

cl3880/budget-tracker

 
 

Repository files navigation

Final Project

App CI/CD Database CI/CD Deploy Status

Student Finance Tracker

Overview

Student Finance Tracker is a containerized web application designed to help students manage and track their personal finances. Users can log their spending across categories (transportation, books, food, etc) in interactive charts that visualize their spending habits over time. The objective of this project is to encourage financial literacy and provide students with a simple tool to budget and analyze their expenses.

Team

System Architecture

The system consists of three main components:

  1. Web Application: Built with Flask, providing user authentication, expense tracking, and data visualization.
  2. MongoDB Database: Stores user accounts, transactions, categories, and budgets.
  3. DockerHub and Docker Compose Setup: Uses Docker Compose to run everything, and DockerHub to store data for the app and database, keeping deployment much faster.

Docker Images

Our containerized applications are available on Docker Hub:

Setup Instructions

Follow these steps to get your development environment up and running:

1. Install Python 3.8 (using pyenv if needed)

2. Setup pipenv with Python 3.8

Ensure that pipenv is using Python 3.8. If it is not, reinitialize it:

pipenv --rm
pipenv --python 3.8
pipenv --py  # This will show a Python 3.8 path

We can verify that it works by running:

pipenv --py # This will show a Python 3.8 path 

3. Navigate to the root project directory

cd path-to-5-final-fizzbuzz

4. Install Dependencies from Pipfile

pipenv install

5. Activate the Pipenv Shell

pipenv shell

6. Run the Project with Docker Compose

docker compose up --build

7. Access the Application

Once the Docker build is complete, open your browser and go to: http://localhost:8000

MongoDB Setup

MongoDB is automatically started by Docker Compose. Database details:

  • Database Name: finance_tracker
  • Collection: users, transactions, categories, budgets
  • Port: 27017

Database Initialization

The database is automatically initialized with default categories when the application starts. The initialization script (database/init_db.py) performs the following tasks:

  • Creates necessary indexes for better query performance
  • Loads default expense/income categories

If you need to manually initialize the database, you can run:

cd database
python init_db.py

Environment Configuration

Create a '.env' file at the project root as these variables are required for the application to connect to MongoDB and manage session security. Example:

MONGO_URI=mongodb://localhost:27017/finance_tracker
FLASK_SECRET_KEY=your_secret_key

Development Workflow

  1. Create a feature branch for your changes
  2. Make your changes and commit them
  3. Create a pull request
  4. Get code review from at least one team member
  5. Merge after approval

Testing

All unit tests must pass before merging any changes:

# Run backend tests.  
cd app
pytest --cov=app tests/ --cov-report=term-missing --cov-fail-under=80

# Run database tests
cd database
pytest --cov=database tests/ --cov-report=term-missing --cov-fail-under=80

About

Budget tracker (NYU SP’25 SE) with Flask, MongoDB & Docker; CI/CD via GitHub Actions auto-builds and pushes images to Docker Hub and deploys to DigitalOcean.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 60.4%
  • HTML 27.2%
  • JavaScript 7.4%
  • CSS 3.0%
  • Shell 1.1%
  • Dockerfile 0.9%