Skip to content
/ fastap Public

This is a fastapi scaff. (fastapi脚手架,一键生成项目或api,让开发变得更简单)

License

Notifications You must be signed in to change notification settings

amrunje/fastap

Repository files navigation

fastapi-scaff

What is this?

  • by: axiner
  • fastapi-scaff
  • This is a fastapi scaff.
    • new project
    • add api
    • about project:
      • auto init project (conf, db, log...)
      • auto register router
      • auto register middleware
      • ...
    • more documents: 请点击链接

Project structure

  • ASM: ASM模式
    • A api
    • S services(&schemas)
    • M models
  • 调用过程: main.py(initializer) -> (middleware) - api - services(&schemas) - (models)
  • 结构如下: (命名经过多次修改敲定,简洁易懂)
    └── fastapi-scaff
        ├── app                         (应用)
        │   ├── api                     ├── (api)
        │   │   └── v1                  │   └── (v1)
        │   ├── initializer             ├── (初始化)
        │   │   ├── conf                │   ├── (配置)
        │   │   ├── db                  │   ├── (数据库)
        │   │   ├── log                 │   ├── (日志)
        │   │   └── ...                 │   └── (...)
        │   ├── middleware              ├── (中间件)
        │   ├── models                  ├── (数据模型)
        │   ├── schemas                 ├── (数据结构)
        │   ├── services                ├── (业务逻辑)
        │   ├── utils                   ├── (utils)
        │   └── main.py                 └── (main.py)
        ├── app_celery                  (应用-celery)
        ├── config                      (配置目录)
        ├── deploy                      (部署目录)
        ├── docs                        (文档目录)
        ├── logs                        (日志目录)
        ├── tests                       (测试目录)
        ├── .gitignore
        ├── LICENSE
        ├── README.md
        ├── requirements.txt
        └── runcbeat.py
        └── runcworker.py
        └── runserver.py
    

Installation

This package can be installed using pip (Python>=3.11):

pip install fastapi-scaff

Scaff usage

  • 1)help document
    • fastapi-scaff -h
  • 2)new project
    • fastapi-scaff new <myproj>
  • 3)add api
    • cd to project root dir
    • fastapi-scaff add <myapi>

Project run

  • 1)cd to project root dir
  • 2)modify the configuration, such as for the database
  • 3)pip install -r requirements.txt
  • 4)python runserver.py

License

This project is released under the MIT License (MIT). See LICENSE

About

This is a fastapi scaff. (fastapi脚手架,一键生成项目或api,让开发变得更简单)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages