Skip to content

art3xa/fastapi-template

Repository files navigation

FastAPI-Template

Deploy application Static Checks Hits-of-Code Maintainability Hits

FastAPI Template with JWT Authentication

Technologies used

  • Python
  • Poetry
  • FastAPI
  • SQLAlchemy v2
  • Alembic
  • Asyncpg
  • PostgreSQL
  • Pydantic v2
  • Pytest
  • Docker
  • Docker Compose

Swagger

You can check and open openapi.json in swagger editor or redoc

Usage

Preparation

  • Install packages with Poetry
make install
cp .env.example .env
  • Configure environment variables

Run in Docker

  • Build and run the docker container
make

Run local

  • Change DATABASE_HOST from database to localhost in .env file
  • Startup PostgreSQL
make up-db
  • Run migrations
make migrate
  • Run make run to start app
make run

Other Makefile commands

  • Run tests
make test
  • Run tests coverage
make cov
  • Run linters
make lint
  • Run formatters
make format