- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/magicjohnson/simple_bank.git cd simple_bank -
Ensure directory is shared from the host and is known to Docker.
-
Build and run the application:
docker-compose up --build
-
Access the Django app at
http://localhost:8000.
- Register:
POST /api/register/- Payload:
{ "email": "[email protected]", "password": "yourpassword" } - Response:
201 CREATED - Creates a user and a bank account with a unique 10-digit account number and €10,000 welcome bonus.
- Payload:
- Login:
POST /api/login/- Payload:
{ "email": "[email protected]", "password": "yourpassword" } - Response:
{ "token": "<auth_token>" }
- Payload:
- Get Balance:
GET /api/balance/- Headers:
Authorization: Token <auth_token> - Response:
{ "balance": 10000.00, "account_number": "1234567890"}
- Headers:
- List Transactions:
GET /api/transactions/- Headers:
Authorization: Token <auth_token> - Optional Query Params:
date_from=YYYY-MM-DDTHH:MM:SSZ,date_to=YYYY-MM-DDTHH:MM:SSZ - Response:
{ "transactions": [{ "amount": 10000.00, "type": "credit", "timestamp": "2025-09-30T12:08:00Z" }, ...] }
- Headers:
- Transfer Money:
POST /api/transfer/- Headers:
Authorization: Token <auth_token> - Payload:
{ "receiver_account_number": "1234567890", "amount": "100.00" } - Response:
{ "message": "Transfer successful" } - Transfers the specified amount to the receiver's account, applying a 2.5% fee (minimum €5). Records debit (sender) and credit (receiver) transactions.
- Headers:
-
Build the test environment:
docker-compose build
-
Run tests with verbose output and coverage report:
docker-compose up -d db docker-compose run --rm testThis applies migrations, runs tests with verbose output, and generates a coverage report.