orpc-api
仓库创建 2024年12月9日最近提交 6 小时前SkillHot 收录 5 小时前
▸ 精选理由
明确 oRPC 与 OpenAPI 混合架构,便于构建一致的 API 层。
▸ 风险提示
修改 API 可能影响鉴权与安全,需谨慎评审
这个 Skill 做什么
在 builder 应用中创建或修改 oRPC 路由、过程与中间件。
在 builder 应用中新增或修改 oRPC 路由、procedure 和中间件,并能生成对应的 OpenAPI 路由与鉴权逻辑。新增 API、变更权限或调整中间件时会用到,注意请求上下文含 headers、user、workspace 等信息。特点是同一套 oRPC 同时服务 RPC 与 OpenAPI,路由通过对象组合模块化管理。
▸ 展开 SKILL.md 英文原文
Create and modify oRPC API routers, procedures, and middleware for the builder app. Use when adding API endpoints, creating routers, defining procedures, working with oRPC middleware, or building OpenAPI routes.
524
Stars
116
Forks
21
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/ChatbotXIO/ChatbotX/main/.agents/skills/orpc-api/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/ChatbotXIO/ChatbotX/main/.agents/skills/orpc-api/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# oRPC API Development
## Architecture
- **oRPC** serves both **RPC** (`/rpc`) and **OpenAPI** (`/api`) endpoints
- Base context: `{ headers, user?, workspace? }`
- Two auth stacks: `authorizedAPI` (session) and `workspaceTokenAuthAPI` (header token)
- Routers are plain objects of procedures, composed via object spreading
## Auth Stacks
Defined in `apps/builder/src/orpc.ts`:
- **`authorizedAPI`**: `base` → error mapping → `authMiddleware` (session/cookie auth)
- **`workspaceTokenAuthAPI`**: `base` → error mapping → `workspaceTokenAuthMidddleware` (Authorization: Bearer header)
Workspace-scoped procedures add `workspaceAuthorizedMidddleware` per-procedure.
## Creating a New Procedure
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有