
fastapi-scaff是一个用于快速生成FastAPI项目的脚手架工具开发者可以一键生成项目或api极大地简化了FastAPI的开发过程轻而得到一个生产级的FastAPI项目。What is this?by: axinerfastapi-scaffThis is a fastapi scaff.new projectadd apiabout project:auto init project (conf, db, log…)auto register routerauto add middleware/exceptionsintegrated api-key/jwtintegrated sqlalchemyintegrated migrationintegrated celeryintegrated docker deployment…more documents: 请点击链接Project templateArchitecture: ASMA apiS servicesM modelsFlow: main.py(core) - (middleware) - api - services - modelsLayout: (The naming has been finalized after multiple revisions, making it concise and easy to understand)└── fastapi-scaff ├── app (应用) │ ├── api ├── (接口) │ │ └── v1 │ └── (版本1) │ ├── core ├── (基础) │ │ ├── conf │ ├── (配置) │ │ ├── db │ ├── (数据库) │ │ ├── log │ ├── (日志) │ │ └── ... │ └── (...) │ ├── middleware ├── (中间件) │ ├── migrations ├── (数据库迁移) │ ├── models ├── (数据模型) │ ├── services ├── (业务逻辑) │ ├── utils ├── (工具集) │ └── main.py └── (主入口) ├── app_celery (应用-异步任务) ├── config (配置目录) ├── docs (文档目录) ├── tests (测试目录) ├── .dockerignore ├── .gitignore ├── .python-version ├── build.sh ├── docker-compose.yaml ├── Dockerfile ├── LICENSE ├── README.md ├── requirements.txt └── runserver.py【Other】lightPlease create and view (with-t light)tinyPlease create and view (with-t tiny)singlePlease create and view (with-t single)【Tips】Database, Loguru, Redis, Snowflake, Celery, etc., can all be controlled through parameters to integrate or not, allowing you to flexibly customize the functional modules needed for your project.InstallationThis package can be installed using pip (Python3.11):pip install fastapi-scaffScaff usage1help documentfastapi-scaff -h2new projectfastapi-scaff new myprojlight:fastapi-scaff new myproj -t lighttiny:fastapi-scaff new myproj -t tinysingle:fastapi-scaff new myproj -t single3add apicd to project root dirfastapi-scaff add myapi4integrated celeryNew project:fastapi-scaff new myproj --celeryExisting project:fastapi-scaff add mycelery --celeryProject run1cd to project root dir2modify the configuration, such as for the database3pip install -r requirements.txt4python runserver.pymore parameters see:about uvicorn: click hereabout gunicorn: click herexmigrationeg (Can be executed before runserver):generate:python runmigration.py generate initupgrade:python runmigration.py upgradeabout alembic: click herexdocker, please see:project files:build.sh (default Dockerfile.slim)Dockerfile | Dockerfile.slimdocker-compose.yaml | docker-compose.swarm.yaml[config/nginx.conf]about docker: click here