Skip to content
项目

ivan-borovets/fastapi-clean-example

在 GitHub 查看

关于

使用 FastAPI 构建的实用型整洁架构后端示例。不使用有状态的全局变量(DI),采用低耦合设计(DIP)、战术 DDD、CQRS 和规范的 UoW 用法。包含 REST API、按路由处理错误、基于会话的身份验证和上下文相关的 RBAC,并附带详尽文档与现代化工具链。

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
+4
15天
+7
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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

探索相关项目

加载中…