{"id":23190171,"url":"https://github.com/fmw666/fastapi-builder","last_synced_at":"2025-04-09T12:04:02.467Z","repository":{"id":57428465,"uuid":"431463662","full_name":"fmw666/fastapi-builder","owner":"fmw666","description":"🚀 这是一个用于快速构建 fastapi 项目基础框架的工具，您可以直接在上面着手开发您的 fastapi 项目.","archived":false,"fork":false,"pushed_at":"2025-02-19T08:37:39.000Z","size":243,"stargazers_count":45,"open_issues_count":1,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T06:51:30.796Z","etag":null,"topics":["build","build-tool","command-line","fastapi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fmw666.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-24T11:48:57.000Z","updated_at":"2025-03-30T15:43:14.000Z","dependencies_parsed_at":"2025-03-02T13:00:56.909Z","dependency_job_id":"7df10c6f-fe3e-4e76-b73a-55121af84f7f","html_url":"https://github.com/fmw666/fastapi-builder","commit_stats":{"total_commits":116,"total_committers":2,"mean_commits":58.0,"dds":"0.025862068965517238","last_synced_commit":"9fc8984481b04573f672dcbac1a909782e80e1cb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmw666%2Ffastapi-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmw666%2Ffastapi-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmw666%2Ffastapi-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmw666%2Ffastapi-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fmw666","download_url":"https://codeload.github.com/fmw666/fastapi-builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036064,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","build-tool","command-line","fastapi"],"created_at":"2024-12-18T12:13:32.506Z","updated_at":"2025-04-09T12:04:02.435Z","avatar_url":"https://github.com/fmw666.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 「 FastAPI Builder V2 」\n\n\u003cdiv align=\"right\"\u003e\n    \u003ca href=\"https://fastapi.tiangolo.com/zh/\"\u003e\u003cb\u003efastapi 官方网站 ➡\u003c/b\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n\u003e 💡 **fastapi 项目构建器. 一款帮助您快速构建 fastapi 项目的工具.**\n\n\u0026emsp;\u0026emsp;fastapi-builder 是一个基于 FastAPI 框架的快速 Web 应用程序开发的工具箱。它提供了一组现成的工具和组件，可以帮助您快速构建具有良好结构和可维护性的 FastAPI Web 应用程序。其目的是提供一个一站式的解决方案，以加速快速原型开发和生产部署。\n\n+ ***[特性](#-特性)***\n\n+ ***[TODO](#-todo)***\n\n+ ***[快速开始](#-快速开始)***\n\n+ ***[项目结构](#-项目结构)***\n\n+ ***[特别感谢](#-特别感谢)***\n\n+ ***[许可证](#-许可证)***\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/fmw666/my-image-file/blob/master/images/cute/small-cute-8.jpg\" width=100\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n## 💬 特性\n\n+ 🔥 一键生成可定制的应用程序模块，支持热更新，并提供完整的 CRUD 接口。\n\n+ 灵感来源于 Django 的项目基础命令。\n\n+ 支持创建可自定义的完整项目结构。\n\n+ 自动生成项目结构，简化初始化过程。\n\n+ 对数据库操作进行封装，简化管理流程。\n\n+ 支持多种数据库，包括 MySQL。\n\n+ 提供 Dockerfile 和 pre-commit 钩子等可选配置。\n\n+ 管理虚拟环境，简化环境搭建和依赖管理。\n\n\u003cbr\u003e\n\n## 🎯 TODO\n\n\u003cdiv align=\"right\"\u003e\u003ci\u003e\u003cb\u003e\u003ca href=\"#no-reply\"\u003ePS: 期待您对本项目做出贡献...\u003c/a\u003e\u003c/b\u003e\u003c/i\u003e\u003c/div\u003e\n\n+ [ ] 持续完善项目框架代码\n\n+ [ ] 持续完善项目文档\n\n+ [x] 优化 requirements.txt\n\n+ [ ] 提供英文文档版本\n\n+ [ ] 提供 PostgreSQL、SQLite 数据库支持\n\n+ [x] 提供完整的 run 方法\n\n+ [x] 内置 Alembic 数据迁移管理\n\n+ [x] 提供运行环境检查\n\n+ [x] 提供 FastAPI venv 命令，管理虚拟环境\n\n+ [x] 针对 Linux 和 Mac 环境提供支持\n\n+ [x] 生成 app 时，自动注入到 project 中（路由管理分配）\n\n\u003cbr\u003e\n\n## 🚀 快速开始\n\n\u003cdiv align=\"right\"\u003e\n\u003ci\u003e=\u003e 依赖：\u003cb\u003ePython 3.8+\u003c/b\u003e\u003c/i\u003e\n\u003cbr\u003e\n\u003ci\u003e=\u003e 详细教程：\u003cb\u003e\u003ca href=\"docs/tutorial.md\"\u003etutorial\u003c/a\u003e\u003c/b\u003e\u003c/i\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n安装 `fastapi-builder` 项目：\n\n```sh\npip install fastapi-builder\n```\n\n查看项目版本：\n\n```sh\nfastapi --version\n```\n\n项目帮助：\n\n```sh\nfastapi --help\nfastapi startproject --help\n```\n\n创建 `fastapi` 项目：\n\n```sh\nfastapi startproject [name]\n\n# or 带有交互选择\n\nfastapi startproject [name] --interactive\n```\n\n创建 `fastapi` 应用：\n\n```sh\nfastapi startapp [name]\n```\n\n运行 `fastapi` 项目：\n\n```sh\nfastapi run\n```\n\n通过访问 `http://127.0.0.1:8000/docs` 以确保 fastapi 服务正常运行.\n\n\u003cbr\u003e\n\n## 📁 项目结构\n\n```c\n.\n├── alembic/                      - 数据库迁移工具\n├── api/                          - web 相关（路由、认证、请求、响应）.\n│   ├── errors/                   - 定义错误处理方法.\n│   │   ├── http_error.py         - http 错误处理方法\n│   │   │── validation_error.py   - 验证错误处理方法\n│   ├── routes/                   - web routes 路由.\n│   │   ├── api.py                - 总路由接口\n│   │   └── authentication.py     - 认证相关（登录、注册）路由\n├── apps/                         - 子应用.\n│   ├── app_user/                 - user 应用.\n│   │   ├── api.py                - 提供 user 接口方法\n│   │   ├── doc.py                - 提供 user Swagger UI 文档\n│   │   ├── field.py              - 提供 user pydantic 验证字段\n│   │   ├── model.py              - 提供 user 表模型\n│   │   └── schema.py             - 提供 user pydantic 结构模型\n│   ├── ...                       - 其他应用.\n├── core/                         - 项目核心配置, 如: 配置文件, 事件句柄, 日志.\n│   ├── e/                        - 错误处理包.\n│   │   ├── __init__.py\n│   │   ├── codes.py              - 错误码定义\n│   │   └── messages.py           - 错误消息定义\n│   ├── .env                      - 配置文件.\n│   ├── config.py                 - 解析配置文件, 用于其他文件读取配置.\n│   ├── events.py                 - 定义 fastapi 事件句柄.\n│   ├── logger.py                 - 定义项目日志方法.\n├── db/                           - 数据库相关.\n│   ├── base.py                   - 导入所有应用 model.\n│   ├── database.py               - sqlalchemy 方法应用.\n│   ├── errors.py                 - 数据库相关错误异常.\n├── lib/                          - 自定义库\n│   ├── jwt.py                    - 用户认证 jwt 方法.\n│   ├── security.py               - 加密相关方法.\n├── logs/                         - 日志文件目录.\n├── middleware/                   - 项目中间件.\n│   ├── logger.py                 - 请求日志处理.\n├── models/                       - sqlalchemy 基础模型相关\n│   ├── base.py                   - sqlalchemy declarative Base 表模型.\n│   └── mixins.py                 - mixin 抽象模型定义.\n├── schemas/                      - pydantic 结构模型相关.\n│   ├── base.py                   - pydantic 结构模型基础类.\n│   ├── jwt.py                    - jwt 相关结构模型.\n│   ├── response.py               - 响应模型封装.\n├── utils/                        - 工具类.\n│   ├── dbmanager.py              - 数据库管理服务.\n│   ├── docs.py                   - fastapi docs 文档自定义.\n├── .flake8                       - pep8 规范.\n├── .pre-commit-config.yaml       - pre-commit 配置文件.\n├── alembic.ini                   - alembic 数据库迁移工具配置文件.\n├── docker-compose.yaml           - docker 配置.\n├── Dockerfile                    - dockfile 文件.\n├── .fastapi-builder.ini          - fastapi-builder 配置文件.\n├── LICENSE                       - 许可证信息.\n├── main.py                       - fastapi application 创建和配置.\n├── pyproject.toml                - poetry 需求模块信息.\n├── README.md                     - 项目说明文档.\n├── requirements.txt              - pip 需求模块信息.\n└── setup.cfg                     - pre-commit 配置文件.\n```\n\n\u003cbr\u003e\n\n## ⚡ 特别感谢\n\n项目配置生成及 questionary 内容基于项目：\u003chttps://github.com/ycd/manage-fastapi\u003e\n\nfastapi 项目基础框架参考：\u003chttps://github.com/nsidnev/fastapi-realworld-example-app/\u003e\n\n\u003cbr\u003e\n\n## 🚩 许可证\n\n项目根据麻省理工学院的许可条款授权.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffmw666%2Ffastapi-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffmw666%2Ffastapi-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffmw666%2Ffastapi-builder/lists"}