# antvis/x6 architecture

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

- Interactive diagram: https://gitdiagram.com/antvis/x6
- Repository: https://github.com/antvis/x6

## Overview

AntV X6 is a customizable, data-driven HTML/SVG graph editor. Its main workflow is a user creating a Graph, adding nodes and edges, then viewing and interacting with the resulting diagram. The runtime separates graph orchestration, model state, rendering/views, geometry, and registries for configurable drawing behavior; plugins provide editing extensions. The README documents capabilities beyond the sampled implementation. Some subsystem links are supported only by the source index or README, so uncertain plugin wiring is left unverified.

Main entry points: [`src/graph/graph.ts`](https://github.com/antvis/x6/blob/master/src/graph/graph.ts) (Graph API), [`src/model/cell.ts`](https://github.com/antvis/x6/blob/master/src/model/cell.ts) (Cell state), [`src/geometry`](https://github.com/antvis/x6/tree/master/src/geometry) (Geometry utilities), [`src/renderer/scheduler.ts`](https://github.com/antvis/x6/blob/master/src/renderer/scheduler.ts) (Render scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_graph["Graph runtime"]
  node_graph_api["Graph API<br/>[graph.ts]"]
  node_graph_options["Graph options<br/>[options.ts]"]
  node_graph_view["Canvas view<br/>[view.ts]"]
  node_graph_events["Graph events<br/>[events.ts]"]
end

subgraph group_model["Graph model"]
  node_model_core["Model<br/>[model.ts]"]
  node_cell["Cell state<br/>[cell.ts]"]
  node_node["Node model<br/>[node.ts]"]
  node_edge["Edge model<br/>[edge.ts]"]
  node_port["Ports<br/>[port.ts]"]
  node_store["Cell store<br/>[store.ts]"]
end

subgraph group_render["Rendering"]
  node_renderer["Render scheduler<br/>[scheduler.ts]"]
  node_cell_view["Cell views<br/>[index.ts]"]
  node_node_view["Node view<br/>[index.ts]"]
  node_edge_view["Edge view<br/>[index.ts]"]
  node_markup["SVG markup<br/>[markup.ts]"]
  node_shapes["Shape primitives"]
end

subgraph group_support["Geometry and extensions"]
  node_registry["Extension registries<br/>[registry.ts]"]
  node_geometry["Geometry utilities"]
  node_plugins["Editing plugins"]
end

node_user(("Application developer"))

node_user -->|"creates graph"| node_graph_api
node_user -->|"adds cells"| node_graph_api
node_graph_api -->|"orchestrates"| node_model_core
node_graph_api -->|"uses scheduler"| node_renderer
node_graph_api -->|"configures view"| node_graph_view
node_graph_api -->|"uses registries"| node_registry
node_graph_api -->|"uses options"| node_graph_options
node_graph_api -->|"uses events"| node_graph_events
node_model_core -->|"manages cells"| node_cell
node_cell -->|"stores properties"| node_store
node_cell -->|"specializes as"| node_node
node_cell -->|"specializes as"| node_edge
node_cell -->|"uses ports"| node_port
node_cell -->|"uses geometry"| node_geometry
node_edge -->|"builds polylines"| node_geometry
node_renderer -->|"schedules views"| node_cell_view
node_cell_view -->|"uses node view"| node_node_view
node_cell_view -->|"uses edge view"| node_edge_view
node_node_view -->|"renders markup"| node_markup
node_edge_view -->|"renders markup"| node_markup
node_node_view -->|"uses geometry"| node_geometry
node_edge_view -->|"routes connections"| node_geometry
node_markup -->|"uses attributes"| node_registry
node_renderer -.->|"renders shapes"| node_shapes
node_graph_api -.->|"supports extensions"| node_plugins

click node_graph_api "https://github.com/antvis/x6/blob/master/src/graph/graph.ts"
click node_graph_options "https://github.com/antvis/x6/blob/master/src/graph/options.ts"
click node_graph_view "https://github.com/antvis/x6/blob/master/src/graph/view.ts"
click node_graph_events "https://github.com/antvis/x6/blob/master/src/graph/events.ts"
click node_model_core "https://github.com/antvis/x6/blob/master/src/model/model.ts"
click node_cell "https://github.com/antvis/x6/blob/master/src/model/cell.ts"
click node_node "https://github.com/antvis/x6/blob/master/src/model/node.ts"
click node_edge "https://github.com/antvis/x6/blob/master/src/model/edge.ts"
click node_port "https://github.com/antvis/x6/blob/master/src/model/port.ts"
click node_store "https://github.com/antvis/x6/blob/master/src/model/store.ts"
click node_renderer "https://github.com/antvis/x6/blob/master/src/renderer/scheduler.ts"
click node_cell_view "https://github.com/antvis/x6/blob/master/src/view/cell/index.ts"
click node_node_view "https://github.com/antvis/x6/blob/master/src/view/node/index.ts"
click node_edge_view "https://github.com/antvis/x6/blob/master/src/view/edge/index.ts"
click node_markup "https://github.com/antvis/x6/blob/master/src/view/markup.ts"
click node_shapes "https://github.com/antvis/x6/tree/master/src/shape"
click node_registry "https://github.com/antvis/x6/blob/master/src/registry/registry.ts"
click node_geometry "https://github.com/antvis/x6/tree/master/src/geometry"
click node_plugins "https://github.com/antvis/x6/tree/master/src/plugin"

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_graph_api,node_graph_options,node_graph_view,node_graph_events toneBlue
class node_model_core,node_cell,node_node,node_edge,node_port,node_store toneAmber
class node_renderer,node_cell_view,node_node_view,node_edge_view,node_markup,node_shapes toneMint
class node_registry,node_geometry,node_plugins toneRose
class node_user toneIndigo
```

## Components

### Graph runtime

- [Graph API](https://github.com/antvis/x6/blob/master/src/graph/graph.ts): `src/graph/graph.ts`
- [Graph options](https://github.com/antvis/x6/blob/master/src/graph/options.ts): `src/graph/options.ts`
- [Canvas view](https://github.com/antvis/x6/blob/master/src/graph/view.ts): `src/graph/view.ts`
- [Graph events](https://github.com/antvis/x6/blob/master/src/graph/events.ts): `src/graph/events.ts`

### Graph model

- [Model](https://github.com/antvis/x6/blob/master/src/model/model.ts): `src/model/model.ts`
- [Cell state](https://github.com/antvis/x6/blob/master/src/model/cell.ts): `src/model/cell.ts`
- [Node model](https://github.com/antvis/x6/blob/master/src/model/node.ts): `src/model/node.ts`
- [Edge model](https://github.com/antvis/x6/blob/master/src/model/edge.ts): `src/model/edge.ts`
- [Ports](https://github.com/antvis/x6/blob/master/src/model/port.ts): `src/model/port.ts`
- [Cell store](https://github.com/antvis/x6/blob/master/src/model/store.ts): `src/model/store.ts`

### Rendering

- [Render scheduler](https://github.com/antvis/x6/blob/master/src/renderer/scheduler.ts): `src/renderer/scheduler.ts`
- [Cell views](https://github.com/antvis/x6/blob/master/src/view/cell/index.ts): `src/view/cell/index.ts`
- [Node view](https://github.com/antvis/x6/blob/master/src/view/node/index.ts): `src/view/node/index.ts`
- [Edge view](https://github.com/antvis/x6/blob/master/src/view/edge/index.ts): `src/view/edge/index.ts`
- [SVG markup](https://github.com/antvis/x6/blob/master/src/view/markup.ts): `src/view/markup.ts`
- [Shape primitives](https://github.com/antvis/x6/tree/master/src/shape): `src/shape`

### Geometry and extensions

- [Extension registries](https://github.com/antvis/x6/blob/master/src/registry/registry.ts): `src/registry/registry.ts`
- [Geometry utilities](https://github.com/antvis/x6/tree/master/src/geometry): `src/geometry`
- [Editing plugins](https://github.com/antvis/x6/tree/master/src/plugin): `src/plugin`

### Other components

- **Application developer**

## Connections

- Application developer → Graph API: creates graph (evidence: `README.md`)
- Application developer → Graph API: adds cells (evidence: `README.md`)
- Graph API → Model: orchestrates (evidence: `src/graph/graph.ts`)
- Graph API → Render scheduler: uses scheduler (evidence: `src/graph/graph.ts`)
- Graph API → Canvas view: configures view (evidence: `src/graph/graph.ts`)
- Graph API → Extension registries: uses registries (evidence: `src/graph/graph.ts`)
- Graph API → Graph options: uses options (evidence: `src/graph/graph.ts`)
- Graph API → Graph events: uses events (evidence: `src/graph/graph.ts`)
- Model → Cell state: manages cells (evidence: `src/model/model.ts`)
- Cell state → Cell store: stores properties (evidence: `src/model/cell.ts`)
- Cell state → Node model: specializes as (evidence: `src/model/cell.ts`)
- Cell state → Edge model: specializes as (evidence: `src/model/cell.ts`)
- Cell state → Ports: uses ports (evidence: `src/model/cell.ts`)
- Cell state → Geometry utilities: uses geometry (evidence: `src/model/cell.ts`)
- Edge model → Geometry utilities: builds polylines (evidence: `src/model/edge.ts`)
- Render scheduler → Cell views: schedules views (evidence: `src/renderer/scheduler.ts`)
- Cell views → Node view: uses node view (evidence: `src/view/cell/index.ts`)
- Cell views → Edge view: uses edge view (evidence: `src/view/cell/index.ts`)
- Node view → SVG markup: renders markup (evidence: `src/view/node/index.ts`)
- Edge view → SVG markup: renders markup (evidence: `src/view/edge/index.ts`)
- Node view → Geometry utilities: uses geometry (evidence: `src/view/node/index.ts`)
- Edge view → Geometry utilities: routes connections (evidence: `src/view/edge/index.ts`)
- SVG markup → Extension registries: uses attributes (evidence: `src/view/markup.ts`)
- Render scheduler → Shape primitives: renders shapes
- Graph API → Editing plugins: supports extensions
