# wanglin2/mind-map architecture

> Architecture diagram of the GitHub repository wanglin2/mind-map, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wanglin2/mind-map
- Repository: https://github.com/wanglin2/mind-map

## Overview

#### Purpose and deployable surfaces
This repository contains an open-source framework-agnostic JavaScript mind-map engine plus a Vue 2 browser editor built on it. The engine is published from `simple-mind-map/index.js` (with `simple-mind-map/full.js` as a broader bundle entry); the application starts at `web/src/main.js` and mounts `web/src/App.vue`. Prebuilt static output is committed under `dist/` and can be served through `nginx.conf` or `Dockerfile`.

#### Application shell and editor orchestration
Vue provides routing, global state, localization, and the editor workspace. `web/src/router.js` selects document/editor pages; `web/src/store.js` holds UI/application state; `web/src/pages/Edit/Index.vue` composes the interactive editor. `web/src/pages/Edit/components/Edit.vue` is the main boundary between UI controls and the mind-map library, while toolbars, sidebars, import/export, and context menus invoke library APIs.

#### Core mind-map runtime
The library’s core coordinates stateful editing, events, rendering, and viewport behavior:
- `simple-mind-map/src/core/command/Command.js`
- `simple-mind-map/src/core/event/Event.js`
- `simple-mind-map/src/core/render/Render.js`
- `simple-mind-map/src/core/view/View.js`

Commands mediate mutations and keyboard actions; events distribute interaction/lifecycle signals; rendering transforms map data into visual nodes and connections; the view manages canvas/SVG viewport navigation such as pan and zoom.

#### Node model, visual construction, and editing
Node rendering is decomposed into a central node object plus shape, style, layout, content, expansion, and interaction concerns. Key paths are:
- `simple-mind-map/src/core/render/node/MindMapNode.js`
- `simple-mind-map/src/core/render/node/Shape.js`
- `simple-mind-map/src/core/render/node/Style.js`

This is the primary boundary where structured node data and theme/options become editable visual objects. `TextEdit.js` handles in-place text editing, while node command wrappers and cooperative helpers connect visual actions back to command-driven state changes.

#### Layout and presentation pipeline
Layouts calculate node positions and connector geometry independently of the UI. The shared contract begins at `simple-mind-map/src/layouts/Base.js`; concrete topology implementations include:
- `simple-mind-map/src/layouts/MindMap.js`
- `simple-mind-map/src/layouts/LogicalStructure.js`
- `simple-mind-map/src/layouts/Fishbone.js`

The render pipeline selects a layout based on map options, computes placement, then renders nodes/lines. Themes provide the default visual policy through `simple-mind-map/src/theme/index.js` and `simple-mind-map/src/theme/default.js`.

#### Extensibility, formats, and integrations
Optional capabilities are library plugins, installed by consumers rather than embedded in core. Architecturally significant plugins include interaction/export and rich map annotations:
- `simple-mind-map/src/plugins/Drag.js`
- `simple-mind-map/src/plugins/Export.js`
- `simple-mind-map/src/plugins/ExportXMind.js`

Import/export converters form a separate data boundary for Markdown, text, and XMind: `simple-mind-map/src/parse/markdown.js`, `simple-mind-map/src/parse/toMarkdown.js`, and `simple-mind-map/src/parse/xmind.js`. The Vue app exposes these through `web/src/pages/Edit/components/Import.vue` and `web/src/pages/Edit/components/Export.vue`.

#### Runtime boundaries and external services
The shipped product is a client-side web application: browser DOM/canvas/SVG APIs, Vue 2, and Element UI are material runtime dependencies. There is no server implementation in this tree. `web/src/api/index.js` and AI-facing UI (`web/src/pages/Edit/components/AiChat.vue`, `AiCreate.vue`) represent an outbound API boundary; deployment is static assets behind Nginx. Closed-source desktop, Obsidian, and uTools products referenced by the README are not implemented here.

Main entry points: [`simple-mind-map/src/core/render/Render.js`](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/Render.js) (Renderer), [`web/src/pages/Edit/Index.vue`](https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/Index.vue) (Editor workspace), [`simple-mind-map/src/core/command/Command.js`](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/command/Command.js) (Commands), [`simple-mind-map/src/core/render/node/MindMapNode.js`](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/node/MindMapNode.js) (Mind-map node)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Vue editor"]
  node_app_main["App bootstrap<br/>Vue entry<br/>[main.js]"]
  node_app_shell["App shell<br/>Vue root<br/>[App.vue]"]
  node_router["Router<br/>Vue routing<br/>[router.js]"]
  node_store["Global state<br/>Vue state<br/>[store.js]"]
  node_editor_page["Editor workspace<br/>Vue page<br/>[Index.vue]"]
  node_editor_bridge["Editor bridge<br/>library adapter<br/>[Edit.vue]"]
  node_import_ui["Import UI<br/>Vue component<br/>[Import.vue]"]
  node_export_ui["Export UI<br/>Vue component<br/>[Export.vue]"]
  node_api_boundary{{"Outbound API<br/>external API boundary<br/>[index.js]"}}
end

subgraph group_engine["Mind-map engine"]
  node_engine_entry["Library entry<br/>package entry<br/>[index.js]"]
  node_engine_full["Full bundle<br/>package entry<br/>[full.js]"]
  node_command["Commands<br/>mutation layer<br/>[Command.js]"]
  node_event["Events<br/>event bus<br/>[Event.js]"]
  node_render["Renderer<br/>render pipeline<br/>[Render.js]"]
  node_view["Viewport<br/>view controller<br/>[View.js]"]
  node_mindmap_node["Mind-map node<br/>visual node<br/>[MindMapNode.js]"]
  node_node_shape["Node shape<br/>node presentation<br/>[Shape.js]"]
  node_node_style["Node style<br/>node presentation<br/>[Style.js]"]
  node_layouts["Layout strategies<br/>layout contract<br/>[Base.js]"]
  node_mindmap_layout["Mind-map layout<br/>layout strategy<br/>[MindMap.js]"]
  node_logical_layout["Logical layout<br/>layout strategy"]
  node_fishbone_layout["Fishbone layout<br/>layout strategy<br/>[Fishbone.js]"]
  node_themes["Themes<br/>visual policy<br/>[index.js]"]
  node_plugins["Optional plugins<br/>extension layer<br/>[Drag.js]"]
  node_formats["Format converters<br/>data boundary<br/>[markdown.js]"]
end

subgraph group_delivery["Delivery"]
  node_static_output["Static assets<br/>built output"]
  node_nginx["Nginx serving<br/>static server config<br/>[nginx.conf]"]
end

node_engine_entry -->|"exposes"| node_command
node_engine_entry -->|"exposes"| node_render
node_engine_full -->|"includes extensions"| node_plugins
node_command -->|"emits changes"| node_event
node_command -->|"drives updates"| node_render
node_render -->|"constructs"| node_mindmap_node
node_render -->|"selects"| node_layouts
node_render -->|"applies"| node_themes
node_render -->|"renders in"| node_view
node_mindmap_node -->|"uses"| node_node_shape
node_mindmap_node -->|"uses"| node_node_style
node_mindmap_node -->|"edits through"| node_command
node_layouts -->|"implements"| node_mindmap_layout
node_layouts -->|"implements"| node_logical_layout
node_layouts -->|"implements"| node_fishbone_layout
node_plugins -.->|"extends"| node_command
node_plugins -.->|"exports formats"| node_formats
node_app_main -->|"mounts"| node_app_shell
node_app_shell -->|"uses"| node_router
node_app_shell -->|"uses"| node_store
node_router -->|"routes to"| node_editor_page
node_editor_page -->|"composes"| node_editor_bridge
node_editor_page -->|"includes"| node_import_ui
node_editor_page -->|"includes"| node_export_ui
node_editor_bridge -->|"uses engine APIs"| node_engine_entry
node_import_ui -->|"imports via"| node_formats
node_export_ui -->|"exports via"| node_formats
node_editor_page -.->|"AI requests"| node_api_boundary
node_static_output -->|"served by"| node_nginx

click node_engine_entry "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/index.js"
click node_engine_full "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/full.js"
click node_command "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/command/Command.js"
click node_event "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/event/Event.js"
click node_render "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/Render.js"
click node_view "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/view/View.js"
click node_mindmap_node "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/node/MindMapNode.js"
click node_node_shape "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/node/Shape.js"
click node_node_style "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/node/Style.js"
click node_layouts "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/Base.js"
click node_mindmap_layout "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/MindMap.js"
click node_logical_layout "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/LogicalStructure.js"
click node_fishbone_layout "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/Fishbone.js"
click node_themes "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/theme/index.js"
click node_plugins "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/plugins/Drag.js"
click node_formats "https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/parse/markdown.js"
click node_app_main "https://github.com/wanglin2/mind-map/blob/main/web/src/main.js"
click node_app_shell "https://github.com/wanglin2/mind-map/blob/main/web/src/App.vue"
click node_router "https://github.com/wanglin2/mind-map/blob/main/web/src/router.js"
click node_store "https://github.com/wanglin2/mind-map/blob/main/web/src/store.js"
click node_editor_page "https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/Index.vue"
click node_editor_bridge "https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/Edit.vue"
click node_import_ui "https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/Import.vue"
click node_export_ui "https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/Export.vue"
click node_api_boundary "https://github.com/wanglin2/mind-map/blob/main/web/src/api/index.js"
click node_nginx "https://github.com/wanglin2/mind-map/blob/main/nginx.conf"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_main,node_app_shell,node_router,node_store,node_editor_page,node_editor_bridge,node_import_ui,node_export_ui,node_api_boundary toneBlue
class node_engine_entry,node_engine_full,node_command,node_event,node_render,node_view,node_mindmap_node,node_node_shape,node_node_style,node_layouts,node_mindmap_layout,node_logical_layout,node_fishbone_layout,node_themes,node_plugins,node_formats toneAmber
class node_static_output,node_nginx toneMint
```

## Components

### Vue editor

Browser editor application.

- [App bootstrap](https://github.com/wanglin2/mind-map/blob/main/web/src/main.js): Vue entry · `web/src/main.js`
- [App shell](https://github.com/wanglin2/mind-map/blob/main/web/src/App.vue): Vue root · `web/src/App.vue`
- [Router](https://github.com/wanglin2/mind-map/blob/main/web/src/router.js): Vue routing · `web/src/router.js`
- [Global state](https://github.com/wanglin2/mind-map/blob/main/web/src/store.js): Vue state · `web/src/store.js`
- [Editor workspace](https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/Index.vue): Vue page · Composes the interactive editor. · `web/src/pages/Edit/Index.vue`
- [Editor bridge](https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/Edit.vue): library adapter · Connects UI controls to mind-map APIs. · `web/src/pages/Edit/components/Edit.vue`
- [Import UI](https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/Import.vue): Vue component · `web/src/pages/Edit/components/Import.vue`
- [Export UI](https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/Export.vue): Vue component · `web/src/pages/Edit/components/Export.vue`
- [Outbound API](https://github.com/wanglin2/mind-map/blob/main/web/src/api/index.js): external API boundary · Used by AI-facing editor UI. · `web/src/api/index.js`

### Mind-map engine

Framework-agnostic runtime and extensions.

- [Library entry](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/index.js): package entry · Published engine entry point. · `simple-mind-map/index.js`
- [Full bundle](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/full.js): package entry · Broader published bundle. · `simple-mind-map/full.js`
- [Commands](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/command/Command.js): mutation layer · Mediates edits and keyboard actions. · `simple-mind-map/src/core/command/Command.js`
- [Events](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/event/Event.js): event bus · Distributes interaction and lifecycle signals. · `simple-mind-map/src/core/event/Event.js`
- [Renderer](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/Render.js): render pipeline · Builds nodes and connections from map data. · `simple-mind-map/src/core/render/Render.js`
- [Viewport](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/view/View.js): view controller · Manages pan and zoom. · `simple-mind-map/src/core/view/View.js`
- [Mind-map node](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/node/MindMapNode.js): visual node · Editable visual representation of structured node data. · `simple-mind-map/src/core/render/node/MindMapNode.js`
- [Node shape](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/node/Shape.js): node presentation · `simple-mind-map/src/core/render/node/Shape.js`
- [Node style](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/render/node/Style.js): node presentation · `simple-mind-map/src/core/render/node/Style.js`
- [Layout strategies](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/Base.js): layout contract · Shared topology contract with mind-map, logical, and fishbone layouts. · `simple-mind-map/src/layouts/Base.js`
- [Mind-map layout](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/MindMap.js): layout strategy · `simple-mind-map/src/layouts/MindMap.js`
- [Logical layout](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/LogicalStructure.js): layout strategy · `simple-mind-map/src/layouts/LogicalStructure.js`
- [Fishbone layout](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/layouts/Fishbone.js): layout strategy · `simple-mind-map/src/layouts/Fishbone.js`
- [Themes](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/theme/index.js): visual policy · Default theme policy. · `simple-mind-map/src/theme/index.js`
- [Optional plugins](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/plugins/Drag.js): extension layer · Consumer-installed interaction and export capabilities. · `simple-mind-map/src/plugins/Drag.js`
- [Format converters](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/parse/markdown.js): data boundary · Markdown, text, and XMind conversion. · `simple-mind-map/src/parse/markdown.js`

### Delivery

Static deployment boundary.

- **Static assets**: built output · Committed browser deployment output.
- [Nginx serving](https://github.com/wanglin2/mind-map/blob/main/nginx.conf): static server config · `nginx.conf`

## Connections

- Library entry → Commands: exposes
- Library entry → Renderer: exposes
- Full bundle → Optional plugins: includes extensions
- Commands → Events: emits changes
- Commands → Renderer: drives updates
- Renderer → Mind-map node: constructs
- Renderer → Layout strategies: selects
- Renderer → Themes: applies
- Renderer → Viewport: renders in
- Mind-map node → Node shape: uses
- Mind-map node → Node style: uses
- Mind-map node → Commands: edits through
- Layout strategies → Mind-map layout: implements
- Layout strategies → Logical layout: implements
- Layout strategies → Fishbone layout: implements
- Optional plugins → Commands: extends
- Optional plugins → Format converters: exports formats
- App bootstrap → App shell: mounts
- App shell → Router: uses
- App shell → Global state: uses
- Router → Editor workspace: routes to
- Editor workspace → Editor bridge: composes
- Editor workspace → Import UI: includes
- Editor workspace → Export UI: includes
- Editor bridge → Library entry: uses engine APIs
- Import UI → Format converters: imports via
- Export UI → Format converters: exports via
- Editor workspace → Outbound API: AI requests
- Static assets → Nginx serving: served by
