// the find
fastapi-practices/fastapi-best-architecture
Enterprise-level backend architecture solution with fastapi、sqlalchemy,、celery、pydantic、grafana、docker...
A batteries-included FastAPI project template following a layered architecture (api → service → crud → model) that mirrors Java Spring Boot conventions. It ships with RBAC via Casbin, JWT auth, Celery task scheduling, Redis caching, operation logging, and an optional code-generator plugin. Aimed at developers who want a ready-made admin backend without building the plumbing from scratch.
The layered architecture is enforced consistently across the codebase — every feature follows the same api/schema/service/crud/model split, which makes navigation predictable. The plugin system is a real differentiator: code_generator, config, dict, email, and notice are all opt-in via plugin.toml rather than baked into the core. Observability is first-class — OpenTelemetry, Prometheus metrics for SQLAlchemy and Celery queues, and Grafana integration are wired in, not bolted on. Alembic migrations are present and the project uses SQLAlchemy 2.0 async properly rather than the half-async pattern many FastAPI templates fall into.
It's a Chinese-origin project with an English README that is skeletal — the real docs are in the separate docs site, and several parts of the codebase (locale files, comments) are Chinese-only, which will slow down anyone who can't read it. The architecture is explicitly modeled after Spring Boot, so it imports Java-shaped patterns (data_scope, dept/role/menu RBAC hierarchies) that don't map to most Python projects and add significant upfront complexity you'll fight to remove rather than extend. Test coverage is almost nonexistent — there's a single test file for auth and an empty tests directory for most modules, so 'enterprise-level' is aspirational on that front. The plugin installer does dynamic file copying and SQL execution at runtime, which is clever but means broken plugin state can corrupt your schema in ways that are hard to recover from without reading the installer source.