From 683e97ca530cab9071b2429ff86351a2a45fae20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD?= <3401797899@qq.com> Date: Sun, 26 Jul 2026 20:17:09 +0800 Subject: [PATCH] =?UTF-8?q?docs(adr):=200029=20web=20=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=B8=80=E5=BE=8B=E9=9D=99=E6=80=81=20SPA,hub=20=E5=8F=AA?= =?UTF-8?q?=E5=87=BA=20JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 记录本次迁移的语义决策:没有 HTTP handler 渲染 HTML;/app 与 /database 是同一个前端工程 filelib-web,构建一次挂两个前缀; 客户端导航用真 URL 路由而非 hash 片段。 两条承重配置约束一并写明:appDir 必须改名(默认 _app 与 admin-web 在根上的 /_app/* 撞重复路由,Fastify 启动即失败),以及 paths.relative=false(同一份 index.html 在不同 URL 深度被送出)。 --- ...web-surface-frontend-backend-separation.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 docs/adr/0029-web-surface-frontend-backend-separation.md diff --git a/docs/adr/0029-web-surface-frontend-backend-separation.md b/docs/adr/0029-web-surface-frontend-backend-separation.md new file mode 100644 index 0000000..5022ab1 --- /dev/null +++ b/docs/adr/0029-web-surface-frontend-backend-separation.md @@ -0,0 +1,132 @@ +# ADR 0029: Web Surfaces Are Static SPAs; the Hub Serves JSON Only + +## Status + +Accepted. + +## Context + +The Hub exposes three browser surfaces: the org-admin console (`/admin`), the +teacher-facing file library (`/app`), and the database admin back office +(`/database`). They arrived at different times and diverged in how HTML reached +the browser. + +`/admin` and `/app` were already separated: the backend serves a prebuilt static +`index.html` and never inspects the request; all data flows through JSON +endpoints. `/database` was not. Roughly 1770 lines across four modules +(`renderDashboard`/`renderLoginPage` in `routes/databaseRoutes.ts`, +`routes/adminPanels.ts`, `routes/libraryBrowser.ts`, `routes/libraryPage.ts`) +assembled HTML template strings server-side, reading the session cookie and +querying Prisma inside the page handler, with layout expressed as inline +`style="…"` attributes and behavior as `