Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(demo): simplify architecture diagram routing

tianma-ifa6297b49318b
diff --git a/apps/api/src/demo-seed-data.test.mjs b/apps/api/src/demo-seed-data.test.mjs
index 8c285576..f5d1c33e 100644
--- a/apps/api/src/demo-seed-data.test.mjs
+++ b/apps/api/src/demo-seed-data.test.mjs
@@ -53,7 +53,7 @@ describe("demo seed catalog", () => {
const diagram = parseDiagramDocument(memo?.markdown);
expect(diagram).toMatchObject({ kind: "architecture" });
expect(diagram?.nodes).toHaveLength(20);
- expect(diagram?.edges).toHaveLength(15);
+ expect(diagram?.edges).toHaveLength(9);
const boundaries = new Map(
diagram?.nodes.filter((node) => node.shape === "boundary").map((node) => [node.id, node]),
diff --git a/apps/api/src/demo-seed-data.ts b/apps/api/src/demo-seed-data.ts
index bb7a001d..3f932f20 100644
--- a/apps/api/src/demo-seed-data.ts
+++ b/apps/api/src/demo-seed-data.ts
@@ -22,47 +22,41 @@ export const DEMO_ARCHITECTURE_DIAGRAM_ZH: DiagramDocument = {
schemaVersion: 2,
kind: "architecture",
nodes: [
- { id: "boundary-clients", label: "全端体验层", x: 40, y: 40, width: 1120, height: 150, shape: "boundary" },
- { id: "boundary-platform", label: "可移植应用平台 · Cloudflare Workers / Docker 共用业务核心", x: 40, y: 230, width: 1120, height: 200, shape: "boundary" },
- { id: "boundary-data", label: "数据与文件层 · 可替换基础设施适配器", x: 40, y: 470, width: 690, height: 210, shape: "boundary" },
- { id: "boundary-ecosystem", label: "AI 与自动化生态", x: 770, y: 470, width: 390, height: 210, shape: "boundary" },
-
- { id: "client-web", label: "Web / PWA\n离线优先", x: 72, y: 94, width: 168, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
- { id: "client-desktop", label: "macOS / Windows\n桌面端", x: 286, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
- { id: "client-ios", label: "iOS\nSwiftUI 原生端", x: 500, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
- { id: "client-android", label: "Android\nExpo 原生端", x: 714, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
- { id: "client-clipper", label: "浏览器剪藏\nChrome / Edge", x: 928, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
-
- { id: "platform-api", label: "统一 API 入口\n认证 · 限流 · 路由", x: 72, y: 298, width: 174, height: 72, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },
- { id: "platform-core", label: "共享业务核心\nHono · 领域服务", x: 292, y: 290, width: 188, height: 88, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },
- { id: "platform-sync", label: "同步与修订引擎\n离线队列 · 冲突控制", x: 526, y: 298, width: 188, height: 72, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },
- { id: "platform-mcp", label: "原生 MCP 端点\n智能体读写工具", x: 760, y: 298, width: 170, height: 72, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },
- { id: "platform-model", label: "端侧模型网关\nBYOK 隐私直连", x: 976, y: 298, width: 154, height: 72, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },
-
- { id: "data-sql", label: "D1 / SQLite\n笔记 · 标签 · 修订", x: 82, y: 540, width: 174, height: 76, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },
- { id: "data-objects", label: "R2 / S3\n图片与附件", x: 296, y: 540, width: 174, height: 76, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },
- { id: "data-search", label: "搜索与语义索引\n全文 · 向量", x: 510, y: 540, width: 174, height: 76, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },
-
- { id: "ecosystem-agents", label: "Claude / Cursor\n自动化智能体", x: 806, y: 530, width: 150, height: 72, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },
- { id: "ecosystem-models", label: "OpenAI / Gemini\n兼容模型服务", x: 974, y: 530, width: 150, height: 72, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },
- { id: "ecosystem-apps", label: "Webhook / 外部应用\n自动化工作流", x: 890, y: 620, width: 156, height: 44, shape: "external", resourceIcon: "webhook", parentId: "boundary-ecosystem" },
+ { id: "boundary-clients", label: "全端体验层", x: 40, y: 40, width: 1120, height: 220, shape: "boundary" },
+ { id: "boundary-platform", label: "可移植应用平台 · Cloudflare Workers / Docker 共用业务核心", x: 40, y: 300, width: 1120, height: 220, shape: "boundary" },
+ { id: "boundary-data", label: "数据与文件层 · 可替换基础设施适配器", x: 40, y: 560, width: 690, height: 210, shape: "boundary" },
+ { id: "boundary-ecosystem", label: "AI 与自动化生态", x: 770, y: 560, width: 390, height: 210, shape: "boundary" },
+
+ { id: "client-web", label: "Web / PWA\n离线优先", x: 68, y: 86, width: 180, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
+ { id: "client-desktop", label: "macOS / Windows\n桌面端", x: 284, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
+ { id: "client-ios", label: "iOS\nSwiftUI 原生端", x: 500, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
+ { id: "client-android", label: "Android\nExpo 原生端", x: 716, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
+ { id: "client-clipper", label: "浏览器剪藏\nChrome / Edge", x: 932, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
+ { id: "client-sync", label: "全端共享同步通道", x: 490, y: 184, width: 200, height: 48, shape: "service", resourceIcon: "apiClient", parentId: "boundary-clients" },
+
+ { id: "platform-api", label: "统一 API 入口\n认证 · 限流 · 路由", x: 490, y: 338, width: 200, height: 64, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },
+ { id: "platform-core", label: "共享业务核心\nHono · 领域服务", x: 490, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },
+ { id: "platform-sync", label: "同步与修订引擎\n离线队列 · 冲突控制", x: 220, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },
+ { id: "platform-mcp", label: "原生 MCP 端点\n智能体读写工具", x: 760, y: 430, width: 190, height: 64, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },
+ { id: "platform-model", label: "端侧模型网关\nBYOK 隐私直连", x: 980, y: 430, width: 170, height: 64, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },
+
+ { id: "data-search", label: "搜索与语义索引\n全文 · 向量", x: 76, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },
+ { id: "data-sql", label: "D1 / SQLite\n笔记 · 标签 · 修订", x: 292, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },
+ { id: "data-objects", label: "R2 / S3\n图片与附件", x: 508, y: 632, width: 186, height: 76, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },
+
+ { id: "ecosystem-agents", label: "Claude / Cursor\n自动化智能体", x: 796, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },
+ { id: "ecosystem-models", label: "OpenAI / Gemini\n兼容模型服务", x: 974, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },
],
edges: [
- { id: "edge-web-api", source: "client-web", target: "platform-api", label: "HTTPS / 同步游标", kind: "request" },
- { id: "edge-desktop-api", source: "client-desktop", target: "platform-api", kind: "request" },
- { id: "edge-ios-api", source: "client-ios", target: "platform-api", kind: "request" },
- { id: "edge-android-api", source: "client-android", target: "platform-api", kind: "request" },
- { id: "edge-clipper-api", source: "client-clipper", target: "platform-api", kind: "request" },
+ { id: "edge-clients-api", source: "client-sync", target: "platform-api", label: "HTTPS / 同步游标", kind: "request" },
{ id: "edge-api-core", source: "platform-api", target: "platform-core", label: "统一领域接口", kind: "request" },
{ id: "edge-core-sync", source: "platform-core", target: "platform-sync", label: "变更日志", kind: "async", bidirectional: true },
{ id: "edge-mcp-core", source: "platform-mcp", target: "platform-core", label: "受控读写", kind: "request", bidirectional: true },
- { id: "edge-core-model", source: "platform-core", target: "platform-model", label: "行内 AI", kind: "request" },
{ id: "edge-core-sql", source: "platform-core", target: "data-sql", label: "事务", kind: "data" },
{ id: "edge-core-objects", source: "platform-core", target: "data-objects", label: "对象存取", kind: "data" },
{ id: "edge-sync-search", source: "platform-sync", target: "data-search", label: "增量索引", kind: "data" },
{ id: "edge-agents-mcp", source: "ecosystem-agents", target: "platform-mcp", label: "MCP Tools", kind: "request", bidirectional: true },
{ id: "edge-model-gateway", source: "platform-model", target: "ecosystem-models", label: "用户密钥直连", kind: "request", bidirectional: true },
- { id: "edge-apps-mcp", source: "ecosystem-apps", target: "platform-mcp", label: "自动化", kind: "async" },
],
};
@@ -70,47 +64,41 @@ export const DEMO_ARCHITECTURE_DIAGRAM_EN: DiagramDocument = {
schemaVersion: 2,
kind: "architecture",
nodes: [
- { id: "boundary-clients", label: "Cross-Platform Experience", x: 40, y: 40, width: 1120, height: 150, shape: "boundary" },
- { id: "boundary-platform", label: "Portable Application Platform · Shared Core on Cloudflare Workers or Docker", x: 40, y: 230, width: 1120, height: 200, shape: "boundary" },
- { id: "boundary-data", label: "Data & Files · Replaceable Infrastructure Adapters", x: 40, y: 470, width: 690, height: 210, shape: "boundary" },
- { id: "boundary-ecosystem", label: "AI & Automation Ecosystem", x: 770, y: 470, width: 390, height: 210, shape: "boundary" },
-
- { id: "client-web", label: "Web / PWA\nOffline First", x: 72, y: 94, width: 168, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
- { id: "client-desktop", label: "macOS / Windows\nDesktop", x: 286, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
- { id: "client-ios", label: "iOS\nNative SwiftUI", x: 500, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
- { id: "client-android", label: "Android\nNative Expo", x: 714, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
- { id: "client-clipper", label: "Web Clipper\nChrome / Edge", x: 928, y: 94, width: 168, height: 64, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
-
- { id: "platform-api", label: "Unified API Entry\nAuth · Limits · Routing", x: 72, y: 298, width: 174, height: 72, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },
- { id: "platform-core", label: "Shared Business Core\nHono · Domain Services", x: 292, y: 290, width: 188, height: 88, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },
- { id: "platform-sync", label: "Sync & Revision Engine\nOffline Queue · Conflicts", x: 526, y: 298, width: 188, height: 72, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },
- { id: "platform-mcp", label: "Native MCP Endpoint\nAgent Read/Write Tools", x: 760, y: 298, width: 170, height: 72, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },
- { id: "platform-model", label: "Client Model Gateway\nPrivate BYOK", x: 976, y: 298, width: 154, height: 72, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },
-
- { id: "data-sql", label: "D1 / SQLite\nNotes · Tags · Revisions", x: 82, y: 540, width: 174, height: 76, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },
- { id: "data-objects", label: "R2 / S3\nImages & Attachments", x: 296, y: 540, width: 174, height: 76, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },
- { id: "data-search", label: "Search & Semantic Index\nFull Text · Vectors", x: 510, y: 540, width: 174, height: 76, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },
-
- { id: "ecosystem-agents", label: "Claude / Cursor\nAutomation Agents", x: 806, y: 530, width: 150, height: 72, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },
- { id: "ecosystem-models", label: "OpenAI / Gemini\nCompatible Models", x: 974, y: 530, width: 150, height: 72, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },
- { id: "ecosystem-apps", label: "Webhooks / External Apps\nAutomation Workflows", x: 890, y: 620, width: 156, height: 44, shape: "external", resourceIcon: "webhook", parentId: "boundary-ecosystem" },
+ { id: "boundary-clients", label: "Cross-Platform Experience", x: 40, y: 40, width: 1120, height: 220, shape: "boundary" },
+ { id: "boundary-platform", label: "Portable Application Platform · Shared Core on Cloudflare Workers or Docker", x: 40, y: 300, width: 1120, height: 220, shape: "boundary" },
+ { id: "boundary-data", label: "Data & Files · Replaceable Infrastructure Adapters", x: 40, y: 560, width: 690, height: 210, shape: "boundary" },
+ { id: "boundary-ecosystem", label: "AI & Automation Ecosystem", x: 770, y: 560, width: 390, height: 210, shape: "boundary" },
+
+ { id: "client-web", label: "Web / PWA\nOffline First", x: 68, y: 86, width: 180, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
+ { id: "client-desktop", label: "macOS / Windows\nDesktop", x: 284, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
+ { id: "client-ios", label: "iOS\nNative SwiftUI", x: 500, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
+ { id: "client-android", label: "Android\nNative Expo", x: 716, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
+ { id: "client-clipper", label: "Web Clipper\nChrome / Edge", x: 932, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
+ { id: "client-sync", label: "Shared Cross-Client Sync", x: 490, y: 184, width: 200, height: 48, shape: "service", resourceIcon: "apiClient", parentId: "boundary-clients" },
+
+ { id: "platform-api", label: "Unified API Entry\nAuth · Limits · Routing", x: 490, y: 338, width: 200, height: 64, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },
+ { id: "platform-core", label: "Shared Business Core\nHono · Domain Services", x: 490, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },
+ { id: "platform-sync", label: "Sync & Revision Engine\nOffline Queue · Conflicts", x: 220, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },
+ { id: "platform-mcp", label: "Native MCP Endpoint\nAgent Read/Write Tools", x: 760, y: 430, width: 190, height: 64, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },
+ { id: "platform-model", label: "Client Model Gateway\nPrivate BYOK", x: 980, y: 430, width: 170, height: 64, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },
+
+ { id: "data-search", label: "Search & Semantic Index\nFull Text · Vectors", x: 76, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },
+ { id: "data-sql", label: "D1 / SQLite\nNotes · Tags · Revisions", x: 292, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },
+ { id: "data-objects", label: "R2 / S3\nImages & Attachments", x: 508, y: 632, width: 186, height: 76, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },
+
+ { id: "ecosystem-agents", label: "Claude / Cursor\nAutomation Agents", x: 796, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },
+ { id: "ecosystem-models", label: "OpenAI / Gemini\nCompatible Models", x: 974, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },
],
edges: [
- { id: "edge-web-api", source: "client-web", target: "platform-api", label: "HTTPS / Sync Cursor", kind: "request" },
- { id: "edge-desktop-api", source: "client-desktop", target: "platform-api", kind: "request" },
- { id: "edge-ios-api", source: "client-ios", target: "platform-api", kind: "request" },
- { id: "edge-android-api", source: "client-android", target: "platform-api", kind: "request" },
- { id: "edge-clipper-api", source: "client-clipper", target: "platform-api", kind: "request" },
+ { id: "edge-clients-api", source: "client-sync", target: "platform-api", label: "HTTPS / Sync Cursor", kind: "request" },
{ id: "edge-api-core", source: "platform-api", target: "platform-core", label: "Domain API", kind: "request" },
{ id: "edge-core-sync", source: "platform-core", target: "platform-sync", label: "Change Log", kind: "async", bidirectional: true },
{ id: "edge-mcp-core", source: "platform-mcp", target: "platform-core", label: "Governed Access", kind: "request", bidirectional: true },
- { id: "edge-core-model", source: "platform-core", target: "platform-model", label: "Inline AI", kind: "request" },
{ id: "edge-core-sql", source: "platform-core", target: "data-sql", label: "Transactions", kind: "data" },
{ id: "edge-core-objects", source: "platform-core", target: "data-objects", label: "Objects", kind: "data" },
{ id: "edge-sync-search", source: "platform-sync", target: "data-search", label: "Incremental Index", kind: "data" },
{ id: "edge-agents-mcp", source: "ecosystem-agents", target: "platform-mcp", label: "MCP Tools", kind: "request", bidirectional: true },
{ id: "edge-model-gateway", source: "platform-model", target: "ecosystem-models", label: "User-Key Direct", kind: "request", bidirectional: true },
- { id: "edge-apps-mcp", source: "ecosystem-apps", target: "platform-mcp", label: "Automation", kind: "async" },
],
};