Cookiecutter template to build and deploy fastapi backends..batteries included
Project description
:cookie: cookiecutter-fastapi-backend
Cookiecutter template to build and deploy fastapi backends to your favorite PaaS..batteries included.
Supported PaaS's:
- Render
- DigitalOcean
- Platform.sh (Coming soon)
- Fly.io (Coming soon)
Quickstart
Install the latest Cookiecutter if you haven't installed it yet:
# pipx is strongly recommended.
$ pipx install cookiecutter
# If pipx is not an option,
# you can install cookiecutter in your Python user directory.
$ python -m pip install --user cookiecutter
Generate project from GitHub template:
$ pipx run cookiecutter gh:nickatnight/cookiecutter-fastapi-backend
Or from Python code:
from cookiecutter.main import cookiecutter
cookiecutter("gh:nickatnight/cookiecutter-fastapi-backend")
Features
- :whale: Docker & Docker Compose integration and optimization for local development. Fast bundles using build stages and uv
- :computer: Production ready Python web server using FastAPI
- :pencil2: SQLModel Library for interacting with SQL databases from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust
- :light_rail: Alembic Lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python
- :floppy_disk: postgresql Powerful open source object-relational database
- :convenience_store: Redis In-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker
- :gear: Common Base models and repository classes for common CRUD operations and database schemas.
- :seedling: Celery Asynchronous task or job queue
- :inbox_tray: Continuous Integration/Deployment Modular GitHub Actions to lint, test, and deploy to your favorite platform-as-a-service. Automatically includes Codecov reporting.
- :leftwards_arrow_with_hook: pre-commit Git hooks to maintain code quality using modern tooling (ruff, black, isort)
- :rocket: Sentry Application monitoring and error tracking. You can sign up for free at sentry.io
Input Variables
The generator (cookiecutter) will ask you for some data, you might want to have at hand before generating the project.
The input variables, with their default values (some auto generated) are:
project_name: The name of the projectauthor_email: The authors email...for maintainer info inpyproject.tomlpy_version: The version of Python to install. Options are3.9,3.10, and3.11db_container_name: The name of the database container. Defaultdbbackend_container_name: The name of the backend container. Defaultbackenduse_celery: Whether to use Celery and Redis for asynchronous tasks. Defaultnoperiodic_tasks: Whether to use Celery Beat for periodic tasks. Defaultnouse_sentry: Whether to use Sentry for application monitoring and error tracking. Defaultnogithub_username: The username of the GitHub user. Used for badge display in generated projectREADME.mddeployments: Deploy to your favorite platform, Render.com, DigitalOcean, (and more to come). Defaultnone
Documentation
See full documentation here.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters