FastAPI, SQLAlchemy 2.0, Pydantic-V2, Alembic, Postgres and Docker

Ahmed Nafies
7 min readAug 23, 2023

A tutorial for using SQLAlchemy 2.0 and Alembic with FastAPI and Postgres. We will build a simple user management backend with a REST API.

Full code on github

1. Install Poetry

First, install Poetry globally on your system by following the official installation guide…