🛠️ BoostAPI
Production-ready FastAPI starter toolkit with Redis caching, JWT Auth & CLI scaffolding
✨ Features
| Feature | Details |
|---|---|
| ⚡ Redis Caching | Built-in caching templates for instant responses |
| 🔐 JWT Auth | Secure authentication with refresh tokens built-in |
| 🗃️ Async SQLAlchemy | asyncpg driver, connection pooling, Alembic migrations |
| 🛠️ CLI Scaffolding | boostapi quickstart myapp → full project in seconds |
| 📦 Zero-Config | Works out of the box with sane defaults |
| 🚀 Production-Grade | Loguru logging, CORS, rate limiting, OpenAPI docs |
⚡ 2-Minute Quickstart
Option A: Scaffold a New Project
# Install BoostAPI
pip install boostapi
# Scaffold a complete web application
boostapi quickstart my-app
cd my-app
# Start dependencies (PostgreSQL + Redis)
docker compose up -d
# Run migrations & start server
alembic upgrade head
uvicorn app.main:app --reload
Open http://localhost:8000/docs — your API is live! 🎉
Option B: Embed in Your App
# myapp.py
from boostapi import create_app
app = create_app()
# uvicorn myapp:app --reload
Option C: Custom Settings
from boostapi import create_app
from boostapi.app.core.config import Settings
app = create_app(settings=Settings(
POSTGRES_DB="mydb",
REDIS_URL="redis://myredis:6379",
SECRET_KEY="super-secret-change-me",
))
👨💻 Developer Guide
Once you've scaffolded your project, you can easily extend it to build your application.
1. Adding a Database Model
Models are built using SQLAlchemy 2.0. Define your models in app/db/models.py:
from sqlalchemy import String
from sqlalchemy.orm import Mapped, mapped_column
from boostapi.app.db.database import Base
class Item(Base):
__tablename__ = "items"
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped_column(String(255), nullable=False)
2. Database Migrations (Alembic)
After adding or modifying a model, generate and apply an Alembic migration:
# Generate a new migration script based on models
alembic revision --autogenerate -m "Add items table"
# Apply migrations to the database
alembic upgrade head
3. Creating a New API Route
Add your business logic and routes in app/api/endpoints/:
# app/api/endpoints/items.py
from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select
from boostapi.app.api.deps import get_db
from app.db.models import Item
router = APIRouter()
@router.get("/")
async def get_items(db: AsyncSession = Depends(get_db)):
result = await db.execute(select(Item))
return result.scalars().all()
Then register the router in app/main.py!
4. Protecting Routes (JWT)
To require authentication, inject the get_current_user dependency:
from fastapi import Depends
from boostapi.app.api.deps import get_current_user
from boostapi.app.db.models import User
@router.get("/protected")
async def protected_route(current_user: User = Depends(get_current_user)):
return {"message": f"Hello {current_user.username}!"}
5. Using Redis Caching
Inject the Redis client using get_redis to cache expensive computations or DB queries:
from fastapi import Depends
from redis.asyncio import Redis
from boostapi.app.api.deps import get_redis
@router.get("/stats")
async def get_stats(redis: Redis = Depends(get_redis)):
cached = await redis.get("app_stats")
if cached:
return {"stats": cached, "cached": True}
# Store with TTL (e.g., 60 seconds)
stats = "expensive_computation_result"
await redis.setex("app_stats", 60, stats)
return {"stats": stats, "cached": False}
🔌 API Reference
Authentication
# Login
curl -X POST http://localhost:8000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "secret"}'
# Returns:
# {"access_token": "eyJ...", "token_type": "bearer"}
Health Check
curl http://localhost:8000/api/v1/health/
# {"status": "healthy", "version": "0.1.1", "db": "ok", "redis": "ok"}
🐳 Docker Compose
BoostAPI ships with a production-ready docker-compose.yml:
# Included automatically via `boostapi quickstart`
services:
db: # postgres:16-alpine
redis: # redis:7-alpine
app: # your FastAPI app
⚙️ Configuration
All settings are configurable via environment variables or .env file:
| Variable | Default | Description |
|---|---|---|
POSTGRES_SERVER |
localhost |
PostgreSQL host |
POSTGRES_PORT |
5432 |
PostgreSQL port |
POSTGRES_USER |
postgres |
DB username |
POSTGRES_PASSWORD |
password |
DB password |
POSTGRES_DB |
boostapi |
Database name |
REDIS_URL |
redis://localhost:6379 |
Redis connection URL |
SECRET_KEY |
(change me) | JWT signing key |
ACCESS_TOKEN_EXPIRE_MINUTES |
30 |
Token TTL (minutes) |
🧪 Testing
pip install boostapi[dev]
pytest --cov=boostapi
🚀 Deployment
Render / Fly.io
# Set environment variables in your hosting dashboard
# then:
uvicorn boostapi.app.main:app --host 0.0.0.0 --port $PORT
Docker
docker build -t my-app .
docker compose up
Publish to PyPI
pip install build twine
python -m build
twine upload dist/*
🏗️ Project Structure
my-app/ # generated by `boostapi quickstart`
├── app/
│ ├── main.py # create_app() entry point
│ ├── api/endpoints/ # auth, health, etc.
│ ├── core/ # config, security
│ ├── db/ # models, migrations
│ └── services/ # business logic
├── tests/ # pytest suite (90%+ coverage)
├── docker-compose.yml
├── alembic.ini
└── .env
📄 License
MIT © Dhinakaran
Metadata
Release files for boostapi 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| boostapi-0.1.1.tar.gz | 24.8 kB | Without provenance | Details for boostapi-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| boostapi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for boostapi-0.1.1-py3-none-any.whl |
Total release size: 47.5 kB
Release files / boostapi-0.1.1.tar.gz
| Download URL | boostapi-0.1.1.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfb3f5a9899c338ce62273ffafd2deecced7f930eba2a841b024329d65d4e8ff
|
|
BLAKE2b-256 checksum How to use checksums |
ac904a180ed6983f07feba7549c0cb102ed23bb383c5ba832e04e3aa8bc68d4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / boostapi-0.1.1-py3-none-any.whl
| Download URL | boostapi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
510d821a501bacbd3a43b5895f33f3c76ce7ed828d1b4984b29e4e714c986af9
|
|
BLAKE2b-256 checksum How to use checksums |
dbe76757d2c107f49f8b9631851d8e1110fabc6db53eec0d8e64d72f29bb66b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for boostapi 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.