fastapi-patterns
FastAPI 模式:异步 API、依赖注入、Pydantic 请求与响应模型、OpenAPI 文档、测试、安全及生产就绪。
机器翻译查看英文原文
FastAPI patterns for async APIs, dependency injection, Pydantic request and response models, OpenAPI docs, tests, security, and production readiness.
适用对象:云服务、运维与安全。自动收录 · 待核查。
原作者说明节选
从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。
查看英文原文
原文涵盖的主题
- FastAPI Patterns
- When to Use
- How It Works
- Project Layout
- Application Factory
- Pydantic Schemas
- Dependencies
- Async Endpoints
Production-oriented patterns for FastAPI services. Building or reviewing a FastAPI app. Splitting routers, schemas, dependencies, and database access. Writing async endpoints that call a database or external service. Adding authentication, authorization, OpenAPI docs, tests, or deployment settings. Checking a FastAPI PR for copy-pasteable examples and production risks. Treat the FastAPI app as a thin HTTP layer over explicit dependencies and service code: main.py owns app construction, middleware, exception handlers, and router registration. schemas/ owns Pydantic request and response models. dependencies.py owns database, auth, pagination, and request-scoped dependencies. services/ or crud/ owns business and persistence operations. tests/ overrides dependencies instead of opening production resources. Prefer small routers and explicit responsemodel declarations. Keep raw ORM objects, secrets, and framework globals out of response schemas. Use a factory so tests and workers can build the app with controlled settings. Do not use alloworigins=[""] with allowcredentials=True; browsers reject that combination and Starlette disallows it for credentialed requests. Keep request, update, a
这里只展示节选,请以完整原文和当前要求为准。
- 来源仓库
- affaan-m/ECC
- 源文件
- .kiro/skills/fastapi-patterns/SKILL.md
- 固定版本
- d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
来源与内容状态
本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。
原作者:affaan-m/ECC · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-09T14:01:48.593Z。
分类由名称、说明与路径规则生成,分类不代表已核实适配。
许可与权利归属
MIT。第三方内容及版权归原作者,使用条件以原文为准。
许可原文 ↗本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。
限制与注意事项
- 元数据收录不代表本站已经安装、适配、实测或进行安全审查。