Skip to content

FastAPI Best Architecture is an enterprise-grade backend architecture solution built with FastAPI. FastAPI 最佳架构是使用 FastAPI 构建的企业级后端架构解决方案

License

Notifications You must be signed in to change notification settings

fastapi-practices/fastapi_best_architecture

Repository files navigation

The logo includes the abstract combination of the three letters FBA, forming a lightning bolt that seems to spread out from the ground

FastAPI Best Architecture

English | 简体中文

Enterprise-level backend architecture solution

🔥Continuously updated and maintained🔥

GitHub Python MySQL PostgreSQL SQLAlchemy Pydantic v2 Ruff uv Docker Discord Discord

Note

This repository as a template library open to any person or enterprise can be used for free!

Pseudo 3-tier architecture

The mvc architecture is a common design pattern in python web, but the 3-tier architecture is even more fascinating

In python web development, there is no common standard for the concept of 3-tier architecture, so we'll call it a pseudo 3-tier architecture here

But please note that we don't have a traditional multi-app structure (django, springBoot...) If you don't like this pattern, use templates to transform it to your heart's content!

workflow java fastapi_best_architecture
view controller api
data transmit dto schema
business logic service + impl service
data access dao / mapper crud
model model / entity model

Features

  • Global FastAPI PEP 593 Annotated parameter style
  • Comprehensive async/await + asgiref asynchronous design
  • Adheres to RESTful API specifications
  • Uses SQLAlchemy 2.0 with new syntax
  • Uses Pydantic v2 version
  • Implements role-menu RBAC access control
  • Integrates Casbin RBAC access control
  • Supports Celery asynchronous tasks
  • Custom-developed JWT authentication middleware
  • Supports global custom time zones
  • Supports Docker / Docker-compose deployment
  • Integrates Pytest unit testing

Built-in Functions

  • User Management: Assign roles and permissions
  • Department Management: Configure organizational structure (company, department, team, etc.)
  • Menu Management: Set up menus and button-level permissions
  • Role Management: Configure roles, assign menus and permissions
  • Dictionary Management: Maintain common parameters and configurations
  • Parameter Management: Dynamically configure commonly used system parameters
  • Notification Announcements: Publish and maintain system notification and announcement information
  • Token Management: Detect online status, support forced logout
  • Multi-device Login: Support one-click switching between multi-device login modes
  • OAuth 2.0: Built-in custom-developed OAuth 2.0 authorization login
  • Plugin System: Hot-swappable plugin design to reduce coupling
  • Scheduled Tasks: Support scheduled, asynchronous tasks, and function calls
  • Code Generation: Automatically generate code with preview, write, and download support
  • Operation Logs: Record and query normal and abnormal operations
  • Login Logs: Record and query normal and abnormal logins
  • Cache Monitoring: Query system cache information and command statistics
  • Service Monitoring: View server hardware information and status
  • API Documentation: Automatically generate online interactive API documentation

Development and deployment

For more details, please check the official documentation

Contributors

Special thanks

Interactivity

Discord

Sponsor us

If this program has helped you, you can sponsor us with some coffee beans: ☕ Sponsor ☕

License

This project is licensed by the terms of the MIT license

Stargazers over time

About

FastAPI Best Architecture is an enterprise-grade backend architecture solution built with FastAPI. FastAPI 最佳架构是使用 FastAPI 构建的企业级后端架构解决方案

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages