Skip to content

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

feat(demo): redesign architecture example

tianma-if66fdc6507cc0
diff --git a/apps/api/src/demo-seed-data.test.mjs b/apps/api/src/demo-seed-data.test.mjs
index 54ea2031..8c285576 100644
--- a/apps/api/src/demo-seed-data.test.mjs
+++ b/apps/api/src/demo-seed-data.test.mjs
@@ -47,6 +47,28 @@ describe("demo seed catalog", () => {
}
});
+ test("keeps every architecture component inside its labeled system boundary", () => {
+ for (const memoId of ["memo_demo_architecture", "memo_demo_architecture_en"]) {
+ const memo = DEMO_SEED_MEMOS.find((candidate) => candidate.id === memoId);
+ const diagram = parseDiagramDocument(memo?.markdown);
+ expect(diagram).toMatchObject({ kind: "architecture" });
+ expect(diagram?.nodes).toHaveLength(20);
+ expect(diagram?.edges).toHaveLength(15);
+
+ const boundaries = new Map(
+ diagram?.nodes.filter((node) => node.shape === "boundary").map((node) => [node.id, node]),
+ );
+ for (const node of diagram?.nodes.filter((candidate) => candidate.parentId) ?? []) {
+ const boundary = boundaries.get(node.parentId);
+ expect(boundary).toBeDefined();
+ expect(node.x).toBeGreaterThanOrEqual(boundary.x);
+ expect(node.y).toBeGreaterThanOrEqual(boundary.y);
+ expect(node.x + node.width).toBeLessThanOrEqual(boundary.x + boundary.width);
+ expect(node.y + node.height).toBeLessThanOrEqual(boundary.y + boundary.height);
+ }
+ }
+ });
+
test("keeps every seeded resource decodable and owned by a seeded memo", () => {
const memoIds = new Set(DEMO_SEED_MEMOS.map((memo) => memo.id));
const resourceIds = new Set();
diff --git a/apps/api/src/demo-seed-data.ts b/apps/api/src/demo-seed-data.ts
index d9d3f2be..bb7a001d 100644
--- a/apps/api/src/demo-seed-data.ts
+++ b/apps/api/src/demo-seed-data.ts
@@ -22,41 +22,47 @@ export const DEMO_ARCHITECTURE_DIAGRAM_ZH: DiagramDocument = {
schemaVersion: 2,
kind: "architecture",
nodes: [
- { id: "boundary-clients", label: "全端客户端矩阵", x: 40, y: 48, width: 220, height: 490, shape: "boundary" },
- { id: "boundary-cloud", label: "Serverless 核心服务层", x: 320, y: 48, width: 500, height: 490, shape: "boundary" },
- { id: "boundary-ai", label: "AI 智能体与外部生态", x: 880, y: 48, width: 220, height: 490, shape: "boundary" },
-
- { id: "client-web", label: "Web / PWA\n离线草稿 & 增量同步", x: 68, y: 104, width: 164, height: 68, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
- { id: "client-desktop", label: "macOS / Windows\n桌面客户端", x: 68, y: 200, width: 164, height: 68, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
- { id: "client-mobile", label: "iOS / Android\n原生客户端", x: 68, y: 296, width: 164, height: 68, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
- { id: "client-clipper", label: "浏览器剪藏扩展\nChrome / Edge", x: 68, y: 392, width: 164, height: 68, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
-
- { id: "srv-api", label: "Hono API 引擎\nCloudflare Workers", x: 352, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "serverless", parentId: "boundary-cloud" },
- { id: "srv-mcp", label: "原生 MCP 端点\n/mcp 智能体服务", x: 352, y: 320, width: 164, height: 68, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-cloud" },
- { id: "db-d1", label: "D1 SQLite 数据库\n双向同步与版本链", x: 616, y: 140, width: 164, height: 72, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-cloud" },
- { id: "db-r2", label: "R2 对象存储\n图片与多媒体附件", x: 616, y: 260, width: 164, height: 68, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-cloud" },
- { id: "db-vector", label: "向量检索与缓存\n语义索引层", x: 616, y: 380, width: 164, height: 72, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-cloud" },
-
- { id: "ai-coding", label: "Claude / Cursor\n编码智能体", x: 908, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "largeLanguageModel", parentId: "boundary-ai" },
- { id: "ai-antigravity", label: "Antigravity Agent\n系统级协同", x: 908, y: 240, width: 164, height: 68, shape: "service", resourceIcon: "aiAgent", parentId: "boundary-ai" },
- { id: "ai-inline", label: "行内智能助手\nBYOK 密钥直连", x: 908, y: 340, width: 164, height: 68, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-ai" },
+ { 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" },
],
edges: [
- { id: "edge-web-api", source: "client-web", target: "srv-api", label: "HTTPS / 同步游标", kind: "request" },
- { id: "edge-desktop-api", source: "client-desktop", target: "srv-api", kind: "request" },
- { id: "edge-mobile-api", source: "client-mobile", target: "srv-api", kind: "request" },
- { id: "edge-clipper-api", source: "client-clipper", target: "srv-api", kind: "request" },
-
- { id: "edge-api-d1", source: "srv-api", target: "db-d1", label: "事务与版本读写", kind: "data" },
- { id: "edge-api-r2", source: "srv-api", target: "db-r2", label: "S3 资源存取", kind: "data" },
- { id: "edge-api-vec", source: "srv-api", target: "db-vector", kind: "data" },
-
- { id: "edge-mcp-d1", source: "srv-mcp", target: "db-d1", kind: "data" },
- { id: "edge-mcp-vec", source: "srv-mcp", target: "db-vector", kind: "data" },
-
- { id: "edge-coding-mcp", source: "ai-coding", target: "srv-mcp", label: "MCP Tools / SSE", kind: "request", bidirectional: true },
- { id: "edge-antigravity-mcp", source: "ai-antigravity", target: "srv-mcp", kind: "request", bidirectional: true },
- { id: "edge-inline-client", source: "ai-inline", target: "client-web", label: "端侧隐私直连", kind: "async" },
+ { 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-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" },
],
};
@@ -64,41 +70,47 @@ export const DEMO_ARCHITECTURE_DIAGRAM_EN: DiagramDocument = {
schemaVersion: 2,
kind: "architecture",
nodes: [
- { id: "boundary-clients", label: "Client Matrix", x: 40, y: 48, width: 220, height: 490, shape: "boundary" },
- { id: "boundary-cloud", label: "Serverless Core Engine", x: 320, y: 48, width: 500, height: 490, shape: "boundary" },
- { id: "boundary-ai", label: "AI Agents & Ecosystem", x: 880, y: 48, width: 220, height: 490, shape: "boundary" },
-
- { id: "client-web", label: "Web / PWA\nOffline Drafts & Sync", x: 68, y: 104, width: 164, height: 68, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
- { id: "client-desktop", label: "macOS / Windows\nDesktop App", x: 68, y: 200, width: 164, height: 68, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
- { id: "client-mobile", label: "iOS / Android\nNative App", x: 68, y: 296, width: 164, height: 68, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
- { id: "client-clipper", label: "Web Clipper\nChrome / Edge", x: 68, y: 392, width: 164, height: 68, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
-
- { id: "srv-api", label: "Hono API Engine\nCloudflare Workers", x: 352, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "serverless", parentId: "boundary-cloud" },
- { id: "srv-mcp", label: "Native MCP Endpoint\n/mcp Agent Service", x: 352, y: 320, width: 164, height: 68, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-cloud" },
- { id: "db-d1", label: "D1 SQLite Database\nSync & Revisions", x: 616, y: 140, width: 164, height: 72, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-cloud" },
- { id: "db-r2", label: "R2 Object Storage\nImages & Attachments", x: 616, y: 260, width: 164, height: 68, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-cloud" },
- { id: "db-vector", label: "Vector Search & Cache\nSemantic Index Layer", x: 616, y: 380, width: 164, height: 72, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-cloud" },
-
- { id: "ai-coding", label: "Claude / Cursor\nCoding Agents", x: 908, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "largeLanguageModel", parentId: "boundary-ai" },
- { id: "ai-antigravity", label: "Antigravity Agent\nSystem Co-pilot", x: 908, y: 240, width: 164, height: 68, shape: "service", resourceIcon: "aiAgent", parentId: "boundary-ai" },
- { id: "ai-inline", label: "Inline AI Assistant\nBYOK Privacy Direct", x: 908, y: 340, width: 164, height: 68, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-ai" },
+ { 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" },
],
edges: [
- { id: "edge-web-api", source: "client-web", target: "srv-api", label: "HTTPS / Sync Cursor", kind: "request" },
- { id: "edge-desktop-api", source: "client-desktop", target: "srv-api", kind: "request" },
- { id: "edge-mobile-api", source: "client-mobile", target: "srv-api", kind: "request" },
- { id: "edge-clipper-api", source: "client-clipper", target: "srv-api", kind: "request" },
-
- { id: "edge-api-d1", source: "srv-api", target: "db-d1", label: "Transactions & Log", kind: "data" },
- { id: "edge-api-r2", source: "srv-api", target: "db-r2", label: "S3 Asset Access", kind: "data" },
- { id: "edge-api-vec", source: "srv-api", target: "db-vector", kind: "data" },
-
- { id: "edge-mcp-d1", source: "srv-mcp", target: "db-d1", kind: "data" },
- { id: "edge-mcp-vec", source: "srv-mcp", target: "db-vector", kind: "data" },
-
- { id: "edge-coding-mcp", source: "ai-coding", target: "srv-mcp", label: "MCP Tools / SSE", kind: "request", bidirectional: true },
- { id: "edge-antigravity-mcp", source: "ai-antigravity", target: "srv-mcp", kind: "request", bidirectional: true },
- { id: "edge-inline-client", source: "ai-inline", target: "client-web", label: "Client-side BYOK", kind: "async" },
+ { 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-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" },
],
};
@@ -431,8 +443,8 @@ sequenceDiagram
{
id: "memo_demo_architecture",
notebookId: "nb_demo_features",
- title: "🏗️ 架构全景:EdgeEver 全端协同与云原生 Serverless 架构图",
- tags: ["architecture", "diagram", "serverless", "cloud-native", "mcp"],
+ title: "🏗️ 系统架构:EdgeEver 可移植全栈与 AI 协同",
+ tags: ["architecture", "diagram", "portable-runtime", "cloud-native", "mcp"],
isPinned: false,
markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_ZH),
},
@@ -475,14 +487,14 @@ export const DEMO_SEED_REVISIONS = [
id: "rev_demo_architecture_1",
memoId: "memo_demo_architecture",
revision: 1,
- title: "🏗️ 架构全景:EdgeEver 全端协同与云原生 Serverless 架构图",
+ title: "🏗️ 系统架构:EdgeEver 可移植全栈与 AI 协同",
markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_ZH),
},
{
id: "rev_demo_architecture_1_en",
memoId: "memo_demo_architecture_en",
revision: 1,
- title: "🏗️ System Topology: EdgeEver Multi-Client & Serverless Architecture",
+ title: "🏗️ System Architecture: EdgeEver Portable Full Stack & AI Collaboration",
markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_EN),
},
];
@@ -686,7 +698,7 @@ Export your entire library at any time from **Profile → Import and export**. T
`,
},
memo_demo_architecture: {
- title: "🏗️ System Topology: EdgeEver Multi-Client & Serverless Architecture",
+ title: "🏗️ System Architecture: EdgeEver Portable Full Stack & AI Collaboration",
markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_EN),
},
memo_demo_flowchart: {