Back to Templates
Python FastAPI

FastAPI Starter with SQLAlchemy, pytest, Ruff & Docker

FastAPI with SQLAlchemy, pytest, Docker, and GitHub Actions

terminal
npx setupkaro init my-api --template python-fastapi
Zero installNo telemetryMIT License

What's Included

  • FastAPI + async SQLAlchemy 2.0 + Pydantic v2 (Settings management)
  • pytest + pytest-asyncio + httpx for async integration tests
  • Ruff (lint + format) + MyPy (strict type checking)
  • pre-commit hooks with ruff, mypy, pytest
  • GitHub Actions: lint, typecheck, test (with Postgres/Redis services), build
  • Multi-stage Dockerfile (non-root, python:3.12-slim) + docker-compose.yml (Postgres, Redis)
  • pyproject.toml with pinned dependencies and tool configs
  • Structured logging, lifespan events, health endpoints
  • Generated README with dev/prod commands and API docs links

Generated Folder Structure

app/
api/
core/
models/
schemas/
main.py
tests/
conftest.py
test_health.py
.github/workflows/ci.yml
Dockerfile
docker-compose.yml
pyproject.toml
requirements.txt
ruff.toml
mypy.ini
.pre-commit-config.yaml
README.md

Quick Start Commands

Generate Project

terminal
npx setupkaro init my-api --template python-fastapi

Next Steps

cd my-app
pip install -r requirements.txt
docker compose up -d

Frequently Asked Questions

Why async SQLAlchemy?
FastAPI is async-native. Async SQLAlchemy 2.0 avoids blocking the event loop on DB calls.
Does it include authentication (JWT, OAuth)?
No — the template provides a clean base. Add `fastapi-users` or `authlib` after generation.
What about database migrations?
Alembic is not included by default. Run `pip install alembic && alembic init migrations` after generation.
Can I use this with SQLModel instead?
Yes. SQLModel builds on SQLAlchemy + Pydantic. Replace the models/schemas after generation.

Generate Another Template

React + TypeScript

Vite + React + TS with Tailwind and React Router

terminal
npx setupkaro init my-app --template react-ts

Replace my-app with your project name.

Ready to generate your Python FastAPI project?

One command. Production-ready. Start building in seconds.

terminal
npx setupkaro init my-api --template python-fastapi