// the find
testdrivenio/fastapi-sqlmodel-alembic
Sample FastAPI project that uses async SQLAlchemy, SQLModel, Postgres, Alembic, and Docker.
A minimal starter showing how to wire FastAPI with async SQLAlchemy, SQLModel, Alembic migrations, and Docker Compose. It's a tutorial companion repo for a testdriven.io blog post, not a production template. Good for developers who want a working skeleton before reading the full article.
Async SQLAlchemy setup is done correctly — using `AsyncSession` and `create_async_engine` rather than bolting async onto a sync engine. Alembic is properly configured with `run_migrations_online` using the async engine pattern, which trips people up. Docker Compose wires Postgres and the app together cleanly with a single build step. SQLModel's dual-use models (ORM + Pydantic validation) are demonstrated without overcomplicating the example.
Last touched August 2023 — SQLModel and FastAPI have both moved significantly since then, and this predates FastAPI's `Annotated` dependency injection style and SQLModel 0.0.14+ changes. The project is a single-file app with one model; there is no project structure guidance for anything beyond toy scale. No tests whatsoever, which is ironic given the testdriven.io branding. Three duplicate migration files in versions/ suggest the repo itself was developed sloppily.