This is the CookieCutter template for FastAPI ASGI application.
- Python 3.12 & Poetry
- FastAPI
- Database and ORM:
- PostgreSQL, SQLAlchemy, Alembic
- OR MongoDB & Beanie
- Formatting and linting: Ruff, pre-commit
- Deployment: Docker, Docker Compose, GitHub Actions
- Install Cookiecutter
- Run Cookiecutter on this repo:
pipx run cookiecutter gh:one-zero-eight/fastapi-template
- Go to generated project and install dependencies with Poetry
poetry install
- Run Ruff formatting and linting:
poetry run ruff format poetry run ruff check --fix
- Generate
settings.schema.yaml
:poetry run python scripts/generate_settings_schema.py
- Run
poetry update
to update all dependencies (it may update nothing, so double-check) - Run
poetry show --outdated --all
to check for outdated dependencies - Run
poetry add <package>@latest [--group <group>]
to add a new dependency if needed - Also, copy
mongo
andsql
dependency groups from pyproject.toml to pyproject.toml.jinja
- Run
poetry run pre-commit autoupdate
Also, Dependabot will help you to keep your dependencies up-to-date, see dependabot.yml.