You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A production-ready digital banking REST API built with FastAPI, featuring multi-currency wallets, balance management, and financial operations with a clean modular architecture.
Features
Authentication — JWT-based auth with asymmetric RSA keys (RS256), access/refresh token rotation, and token revocation
User Management — registration, profile updates, account closure, and role-based access (User / Admin)
Wallets — create debit and credit wallets secured by PIN, block/unblock, soft close
Multi-currency Balances — regular and foreign balance accounts per wallet, freeze/unfreeze support
Financial Operations — deposit, withdrawal, and inter-wallet transfer with fee calculation
Transaction History — full audit trail with status tracking (pending / success / failed) and type classification
Admin Panel — dedicated admin endpoints for user, wallet, balance, and transaction management
# Start the app + database
docker compose up -d
# Start the app + database + pgadmin
docker compose --profile pgadmin up -d
# Apply migrations (first time or after schema changes)
docker compose --profile migrations up
API Overview
All endpoints are versioned under /api/v1.
Auth — /api/v1/auth
Method
Endpoint
Description
POST
/login
Authenticate and receive tokens
POST
/logout
Revoke current session
POST
/refresh
Rotate access/refresh tokens
Users — /api/v1/users
Method
Endpoint
Description
POST
/
Register a new user
PATCH
/me
Update own profile
DELETE
/me
Close own account
Admin: Users — /api/v1/admin/users
Method
Endpoint
Description
POST
/
Create admin account
GET
/{user_id}
Get user by ID
GET
/
List all users
DELETE
/{user_id}
Delete user
PATCH
/block/{user_id}
Block user
PATCH
/unblock/{user_id}
Unblock user
Wallets — /api/v1/wallets
Method
Endpoint
Description
POST
/credit
Open a credit wallet
POST
/debit
Open a debit wallet
PATCH
/
Update wallet settings
DELETE
/me
Close own wallet (requires PIN)
Admin: Wallets — /api/v1/admin/wallets
Method
Endpoint
Description
DELETE
/{wallet_id}
Force-delete wallet
PATCH
/block/{wallet_id}
Block wallet
PATCH
/unblock/{wallet_id}
Unblock wallet
Balances — /api/v1/balances
Method
Endpoint
Description
POST
/regular
Create a regular balance
POST
/foreign
Create a foreign currency balance
DELETE
/
Close balance (requires wallet PIN)
Admin: Balances — /api/v1/admin/balances
Method
Endpoint
Description
PATCH
/freeze/{balance_id}
Freeze balance
PATCH
/unfreeze/{balance_id}
Unfreeze balance
DELETE
/{balance_id}
Delete balance
Operations — /api/v1/operations
Method
Endpoint
Description
POST
/deposit
Deposit funds into a balance
POST
/withdraw
Withdraw funds from a balance
POST
/transfer
Transfer between wallets
Admin: Transactions — /api/v1/admin/transactions
Method
Endpoint
Description
GET
/
List all transactions (paginated)
GET
/{transaction_id}
Get transaction by ID
Interactive docs available at http://localhost:{SERVER_PORT}/docs.
Development
Install dependencies locally
pip install -r requirements.txt
Run locally (without Docker)
python -m app.main --uvicorn
# or
python -m app.main --gunicorn
Linting & type checking
ruff check .
ruff format .
pyright
Pre-commit hooks
pre-commit install
pre-commit run --all-files
Tests are organized into tests/unit/, tests/integration/, and tests/e2e/.
User can have multiple wallets of different types.
Wallet holds multiple currency balances and is protected by a hashed PIN.
Balance tracks an amount in a specific currency and can be frozen by an admin.
Transaction records every financial movement with full metadata (fee, rate, timestamps, status).
About
Production-ready digital banking REST API built with FastAPI. Features: JWT auth with RSA keys, multi-currency wallets, balance management, financial operations, admin panel, and async PostgreSQL. Deployable with Docker