Skip to content

ivan-borovets/fastapi-clean-example

Repository files navigation

Mentioned in Awesome FastAPI

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

TODO:

  • Polish code where possible
  • Write integration tests, finally
  • Explain code and patterns in new README
  • Make template project

Prerequisites

uv sync
source .venv/bin/activate
pre-commit install --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 --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

See Makefile for more commands

Thanks for your patience and support

Acknowledgements

About

Practical Clean Architecture backend example built with FastAPI. No stateful globals (DI), low coupling (DIP), tactical DDD, CQRS, proper UoW usage. REST API, per-route error handling, session-based auth, contextual RBAC. Bundled with extensive docs and modern tooling

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages