A Flask-based REST API for a simple banking application.
- Clone the repository
- Ensure you have Python 3.12 or above installed. You can check your Python version with:
python --version
- Create a virtual environment:
python -m venv venv
venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Initialize the database:
flask init-db
- Run the application:
flask run
- Open swagger UI:
http://localhost:5000/apidocs/
Run the test suite using pytest:
python -m pytest -v --disable-warnings
- POST /api/auth/register - Register a new user
- POST /api/auth/login - Login and get JWT token
- POST /api/auth/refresh - Refresh access token using refresh token
- POST /api/auth/logout - Logout and revoke JWT token
- POST /api/auth/verify - Verify if a token is valid and not expired
- POST /api/auth/change-password - Change the user's password
- GET /api/auth/profile - Get the authenticated user's profile
- GET /api/auth/users - Retrieve a list of all users (Admin-only)
- DELETE /api/auth/user/{user_id} - Delete a user by ID (Admin-only)
- GET /api/accounts - List all accounts for the authenticated user
- POST /api/accounts - Create a new account
- GET /api/accounts/{account_id} - Get details of a specific account
- PUT /api/accounts/{account_id} - Update details of a specific account
- DELETE /api/accounts/{account_id} - Delete a specific account
- GET /api/accounts/{account_id}/transactions - Get transactions for a specific account
- GET /api/transactions - Get transaction history for all user accounts
- GET /api/transactions/accounts/{account_id}/transactions - Get transactions for a specific account
- POST /api/transactions/accounts/{account_id}/transactions - Create a transaction for a specific account
- POST /api/transactions/deposit - Deposit funds into an account
- POST /api/transactions/withdraw - Withdraw funds from an account
- POST /api/transactions/transfer - Transfer funds between accounts
- POST /api/transactions/transfer-advanced - Advanced transfer between accounts