excalidraw-studio

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Excalidraw Studio

Excalidraw 工作室

Generate Excalidraw-format diagrams from natural language descriptions. Outputs
.excalidraw
JSON files that can be opened directly in Excalidraw (web, VS Code extension, or Obsidian plugin).
根据自然语言描述生成Excalidraw格式的图表。输出的.excalidraw JSON文件可直接在Excalidraw(网页端、VS Code扩展或Obsidian插件)中打开。

Workflow

工作流程

UNDERSTAND → CHOOSE TYPE → EXTRACT → GENERATE → SAVE
UNDERSTAND → CHOOSE TYPE → EXTRACT → GENERATE → SAVE

Step 1: Understand the Request

步骤1:理解需求

Analyze the user's description to determine:
  1. Diagram type — Use the decision matrix below
  2. Key elements — Entities, steps, concepts, actors
  3. Relationships — Flow direction, connections, hierarchy
  4. Complexity — Number of elements (target: under 20 for clarity)
分析用户的描述,确定:
  1. 图表类型 — 使用下方的决策矩阵
  2. 核心元素 — 实体、步骤、概念、参与者
  3. 关系 — 流向、连接、层级
  4. 复杂度 — 元素数量(建议不超过20个以保证清晰度)

Step 2: Choose the Diagram Type and Visual Mode

步骤2:选择图表类型与视觉模式

Diagram type:
User IntentDiagram TypeKeywords
Process flow, stepsFlowchart"workflow", "process", "steps"
Connections, dependenciesRelationship"relationship", "connections", "dependencies"
Concept hierarchyMind Map"mind map", "concepts", "breakdown"
System designArchitecture"architecture", "system", "components"
Data movementData Flow (DFD)"data flow", "data processing"
Cross-functional processesSwimlane"business process", "swimlane", "actors"
Object-oriented designClass Diagram"class", "inheritance", "OOP"
Interaction sequencesSequence Diagram"sequence", "interaction", "messages"
Database designER Diagram"database", "entity", "data model"
Visual mode — decide upfront and apply consistently to all elements:
Mode
roughness
fontFamily
When to use
Sketch
1
5
Default — informal, approachable, Excalidraw-native
Clean
0
2
Executive presentations, formal specs
Mixedzones:
0
, shapes:
1
5
Architecture diagrams (structural zones + sketchy shapes)
图表类型:
用户意图图表类型关键词
流程步骤流程图“工作流”“流程”“步骤”
关联与依赖关系图“关系”“连接”“依赖”
概念层级思维导图“思维导图”“概念”“分解”
系统设计架构图“架构”“系统”“组件”
数据流转数据流图(DFD)“数据流”“数据处理”
跨职能流程泳道图“业务流程”“泳道”“参与者”
面向对象设计类图“类”“继承”“OOP”
交互序列序列图“序列”“交互”“消息”
数据库设计ER图“数据库”“实体”“数据模型”
视觉模式 — 提前确定并统一应用于所有元素:
模式
roughness
fontFamily
适用场景
手绘风格
1
5
默认选项 — 非正式、亲切,Excalidraw原生风格
简洁风格
0
2
高管汇报、正式规格文档
混合风格区域:
0
,图形:
1
5
架构图(结构化区域 + 手绘风格图形)

Step 3: Extract Structured Information

步骤3:提取结构化信息

Extract the key components based on diagram type. For each type, identify:
  • Nodes/entities — What are the boxes/shapes?
  • Connections — What connects to what, and with what label?
  • Hierarchy — What contains what, what comes before what?
  • Decision points — Where does the flow branch?
For detailed extraction guidelines per diagram type, read
references/element-types.md
.
根据图表类型提取核心组件。针对每种类型,需明确:
  • 节点/实体 — 哪些是方框/图形?
  • 连接关系 — 元素间如何连接,标签是什么?
  • 层级结构 — 包含关系、先后顺序?
  • 决策点 — 流程在何处分支?
如需了解各图表类型的详细提取指南,请阅读
references/element-types.md

Step 4: Generate the Excalidraw JSON

步骤4:生成Excalidraw JSON

CRITICAL: Read
references/excalidraw-schema.md
before generating your first diagram.
It contains the correct element format, text container model, and binding system.
Key rules for generation:
  1. Text inside shapes — Use
    boundElements
    on the shape and a separate text element with
    containerId
    . Never use a
    label
    shorthand:
    json
    [
      {
        "id": "step-1",
        "type": "rectangle",
        "x": 100, "y": 100, "width": 200, "height": 80,
        "boundElements": [{ "type": "text", "id": "text-step-1" }]
      },
      {
        "id": "text-step-1",
        "type": "text",
        "x": 130, "y": 128, "width": 140, "height": 24,
        "text": "My Step", "originalText": "My Step",
        "fontSize": 20, "fontFamily": 5,
        "textAlign": "center", "verticalAlign": "middle",
        "containerId": "step-1", "lineHeight": 1.25, "roundness": null
      }
    ]
  2. Arrow labels — Also use
    boundElements
    + separate text element with
    containerId
    . Never use a
    label
    shorthand on arrows:
    json
    [
      {
        "id": "arrow-1",
        "type": "arrow",
        "x": 100, "y": 150,
        "points": [[0, 0], [200, 0]],
        "boundElements": [{ "type": "text", "id": "text-arrow-1" }]
      },
      {
        "id": "text-arrow-1",
        "type": "text",
        "x": 160, "y": 132, "width": 80, "height": 18,
        "text": "sends data", "originalText": "sends data",
        "fontSize": 14, "fontFamily": 5,
        "textAlign": "center", "verticalAlign": "middle",
        "containerId": "arrow-1", "lineHeight": 1.25, "roundness": null
      }
    ]
  3. Arrow bindings — Use
    startBinding
    /
    endBinding
    (not
    start
    /
    end
    ). Connected shapes must list the arrow in their
    boundElements
    :
    json
    {
      "id": "shape-1",
      "boundElements": [
        { "type": "text", "id": "text-shape-1" },
        { "type": "arrow", "id": "arrow-1" }
      ]
    }
    json
    {
      "id": "arrow-1",
      "type": "arrow",
      "startBinding": { "elementId": "shape-1", "focus": 0, "gap": 1 },
      "endBinding": { "elementId": "shape-2", "focus": 0, "gap": 1 }
    }
  4. Element order for z-index — Always declare shapes first, arrows second, text elements last. This guarantees text renders on top and is never obscured by arrows or other shapes.
  5. Positioning — Use grid-aligned coordinates (multiples of 20px when
    gridSize: 20
    ). Leave 200-300px horizontal gap, 100-150px vertical gap between elements.
  6. Unique IDs — Every element must have a unique
    id
    . Use descriptive IDs like
    "step-1"
    ,
    "decision-valid"
    ,
    "arrow-1-to-2"
    ,
    "text-step-1"
    .
  7. Colors — Use a consistent palette:
    RoleColorHex
    Primary entitiesLight blue
    #a5d8ff
    Process stepsLight green
    #b2f2bb
    Important/CentralYellow
    #ffd43b
    Warnings/ErrorsLight red
    #ffc9c9
    SecondaryCyan
    #96f2d7
    Default strokeDark
    #1e1e1e
重要提示:生成第一张图表前,请务必阅读
references/excalidraw-schema.md
。该文档包含正确的元素格式、文本容器模型和绑定系统。
生成的核心规则:
  1. 图形内文本 — 在图形上使用
    boundElements
    ,并创建单独的文本元素设置
    containerId
    。切勿使用
    label
    简写:
    json
    [
      {
        "id": "step-1",
        "type": "rectangle",
        "x": 100, "y": 100, "width": 200, "height": 80,
        "boundElements": [{ "type": "text", "id": "text-step-1" }]
      },
      {
        "id": "text-step-1",
        "type": "text",
        "x": 130, "y": 128, "width": 140, "height": 24,
        "text": "My Step", "originalText": "My Step",
        "fontSize": 20, "fontFamily": 5,
        "textAlign": "center", "verticalAlign": "middle",
        "containerId": "step-1", "lineHeight": 1.25, "roundness": null
      }
    ]
  2. 箭头标签 — 同样使用
    boundElements
    + 单独的文本元素设置
    containerId
    。切勿在箭头上使用
    label
    简写:
    json
    [
      {
        "id": "arrow-1",
        "type": "arrow",
        "x": 100, "y": 150,
        "points": [[0, 0], [200, 0]],
        "boundElements": [{ "type": "text", "id": "text-arrow-1" }]
      },
      {
        "id": "text-arrow-1",
        "type": "text",
        "x": 160, "y": 132, "width": 80, "height": 18,
        "text": "sends data", "originalText": "sends data",
        "fontSize": 14, "fontFamily": 5,
        "textAlign": "center", "verticalAlign": "middle",
        "containerId": "arrow-1", "lineHeight": 1.25, "roundness": null
      }
    ]
  3. 箭头绑定 — 使用
    startBinding
    /
    endBinding
    (而非
    start
    /
    end
    )。被连接的图形必须在其
    boundElements
    中列出该箭头:
    json
    {
      "id": "shape-1",
      "boundElements": [
        { "type": "text", "id": "text-shape-1" },
        { "type": "arrow", "id": "arrow-1" }
      ]
    }
    json
    {
      "id": "arrow-1",
      "type": "arrow",
      "startBinding": { "elementId": "shape-1", "focus": 0, "gap": 1 },
      "endBinding": { "elementId": "shape-2", "focus": 0, "gap": 1 }
    }
  4. 元素层级顺序 — 始终先声明图形,再声明箭头,最后声明文本元素。这样可以确保文本显示在最上层,不会被箭头或其他图形遮挡。
  5. 定位 — 使用网格对齐的坐标(当
    gridSize: 20
    时,坐标为20px的倍数)。元素间保留200-300px的水平间距,100-150px的垂直间距。
  6. 唯一ID — 每个元素必须有唯一的
    id
    。使用描述性ID,如
    "step-1"
    "decision-valid"
    "arrow-1-to-2"
    "text-step-1"
  7. 颜色 — 使用统一的调色板:
    角色颜色十六进制值
    主要实体浅蓝色
    #a5d8ff
    流程步骤浅绿色
    #b2f2bb
    重要/核心元素黄色
    #ffd43b
    警告/错误浅红色
    #ffc9c9
    次要元素青色
    #96f2d7
    默认描边深色
    #1e1e1e

Step 5: Save and Present

步骤5:保存与呈现

  1. Save as
    <descriptive-name>.excalidraw
  2. Provide a summary:
    Created: user-workflow.excalidraw
    Type: Flowchart
    Elements: 7 shapes, 6 arrows, 1 title
    Total: 14 elements
    
    To view:
    1. Visit https://excalidraw.com → Open → drag and drop the file
    2. Or use the Excalidraw VS Code extension
    3. Or open in Obsidian with the Excalidraw plugin
  1. 保存为
    <描述性名称>.excalidraw
  2. 提供摘要:
    Created: user-workflow.excalidraw
    Type: Flowchart
    Elements: 7 shapes, 6 arrows, 1 title
    Total: 14 elements
    
    To view:
    1. Visit https://excalidraw.com → Open → drag and drop the file
    2. Or use the Excalidraw VS Code extension
    3. Or open in Obsidian with the Excalidraw plugin

Templates

模板

Pre-built templates are available in
assets/
for quick starting points. Use these when the diagram type matches — they provide correct structure and styling:
TemplateFile
Flowchart
assets/flowchart-template.excalidraw
Relationship
assets/relationship-template.excalidraw
Mind Map
assets/mindmap-template.excalidraw
Data Flow (DFD)
assets/data-flow-diagram-template.excalidraw
Swimlane
assets/business-flow-swimlane-template.excalidraw
Class Diagram
assets/class-diagram-template.excalidraw
Sequence Diagram
assets/sequence-diagram-template.excalidraw
ER Diagram
assets/er-diagram-template.excalidraw
Read a template when creating that diagram type for the first time. Use its structure as a base, then modify elements to match the user's request.
assets/
目录下提供了预构建模板,可作为快速入门的基础。当图表类型匹配时使用这些模板 — 它们提供了正确的结构和样式:
模板文件
流程图
assets/flowchart-template.excalidraw
关系图
assets/relationship-template.excalidraw
思维导图
assets/mindmap-template.excalidraw
数据流图(DFD)
assets/data-flow-diagram-template.excalidraw
泳道图
assets/business-flow-swimlane-template.excalidraw
类图
assets/class-diagram-template.excalidraw
序列图
assets/sequence-diagram-template.excalidraw
ER图
assets/er-diagram-template.excalidraw
首次创建对应类型的图表时,请参考模板。以模板结构为基础,修改元素以匹配用户需求。

Icon Libraries

图标库

For professional architecture diagrams with service icons (AWS, GCP, Azure, etc.), icon libraries can be set up. Read
references/icon-libraries.md
when:
  • User requests an AWS/cloud architecture diagram
  • User mentions wanting specific service icons
  • You need to check if icon libraries are available
如需在专业架构图中使用服务图标(AWS、GCP、Azure等),可配置图标库。当出现以下情况时,请阅读
references/icon-libraries.md
  • 用户要求创建AWS/云架构图
  • 用户提及需要特定服务图标
  • 你需要确认图标库是否可用

Best Practices

最佳实践

Element Count

元素数量

Diagram TypeRecommendedMaximum
Flowchart steps3-1015
Relationship entities3-812
Mind map branches4-68
Sub-topics per branch2-46
If the user's request exceeds maximum, suggest breaking into multiple diagrams:
"Your request includes 15 components. For clarity, I recommend: (1) High-level architecture diagram with 6 main components, (2) Detailed sub-diagrams for each subsystem. Want me to start with the high-level view?"
图表类型推荐数量最大数量
流程图步骤3-1015
关系图实体3-812
思维导图分支4-68
每个分支的子主题2-46
如果用户的需求超过最大数量,建议拆分为多个图表:
“你的需求包含15个组件。为保证清晰度,我建议:(1) 包含6个主要组件的高层级架构图,(2) 每个子系统的详细子图。需要我先从高层级视图开始吗?”

Layout

布局

  • Flow direction: Left-to-right for processes, top-to-bottom for hierarchies
  • Spacing: 200-300px horizontal, 100-150px vertical between elements
  • Grid alignment: Position on multiples of 20px for clean alignment
  • Margins: Minimum 50px from canvas edge
  • Text sizing: 28-36px titles, 18-22px labels, 14-16px annotations
  • Font: Use
    fontFamily: 5
    (Excalifont) for hand-drawn consistency. Fallback to
    1
    (Virgil) if 5 is not supported.
  • Background zones: For architecture diagrams, add semi-transparent dashed zone rectangles (
    opacity: 35
    ,
    strokeStyle: "dashed"
    ,
    roughness: 0
    ) as the first elements in the array to create visual grouping regions. See
    references/excalidraw-schema.md
    → Background Zones.
  • Element order: zones first → shapes → arrows → text elements (ensures correct z-index and text always renders on top)
  • 流向:流程类图表从左到右,层级类图表从上到下
  • 间距:元素间水平间距200-300px,垂直间距100-150px
  • 网格对齐:定位在20px的倍数坐标上,保证对齐整齐
  • 边距:画布边缘至少保留50px边距
  • 文本尺寸:标题28-36px,标签18-22px,注释14-16px
  • 字体:使用
    fontFamily: 5
    (Excalifont)保证手绘风格一致性。如果不支持, fallback到
    1
    (Virgil)。
  • 背景区域:对于架构图,在数组最前面添加半透明虚线区域矩形(
    opacity: 35
    strokeStyle: "dashed"
    roughness: 0
    ),创建视觉分组区域。请参考
    references/excalidraw-schema.md
    → 背景区域。
  • 元素顺序:区域 → 图形 → 箭头 → 文本元素(确保文本始终在最上层)

Common Mistakes to Avoid

需避免的常见错误

  • ❌ Using
    label: { text: "..." }
    shorthand on shapes or arrows — not supported by the Excalidraw parser
  • ❌ Putting
    text
    directly on shape elements without
    containerId
  • ❌ Using
    start
    /
    end
    for arrow bindings — use
    startBinding
    /
    endBinding
    with
    elementId
    /
    focus
    /
    gap
  • ❌ Forgetting to add arrows to their connected shapes'
    boundElements
    arrays
  • ❌ Omitting
    originalText
    ,
    lineHeight
    ,
    autoResize
    , or
    backgroundColor: "transparent"
    from text elements inside containers
  • ❌ Omitting required base properties (
    angle
    ,
    strokeStyle
    ,
    opacity
    ,
    groupIds
    ,
    frameId
    ,
    index
    ,
    isDeleted
    ,
    seed
    ,
    version
    ,
    versionNonce
    ,
    updated
    ,
    link
    ,
    locked
    ) — elements will not render
  • ❌ Missing
    "files": {}
    at the top level of the JSON
  • ❌ Using
    roundness: { "type": 3 }
    on ellipses — ellipses must use
    roundness: null
  • ❌ Missing
    lastCommittedPoint
    ,
    startArrowhead
    ,
    endArrowhead
    on arrows
  • ❌ Declaring text elements before arrows — text renders underneath and gets obscured
  • ❌ Floating arrows without bindings (won't move with shapes)
  • ❌ Overlapping elements (increase spacing)
  • ❌ Inconsistent color usage (define palette upfront)
  • ❌ Too many elements on one diagram (break into sub-diagrams)
  • ❌ 在图形或箭头上使用
    label: { text: "..." }
    简写 — Excalidraw解析器不支持
  • ❌ 在图形元素上直接添加
    text
    而不设置
    containerId
  • ❌ 使用
    start
    /
    end
    进行箭头绑定 — 请使用带
    elementId
    /
    focus
    /
    gap
    startBinding
    /
    endBinding
  • ❌ 忘记在被连接图形的
    boundElements
    数组中添加箭头
  • ❌ 容器内的文本元素遗漏
    originalText
    lineHeight
    autoResize
    backgroundColor: "transparent"
  • ❌ 遗漏必填基础属性(
    angle
    strokeStyle
    opacity
    groupIds
    frameId
    index
    isDeleted
    seed
    version
    versionNonce
    updated
    link
    locked
    ) — 元素将无法渲染
  • ❌ 顶层JSON遗漏
    "files": {}
  • ❌ 在椭圆上使用
    roundness: { "type": 3 }
    — 椭圆必须使用
    roundness: null
  • ❌ 箭头上遗漏
    lastCommittedPoint
    startArrowhead
    endArrowhead
  • ❌ 在箭头之前声明文本元素 — 文本会被遮挡在箭头下方
  • ❌ 未绑定的浮动箭头(无法随图形移动)
  • ❌ 元素重叠(增加间距)
  • ❌ 颜色使用不一致(提前定义调色板)
  • ❌ 单张图表元素过多(拆分为子图)

Validation Checklist

验证清单

Before delivering the diagram, verify:
  • All elements have unique IDs
  • Every element has ALL required base properties:
    angle
    ,
    strokeStyle
    ,
    opacity
    ,
    groupIds
    ,
    frameId
    ,
    index
    ,
    isDeleted
    ,
    link
    ,
    locked
    ,
    seed
    ,
    version
    ,
    versionNonce
    ,
    updated
  • index
    values are assigned in order (
    "a0"
    ,
    "a1"
    , …) with text elements getting higher values than shapes/arrows
  • Top-level JSON includes
    "files": {}
  • Shapes with text use
    boundElements
    + separate text element with
    containerId
  • Text elements inside containers have
    containerId
    ,
    originalText
    ,
    lineHeight: 1.25
    ,
    autoResize: true
    ,
    roundness: null
    ,
    backgroundColor: "transparent"
  • Arrows use
    startBinding
    /
    endBinding
    (with
    elementId
    ,
    focus
    ,
    gap
    ) when connecting shapes, plus
    lastCommittedPoint: null
    ,
    startArrowhead: null
    ,
    endArrowhead: "arrow"
  • Connected shapes list the arrow in their
    boundElements
    arrays
  • Element order: shapes → arrows → text elements (text always on top)
  • Ellipses use
    roundness: null
    (not
    { "type": 3 }
    )
  • Coordinates prevent overlapping (check spacing)
  • Text is readable (font size 16+)
  • Colors follow consistent scheme
  • File is valid JSON
  • Element count is reasonable (<20 for clarity)
交付图表前,请验证:
  • 所有元素都有唯一ID
  • 每个元素都包含所有必填基础属性:
    angle
    strokeStyle
    opacity
    groupIds
    frameId
    index
    isDeleted
    link
    locked
    seed
    version
    versionNonce
    updated
  • index
    值按顺序分配(
    "a0"
    "a1"
    ……),文本元素的
    index
    值高于图形/箭头
  • 顶层JSON包含
    "files": {}
  • 带文本的图形使用
    boundElements
    + 带
    containerId
    的独立文本元素
  • 容器内的文本元素包含
    containerId
    originalText
    lineHeight: 1.25
    autoResize: true
    roundness: null
    backgroundColor: "transparent"
  • 连接图形的箭头使用
    startBinding
    /
    endBinding
    (带
    elementId
    focus
    gap
    ),同时包含
    lastCommittedPoint: null
    startArrowhead: null
    endArrowhead: "arrow"
  • 被连接的图形在其
    boundElements
    数组中列出该箭头
  • 元素顺序:图形 → 箭头 → 文本元素(文本始终在最上层)
  • 椭圆使用
    roundness: null
    (而非
    { "type": 3 }
  • 坐标避免元素重叠(检查间距)
  • 文本可读性良好(字体大小16+)
  • 颜色遵循统一方案
  • 文件是有效的JSON
  • 元素数量合理(少于20个以保证清晰度)

Troubleshooting

故障排除

IssueSolution
Text not showing in shapesUse
boundElements
+ separate text element with
containerId
,
originalText
,
lineHeight
Text hidden behind arrowsMove text elements to end of
elements
array (after all arrows)
Arrows don't move with shapesUse
startBinding
/
endBinding
with
elementId
,
focus: 0
,
gap: 1
Shape not moving with arrowsAdd the arrow to the shape's
boundElements
array
Elements overlapIncrease spacing between coordinates
Text doesn't fitIncrease shape width or reduce font size
Too many elementsBreak into multiple diagrams
Colors look inconsistentDefine color palette upfront, apply consistently
问题解决方案
图形内文本不显示使用
boundElements
+ 带
containerId
originalText
lineHeight
的独立文本元素
文本被箭头遮挡将文本元素移至
elements
数组末尾(所有箭头之后)
箭头无法随图形移动使用带
elementId
focus: 0
gap: 1
startBinding
/
endBinding
图形无法随箭头移动将箭头添加到图形的
boundElements
数组
元素重叠增加坐标间距
文本无法容纳增加图形宽度或减小字体大小
元素过多拆分为多个图表
颜色不一致提前定义调色板并统一应用

Limitations

局限性

  • Complex curves are simplified to straight/basic curved lines
  • Hand-drawn roughness is set to default (1)
  • No embedded images in auto-generation (use icon libraries for service icons)
  • Maximum recommended: 20 elements per diagram for clarity
  • No automatic collision detection — use spacing guidelines
  • 复杂曲线会简化为直线/基础曲线
  • 手绘粗糙度默认设置为1
  • 自动生成中不支持嵌入图片(使用图标库添加服务图标)
  • 为保证清晰度,单张图表最多推荐20个元素
  • 无自动碰撞检测 — 请遵循间距指南