Add tRPC for publish progress subscriptions
This commit is contained in:
+12
-1
@@ -7,6 +7,7 @@
|
||||
- **框架**:Next.js(前后端不分离,WebUI 作为本地界面)
|
||||
- **UI 库**:Ant Design
|
||||
- **图标库**:@ant-design/icons
|
||||
- **通信层**:tRPC(避免手写 API Route,除了 `[trpc]/route.ts` 一个入口文件)
|
||||
- **工具库**:use-debounce(防抖)
|
||||
- **Markdown 编辑器**:@uiw/react-md-editor(风格需调整为与 Ant Design 统一)
|
||||
- **校验库**:Zod(运行时校验 config 文件 + API 响应)
|
||||
@@ -35,7 +36,12 @@
|
||||
|
||||
### 前后端通信
|
||||
|
||||
使用 Next.js Server Actions 或直接在 Server Component 中调用后端函数,**不创建 API Route**。前端通过 `"use server"` 指令的函数或 Server Component 的 `async` 逻辑直接调用 `src/lib/` 中的后端代码,避免前后端分离的冗余 API 层。
|
||||
日常功能使用 Next.js Server Actions 或直接在 Server Component 中调用后端函数,**不创建 API Route**。前端通过 `"use server"` 指令的函数或 Server Component 的 `async` 逻辑直接调用 `src/lib/` 中的后端代码,避免前后端分离的冗余 API 层。
|
||||
|
||||
仅发布功能使用 tRPC(需 subscription 推送实时进度),在 `src/app/api/publish/[trpc]/route.ts` 中定义唯一的 HTTP 入口,前端通过 tRPC Client 调用:
|
||||
|
||||
- 变更:`trpc.release.publish.useMutation()`
|
||||
- 订阅:`trpc.release.progress.useSubscription(...)`
|
||||
|
||||
### `src/` 目录说明
|
||||
|
||||
@@ -115,6 +121,11 @@ src/types/
|
||||
- `https://www.npmjs.com/package/use-debounce` — npm 页面
|
||||
- `https://raw.githubusercontent.com/xnimorz/use-debounce/refs/heads/master/README.md` — README 原文
|
||||
|
||||
#### tRPC
|
||||
|
||||
- `https://trpc.io/llms.txt` — 目录索引(带描述)
|
||||
- 每页逐页获取正文
|
||||
|
||||
#### Zod
|
||||
|
||||
- `https://zod.dev/llms.txt` — 目录索引(纯链接)
|
||||
|
||||
Reference in New Issue
Block a user