A simple Flask-based personal finance tracking application with a clean UI and SQLite database support.
- Dashboard with income/expense summary
- Add new transactions
- Transaction history report
- System monitoring
- Clean, responsive UI using Bootstrap 5
- System information display (version, IP, hostname, container status)
- Comprehensive logging
- Unit and integration tests
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the application in development mode:
python app.py- Open your browser and navigate to
http://localhost:5001
The application includes both unit and integration tests. To run the tests:
- First, install the package in development mode:
pip install -e .- Then run the tests using pytest:
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=app tests/
# Run specific test file
pytest tests/test_models.py
pytest tests/test_routes.py
# Run tests with detailed output
pytest -v
# Run tests and show print statements
pytest -s-
Unit Tests (
tests/test_models.py):- Transaction model creation
- Income transaction validation
- Expense transaction validation
- Date handling
-
Integration Tests (
tests/test_routes.py):- Dashboard route
- Add transaction form
- Income transaction submission
- Expense transaction submission
- Report generation
- System info display
- Transaction calculations
Tests use a separate SQLite database (test.db) to avoid affecting the production database. The test database is automatically created and destroyed for each test session.
For production deployment, use either Uvicorn or Gunicorn:
uvicorn app:app --host 0.0.0.0 --port 5001 --workers 4gunicorn app:app --bind 0.0.0.0:5001 --workers 4- Dashboard: View summary of your finances and recent transactions
- Add Transaction: Add new income or expenses
- Report: View detailed transaction history
- System Info: Monitor system resources
The application uses SQLite for data storage. The database file (transactions.db) will be automatically created in the application directory when you first run the app.
Application logs are stored in the logs directory:
- Main log file:
logs/fintrack.log - Rotating log files (max 10MB each, 10 backups)
- Includes timestamp, log level, and source location
This is a development version. For production use:
- Change the
SECRET_KEYinapp.py - Use a proper production-grade WSGI server (as shown above)
- Implement proper user authentication
- Use environment variables for sensitive configuration
- Consider using a more robust database like PostgreSQL