LiteBank is a modern, lightweight banking API built with FastAPI and SQLAlchemy β designed to handle user accounts, transactions, and secure financial operations with JWT authentication.
LiteBank is now live and hosted on Render π
π Live API: https://litebank.onrender.com
π©Ί Health Check: https://litebank.onrender.com/healthz
π Interactive Docs: https://litebank.onrender.com/docs
Deployed automatically via GitHub Actions β Render CI/CD pipeline.
- π€ Create and manage user profiles
- π° Deposit and withdraw funds
- π Transfer money between accounts
- π§Ύ View transaction history
- π JWT-based authentication
- π³ Dockerized for easy deployment
| Category | Technology |
|---|---|
| Language | Python 3.11 |
| Framework | FastAPI |
| ORM | SQLAlchemy |
| Auth | FastAPI-JWT-Auth |
| Database | PostgreSQL / SQLite |
| Server | Uvicorn |
| Migrations | Alembic |
| Containerization | Docker |
| Deployment | Render (via GitHub Actions) |
- Clone the repo
git clone https://github.com/inesruizblach/LiteBank.git
cd LiteBank- Set up env
Option A: Create a virtual environment
python3 -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # WindowsOption B: Create a conda environment
conda create -n litebank python=3.11
conda activate litebank- Install dependencies
pip install -r requirements.txt- Run the API locally
uvicorn app.main:app --reload- Visit:
- API Root β http://127.0.0.1:8000
- Interactive Docs β http://127.0.0.1:8000/docs
- List users
GET /users/- Create new users
POST /users/- Login to get JWT token
POST /login- Create and list accounts
POST /accounts/
GET /accounts/- Perform deposits, withdrawals, or transfers:
POST /transactions/
POST /transactions/transfer/
GET /transactions/- List users
curl -X GET "http://127.0.0.1:8000/users/"- Create new users
curl -X POST "http://127.0.0.1:8000/users/" \
-H "Content-Type: application/json" \
-d '{"name":"User1","email":"user1@example.com","password":"password123"}'curl -X POST "http://127.0.0.1:8000/users/" \
-H "Content-Type: application/json" \
-d '{"name":"User2","email":"user2@example.com","password":"password123"}'Expected response:
{"id":1,"name":"User1","email":"user1@example.com"}- Login to get JWT token
curl -X POST "http://127.0.0.1:8000/login" \
-H "Content-Type: application/json" \
-d '{"email":"user1@example.com","password":"password123"}'Response:
{
"access_token": "your_jwt_token",
"token_type": "bearer"
}- Create accounts
curl -X POST "http://127.0.0.1:8000/accounts/" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{"balance":100}'curl -X POST "http://127.0.0.1:8000/accounts/" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{"balance":50}'Expected response:
{"id":1,"user_id":1,"balance":0}- List accounts
curl -X GET "http://127.0.0.1:8000/accounts/" \
-H "Authorization: Bearer your_jwt_token"Expected response (empty if no accounts yet):
[]- Deposit funds
curl -X POST "http://127.0.0.1:8000/transactions/" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{"account_id":1,"type":"deposit","amount":100}'Expected response:
{"id":1,"account_id":1,"type":"deposit","amount":100,"created_at":"2025-10-16T12:00:00"}- Withdraw funds
curl -X POST "http://127.0.0.1:8000/transactions/" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{"account_id":1,"type":"withdraw","amount":50}'- Transfer funds
curl -X POST "http://127.0.0.1:8000/transactions/transfer/" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{"from_account_id":1,"to_account_id":2,"amount":30}'Expected response:
{
"message": "Transferred 50 from account 1 to 2.",
"from_account_balance": 50,
"to_account_balance": 50
}- List transactions
curl -X GET "http://127.0.0.1:8000/transactions/" \
-H "Authorization: Bearer your_jwt_token"- Signup β Create user with /users/.
- Login β Obtain JWT from /auth/login.
- Access Protected Routes β Include header:
Authorization: Bearer <access_token>
LiteBank/
βββ app/
β βββ main.py # FastAPI entrypoint
β βββ models.py # SQLAlchemy models
β βββ schemas.py # Pydantic schemas
β βββ crud.py # Business logic and DB ops
β βββ database.py # Database configuration
β βββ config.py # App/JWT settings
β βββ routers/
β βββ users.py
β βββ accounts.py
β βββ transactions.py
β
βββ alembic/ # Database migrations
β βββ versions/
β
βββ .github/
β βββ workflows/
β βββ deploy.yml # CI/CD pipeline for Render deployment
β
βββ Dockerfile # Docker build configuration
βββ docker-compose.yml # Local dev environment
βββ requirements.txt # Python dependencies
βββ README.md
| Command | Description |
|---|---|
uvicorn app.main:app --reload |
Run API locally |
alembic upgrade head |
Run DB migrations |
pytest |
Run test suite |
docker compose up --build |
Start app with Docker |
LiteBank is automatically deployed to Render using a GitHub Actions workflow (.github/workflows/deploy.yml), which:
- Installs dependencies
- Runs Alembic migrations on the Render PostgreSQL database
- Triggers a new Render deploy
π Production URL: https://litebank.onrender.com
This project is open-source and available under the MIT License.
Developed by InΓ©s Ruiz Blach