Volver
User Auth — FastApi Template

User Auth — FastApi Template

FastAPI User Template

A complete, production-ready template for user authentication with FastAPI, PostgreSQL, and JWT-based cookie authentication. Designed as a starting point for projects that need a secure user system without rebuilding auth from scratch.

Code: GitHub

What it does

This template provides a fully implemented authentication system: user registration, login, logout, and token refresh using HTTP-only cookies to avoid JWT exposure in the frontend. Passwords are hashed with bcrypt, and PostgreSQL stores user records with UUID primary keys. All inputs are validated through Pydantic v2 schemas.

A comprehensive test suite covers the full auth flow — registration, login, logout, token refresh, and protected route access. The project is containerized with Docker Compose and uses Poetry for dependency management.

Tech stack

Key features