/fastapi-boilerplate

Custom FastAPI boilerplate with Piccolo ORM, JWT auth, config file and Hashicorp Vault support

Primary LanguagePythonMIT LicenseMIT

CodeFactor Quality Gate Status CI codecov

FastAPI boilerplate

Version: 1.1.2

Work in progress, please read issues

Full documentation is available on Github pages

Another FastAPI Boilerplate with:

  • FastAPI as a base ASGI app
  • Piccolo ORM for a database operations
  • Piccolo Admin GUI for a convenient database management
  • Hashicorp Vault integration for DB credentials (with auto-rotating), JWT secrets and other
  • Custom Accounting CRUD application for managing
    • Users
    • Roles
    • Groups
    • Permissions
    • Security policies
  • JWT autehntication
  • API versioning
  • PyDantic-based flexible configfile parcer (toml and yaml formats supports)
  • Typer-based CLI management
  • Prometheus endpoint based on Starlette exporter
  • OpenTelemetry collector
  • Request ID propagation for logger, Request and Response (injection to Headers)
  • CI pipeline for linting and testing (with coverage)

Usage

Base usage

Usage: main.py [OPTIONS] COMMAND [ARGS]...

Options:
  --help                          Show this message and exit.

Commands:
  aaa  Operations with users and other AAA objects
  db   Operations with DB
  run  Run application in uvicorn server with defined config file

All CLI commands with descriptions are placed here

Installation

We`re strongly reccomend to use Poetry

Create new virtual environment or enter to an existing one

poetry shell

Install all dependencies from pyproject.toml

poetry install

Run your app

python3 main.py run