A starting point for your FastAPI application.
- UV for dependency management. Simply run
uv sync
to set up your env, read more about UV at https://docs.astral.sh/uv/- Run
uv sync --group=telemetry
if you want to install OpenTelemetry instruments as well
- Run
- Docker compose for local development and testing
- SQLAlchemy for ORM (uses async engine) and Alembic for database migrations
- Simple authentication for the documentation page (to showcase how auth can be handled in a FastAPI app)
- CRUD operations generic class with pagination
- Async testing suite with Pytest
- ClickStack integration for logs and metrics
Just click on that green Use this template
button to start coding. There is a dummy app
that is already implemented for you so that you can quickly learn how to use the CRUD factory.
Make sure to mark the app/
folder as source in your IDE otherwise you'll get import errors.
And since all your code (except tests) lives inside app/
folder, you should import modules like this:
from core.config import settings
and NOT like this:
# this will throw an error!
from app.core.config import settings
Adapt the database connection string and run tests with:
ENVIRONMENT=test pytest
Use docker-compose to run your app:
docker compose up -d
If you run the code without any changes, you'll find the
documentation page here. The default username is docs_user
and the password is simple_password
.
After you add new dependencies, run the following command to also automatically add OpenTelemetry instruments for those new dependencies:
uv add --group telemetry $(opentelemetry-bootstrap -a requirements)
This template uses ClickStack.