Skip to content
Projects

ivan-borovets/fastapi-clean-example

View on GitHub

About

A practical Clean Architecture backend example built with FastAPI. No stateful globals (DI), low coupling (DIP), tactical DDD, CQRS, and proper UoW usage. Includes a REST API, per-route error handling, session-based authentication, and contextual RBAC, along with extensive documentation and modern tooling.

Web & App Development

How these counts are measured

Measured star growth

in 24h
0
in 7 days
+4
in 15 days
+7
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Mentioned in Awesome FastAPI

Stay tuned. Refactor in progress, see legacy-2025 branch for architecture docs

TODO:

  • Write tests
  • Explain code and patterns in new README
  • Make template project

Prerequisites

uv sync
source .venv/bin/activate
prek install --overwrite --hook-type pre-commit --hook-type pre-push

Start in Docker

make upd

Start locally

make upd-local
alembic upgrade head
uvicorn app.main.run:make_app --factory --host 0.0.0.0 --port 8000 --reload
# or `src/app/main/run.py` in IDE

Full API access:

  • create user via sign up
  • set its role to super_admin manually in DB
  • log in as super admin

Stop

make down

Test (light paths)

make check

Test (all paths)

make test-docker

Generate a migration

make migration msg=<msg>

See Makefile for more commands

Thanks for your patience and support

Acknowledgements

Explore related projects

Loading…