This project uses FastAPI as the web framework, Celery for background tasks, and PostgreSQL as the default database, with Poetry as the dependency manager.
- Python 3.13
- Poetry (with export plugin)
- PostgreSQL (or your preferred DB, configured in
.env)
# Clone the repo and navigate into the project directory
git clone <your-repo-url>
cd fastapi_template
# Install dependencies using Poetry
poetry install
# Activate the virtual environment
poetry shell
# Copy and edit environment variables
cp .env.example .envIn docs you can find debugger config to run and debug the app vscode-example-launch.json rename it and put in .vscode folder, so it looks like this
.vscode/launch.json
Run linters:
make lintAuto-fix formatting:
make lint-fixIncludes black, isort, flake8, and optionally ruff.
To export all current dependencies to requirements.txt:
make export-reqUses:
poetry export -f requirements.txt --with dev --without-hashes -o requirements.txtApply latest migrations:
make migrateCreate new migration:
make migrationRollback last migration:
make migration-downgradeInstall hooks:
pre-commit installThey will run automatically before each commit. You can also run manually:
pre-commit run --all-filesmain: production-ready codedev: ongoing developmentstaging: optional pre-production validation
-
feature/<task_number_or_explanation> -
fix/<bug_name> -
hotfix/<critical_issue> -
Branches are created from
mainif independent, -
or from
dev/stagingif they depend on ongoing work.
- Create
release/v.<number>branches and merge tasks into it.
- Must target appropriate branch (
dev,staging, ormain) - Include a reviewer
- Add a link to task in Jira or similar, or a clear description
- Commits should be modular and descriptive (even small changes deserve commits)