A Flask application that helps users manage their personal finances with Auth0 authentication.
- Quick Start
- Features
- Architecture
- Installation & Setup
- Running the Application
- Environment Setup
- Troubleshooting
- Developer Documentation
- Contributor Guidance
- License
# Clone and setup
git clone https://github.com/NicoleDev021/MLHDataHackfest25.git
cd MLHDataHackfest25/personal_finance_coach
# Create virtual environment and install dependencies
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Create .env file with your Auth0 credentials (see Environment Setup below)
# Start the application
python run.py# After opening in Codespaces
cd personal_finance_coach
pip install -r requirements.txt
# Create .env file with Auth0 credentials
python run.pyVisit http://localhost:5000 (local) or use the forwarded port URL (Codespaces).
- π Secure Authentication: Auth0 integration for user management
- π¨ Modern UI: Bootstrap 5.3.0 responsive design
- π‘οΈ Security: CSRF protection, secure sessions, and input validation
- π± Responsive: Works on desktop, tablet, and mobile devices
- π Code Quality: Comprehensive linting and formatting tools
- π Cloud Ready: Optimized for GitHub Codespaces deployment
- Backend: Flask 3.1.1 with modular blueprint architecture
- Authentication: Auth0 OAuth2 integration with Authlib
- Frontend: Jinja2 templates with Bootstrap CSS framework
- Validation: Marshmallow for input validation and serialization
- Session Management: Flask-Session with secure cookie configuration
-
Create an Auth0 account at auth0.com
-
Create a new Application:
- Go to Applications > Applications
- Click "Create Application"
- Name it "Personal Finance Coach"
- Choose "Regular Web Application"
-
Configure Application URLs:
Allowed Callback URLs: http://localhost:5000/callback https://${CODESPACE_NAME}-5000.app.github.dev/callback Allowed Logout URLs: http://localhost:5000 https://${CODESPACE_NAME}-5000.app.github.dev Allowed Web Origins: http://localhost:5000 https://${CODESPACE_NAME}-5000.app.github.dev
Create a .env file in the project root with the following variables:
# Auth0 Configuration
AUTH0_CLIENT_ID='your-client-id'
AUTH0_CLIENT_SECRET='your-client-secret'
AUTH0_DOMAIN='your-domain.us.auth0.com'
APP_SECRET_KEY='your-secret-key'
# GitHub Codespace Configuration```
CODESPACE_NAME='your-codespace-name' # Optional: Only needed for Codespace developmentReplace the placeholder values:
AUTH0_CLIENT_ID: Found in Auth0 Application SettingsAUTH0_CLIENT_SECRET: Found in Auth0 Application SettingsAUTH0_DOMAIN: Your Auth0 domain (e.g.,dev-xxx.us.auth0.com)APP_SECRET_KEY: Generate withpython -c 'import secrets; print(secrets.token_hex())'CODESPACE_NAME: Your GitHub Codespace name (only if using Codespaces)
- Python 3.8 or higher
- Git
-
Clone the repository:
git clone https://github.com/NicoleDev021/MLHDataHackfest25.git cd MLHDataHackfest25/personal_finance_coach -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.envfile in thepersonal_finance_coach/directory - Add the Auth0 configuration variables as shown above
- Create a
-
Activate your virtual environment:
source venv/bin/activate # On Windows: venv\Scripts\activate
-
Start the application:
python run.py
-
Access the application:
- Open your browser and go to
http://localhost:5000 - The application will run in debug mode for development
- Open your browser and go to
-
Open the repository in Codespaces:
- Click the green "Code" button on GitHub
- Select "Codespaces" tab
- Click "Create codespace on main"
-
Install dependencies:
cd personal_finance_coach pip install -r requirements.txt -
Set up environment variables:
- Create a
.envfile with your Auth0 credentials - The
CODESPACE_NAMEenvironment variable is automatically set
- Create a
-
Start the application:
python run.py
-
Access the application:
- Codespaces will automatically forward port 5000
- Click on the "Ports" tab in the terminal panel
- Click the globe icon next to port 5000 or visit
https://${CODESPACE_NAME}-5000.app.github.dev
The application supports different environments:
- Development (default): Debug mode enabled, detailed error messages
- Production: Optimized for deployment, debug mode disabled
- Testing: Configuration for running tests
Set the environment using:
export FLASK_ENV=development # or production, testing
export FLASK_DEBUG=true # Enable debug mode1. Port 5000 already in use:
# Kill process using port 5000
sudo lsof -ti:5000 | xargs kill -9
# Or use a different port
python run.py --port 50012. Auth0 authentication errors:
- Verify your
.envfile has correct Auth0 credentials - Check that your Auth0 application URLs match your environment
- For Codespaces, ensure the callback URL includes your codespace name
3. Module not found errors:
- Ensure your virtual environment is activated
- Reinstall dependencies:
pip install -r requirements.txt
4. Permission denied in Codespaces:
- Codespaces may require you to run:
chmod +x run.py
5. Template syntax errors:
- If you see Jinja2
TemplateSyntaxError, check for unclosed block tags - Ensure all
{% block %}tags have matching{% endblock %}tags - Verify template files don't have hidden characters or encoding issues
- Common fix: Recreate templates with clean syntax if issues persist
Code formatting and linting:
# Format code with Black
black .
# Check code style with Flake8
flake8 .
# Run Pylint for code analysis
pylint app/
# Sort imports with isort
isort .Running all linting tools:
./lint.sh # Runs all linting tools at onceThe codebase maintains PERFECT quality standards with comprehensive linting and security checks:
- Code Quality Score: π 10.00/10 (Pylint) - PERFECT SCORE MAINTAINED!
- Security: β No vulnerabilities found in application code (Bandit: 0 issues in 631 lines)
- Code Formatting: β 100% compliant with Black formatter (7 files unchanged)
- Style Guide: β 100% PEP8 compliant (Flake8: 0 violations)
- Dependency Security: β No known vulnerabilities in 173 dependencies (Safety scan)
- Template Security: β XSS protection verified - no unsafe variables or dangerous JavaScript
- Lines of Code: 851 total lines analyzed across 7 Python files and 7 HTML templates
Quality Assurance Tools:
- Black: Automatic code formatting
- Flake8: Style guide enforcement (PEP8)
- Pylint: Static code analysis and quality metrics (configured via
.pylintrc) - Bandit: Security vulnerability scanning
- Safety: Dependency vulnerability checking
All quality checks are automated and enforced before code commits. The project includes a comprehensive .pylintrc configuration file that enables the perfect 10.00/10 score while maintaining strict quality standards.
If you're new to the project or web development, check out these comprehensive guides:
- Junior Developer Guide - Perfect starting point for interns and junior developers
- Development workflow and debugging tips
- How to navigate the codebase effectively
- Step-by-step feature development examples
- Common issues and solutions
-
Architecture Documentation - Complete system design overview
- Application structure and component relationships
- Authentication flow diagrams
- Configuration system explanation
- Security features and implementation
-
Data Flow Documentation - Understanding how data moves through the system
- Complete authentication data flow
- Session management lifecycle
- Error handling workflows
- Template data binding
These documents help you understand how everything connects together and provide practical guidance for adding new features or debugging issues.
If you contribute to this repository, please make sure to review and follow the community standards and reference the following files:
-
CODE_OF_CONDUCT.md: Outlines the standards for behavior and participation in this community.
Please read and follow the Code of Conduct to help maintain a welcoming environment for all contributors. -
CONTRIBUTING.md: Provides detailed guidelines on how to contribute to this project, including how to submit issues and pull requests, coding standards, and commit message conventions.
Please review these instructions before contributing to ensure your submissions align with the project's workflow and expectations. -
SECURITY.md: Contains the process for reporting security vulnerabilities or concerns.
If you discover a security issue, please follow the instructions in this file to report it responsibly.
We appreciate your attention to these documents to help keep the project collaborative, secure, and compliant.
Source code in this repository is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later).
Documentation (including the README, all files in the docs/ directory, and all files in the .github directory) is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
For code files, you may see the following SPDX identifier at the top:
SPDX-License-Identifier: GPL-3.0-or-later
For documentation files, you may see:
SPDX-License-Identifier: CC-BY-4.0
If you contribute, you agree that your contributions will be licensed under these terms.