This project is a backend service built with Python using FastAPI for the API layer, SQLAlchemy for ORM, and SQLite for database persistence. It provides users with a personal finance management system where they can manage their accounts, track transactions, set savings goals, and generate financial reports.
- Registration and Login: Users can register and log into the system with unique credentials.
- User Profile: Each user has a personal profile with details like name, email, and password.
- Security: Passwords are securely hashed, and the system issues secure JWT tokens for authentication.
- Add Transactions: Users can add financial transactions including:
- Amount
- Date
- Category (e.g., Food, Rent, Entertainment)
- Description
- View, Update, and Delete Transactions: Users can view all their transactions, update transaction details, or delete transactions as needed.
- Custom Categories: Users can create custom categories to organize their financial transactions.
- View and Manage Categories: Users can view, update, and delete categories for easier financial tracking.
- Set Savings Goals: Users can create savings goals by defining:
- Target amount
- Target date
- Track Progress: The system automatically tracks progress towards these goals based on the user's transactions and savings.
- Monthly and Yearly Reports: The system generates monthly and yearly financial reports to show:
- Income
- Expenses
- Savings
- Visual Representations: Reports include visual representations (such as pie charts and bar graphs) to give users insights into their spending by category.
- Database: All user data, transactions, categories, and savings goals are persisted in a SQLite database using SQLAlchemy ORM to ensure data integrity and security.
- Backend Framework: FastAPI
- ORM: SQLAlchemy
- Database: SQLite
- Authentication: OAuth2 with JWT tokens
- Python Version: 3.10+
-
Clone the repository:
git clone https://github.com/yourusername/finance-management-api.git cd finance-management-api
-
Create a virtual environment and activate it:
python -m venv env source env/bin/activate # On Windows use `env\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Run the application:
fastapi dev main.py
-
Access the FastAPI Swagger documentation at
http://127.0.0.1:8000/docs
. -
Run tests(remember to move to the directory outside perfima, in case you don't just copy paste the following command as is):
cd .. PYTHONPATH=./ pytest perfima/tests/
- POST
/signup
: Register a new user. - POST
/login
: Login a user and get access token.
- POST
/transactions
: Add a new transaction. - GET
/transactions
: Get a list of all transactions. - PUT
/transactions/{id}
: Update a specific transaction. - DELETE
/transactions/{id}
: Delete a specific transaction.
- POST
/categories
: Create a new category. - GET
/categories
: List all categories. - PUT
/categories/{id}
: Update a specific category. - DELETE
/categories/{id}
: Delete a specific category.
- POST
/savings_goal
: Set a new savings goal. - GET
/savings_goal
: Get all savings goals. - PUT
/savings_goal/{id}
: Update a specific savings goal. - DELETE
/savings_goal/{id}
: Delete a specific savings goal.
- GET
/reports/monthly
: Generate a monthly financial report. - GET
/reports/yearly
: Generate a yearly financial report.
- Users: Stores user data such as
username
,email
,hashed_password
, and personal details. - Transactions: Stores transactions with fields like
amount
,date
,category
, anddescription
. - Categories: Stores user-defined categories for transactions.
- Savings Goals: Stores savings goals including
target_amount
andtarget_date
.
- Add user notifications for goal progress.
- Add a front end to make it product ready.
- Use a more robust database set up like supabase or MySQL
- Implement CSV export of transaction history.
- Add filtering and sorting to transaction listings.