# jgraph/drawio architecture

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

- Interactive diagram: https://gitdiagram.com/jgraph/drawio
- Repository: https://github.com/jgraph/drawio

## Overview

draw.io is a browser-based diagramming and whiteboarding application. A user opens the editor, manipulates a graph, applies layout and routing behavior, then saves or exports the resulting diagram. Storage supports browser-backed files and multiple cloud providers; the tree also shows importers, stencil libraries, authentication servlets, and offline caching. The graph emphasizes sampled runtime relationships and documents unsampled integrations by their exact enclosing paths; some optional provider links are therefore dashed.

Main entry points: [`src/main/webapp/js/diagramly/EditorUi.js`](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/EditorUi.js) (Editor UI), [`src/main/webapp/mxgraph/src/view/mxGraph.js`](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/view/mxGraph.js) (Graph Engine), [`src/main/webapp/js/diagramly/StorageFile.js`](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/StorageFile.js) (File Persistence), [`src/main/webapp/js/diagramly/App.js`](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/App.js) (Application Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Editor Entry"]
  node_app["Application Shell<br/>[App.js]"]
  node_editor_ui["Editor UI<br/>[EditorUi.js]"]
  node_editor["Editor Controller<br/>[Editor.js]"]
end

subgraph group_graph["Graph Editing"]
  node_graph_engine["Graph Engine<br/>[mxGraph.js]"]
  node_edge_handler["Edge Editing<br/>[mxEdgeHandler.js]"]
  node_layout_manager["Automatic Layout<br/>[mxLayoutManager.js]"]
  node_swimlane_manager["Swimlane Sizing"]
  node_undo_manager["Undo History<br/>[mxUndoManager.js]"]
  node_routing["Edge Routing"]
end

subgraph group_content["Content Features"]
  node_sidebar["Stencil Palettes<br/>[Sidebar.js]"]
  node_importers["Diagram Importers<br/>[vsdxImporter.js]"]
  node_exporter["Diagram Export<br/>[export.js]"]
end

subgraph group_storage["Storage Integrations"]
  node_storage_file["File Persistence<br/>[StorageFile.js]"]
  node_storage_library["Library Persistence<br/>[StorageLibrary.js]"]
  node_drive_client["Drive Storage<br/>[DriveClient.js]"]
  node_dropbox_client["Dropbox Storage<br/>[DropboxClient.js]"]
  node_github_client["GitHub Storage<br/>[GitHubClient.js]"]
  node_gitlab_client["GitLab Storage<br/>[GitLabClient.js]"]
  node_onedrive_client["OneDrive Storage<br/>[OneDriveClient.js]"]
end

subgraph group_platform["Platform Services"]
  node_browser_storage[("Browser Storage")]
  node_service_worker["Offline Cache<br/>[service-worker.js]"]
  node_auth_servlets["Auth Servlets"]
end

node_user(("Diagram User"))
node_cloud_services["Cloud Providers"]
node_identity_services["Identity Providers"]
node_browser(("Web Browser"))

node_user -->|"opens editor"| node_app
node_app -->|"starts UI"| node_editor_ui
node_editor_ui -->|"controls editor"| node_editor
node_editor -->|"edits graph"| node_graph_engine
node_graph_engine -->|"creates handlers"| node_edge_handler
node_graph_engine -->|"dispatches changes"| node_layout_manager
node_graph_engine -->|"dispatches changes"| node_swimlane_manager
node_graph_engine -->|"emits edits"| node_undo_manager
node_edge_handler -->|"routes edges"| node_routing
node_editor_ui -->|"loads palettes"| node_sidebar
node_editor_ui -->|"imports diagrams"| node_importers
node_editor_ui -->|"exports diagrams"| node_exporter
node_editor_ui -->|"saves files"| node_storage_file
node_storage_file -->|"reads writes"| node_browser_storage
node_storage_library -->|"specializes persistence"| node_storage_file
node_editor_ui -.->|"uses storage"| node_drive_client
node_editor_ui -.->|"uses storage"| node_dropbox_client
node_editor_ui -.->|"uses storage"| node_github_client
node_editor_ui -.->|"uses storage"| node_gitlab_client
node_editor_ui -.->|"uses storage"| node_onedrive_client
node_drive_client -.->|"syncs files"| node_cloud_services
node_dropbox_client -.->|"syncs files"| node_cloud_services
node_github_client -.->|"syncs files"| node_cloud_services
node_gitlab_client -.->|"syncs files"| node_cloud_services
node_onedrive_client -.->|"syncs files"| node_cloud_services
node_auth_servlets -.->|"authenticates users"| node_identity_services
node_browser -->|"runs worker"| node_service_worker
node_service_worker -->|"caches assets"| node_browser_storage

click node_app "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/App.js"
click node_editor_ui "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/EditorUi.js"
click node_editor "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/Editor.js"
click node_graph_engine "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/view/mxGraph.js"
click node_edge_handler "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js"
click node_layout_manager "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/view/mxLayoutManager.js"
click node_swimlane_manager "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/view/mxSwimlaneManager.js"
click node_undo_manager "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/util/mxUndoManager.js"
click node_routing "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/libavoid-js/libavoid-routing.js"
click node_sidebar "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/sidebar/Sidebar.js"
click node_importers "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/vsdxImporter.js"
click node_exporter "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/export.js"
click node_storage_file "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/StorageFile.js"
click node_storage_library "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/StorageLibrary.js"
click node_drive_client "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/DriveClient.js"
click node_dropbox_client "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/DropboxClient.js"
click node_github_client "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/GitHubClient.js"
click node_gitlab_client "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/GitLabClient.js"
click node_onedrive_client "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/OneDriveClient.js"
click node_service_worker "https://github.com/jgraph/drawio/blob/dev/src/main/webapp/service-worker.js"
click node_auth_servlets "https://github.com/jgraph/drawio/blob/dev/src/main/server/java/com/mxgraph/online/GoogleAuthServlet.java"

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,node_editor_ui,node_editor,node_user,node_browser toneBlue
class node_graph_engine,node_edge_handler,node_layout_manager,node_swimlane_manager,node_undo_manager,node_routing toneAmber
class node_sidebar,node_importers,node_exporter toneMint
class node_storage_file,node_storage_library,node_drive_client,node_dropbox_client,node_github_client,node_gitlab_client,node_onedrive_client toneRose
class node_browser_storage,node_service_worker,node_auth_servlets,node_cloud_services,node_identity_services toneIndigo
```

## Components

### Editor Entry

- [Application Shell](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/App.js): `src/main/webapp/js/diagramly/App.js`
- [Editor UI](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/EditorUi.js): `src/main/webapp/js/diagramly/EditorUi.js`
- [Editor Controller](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/Editor.js): `src/main/webapp/js/diagramly/Editor.js`

### Graph Editing

- [Graph Engine](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/view/mxGraph.js): `src/main/webapp/mxgraph/src/view/mxGraph.js`
- [Edge Editing](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js): `src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js`
- [Automatic Layout](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/view/mxLayoutManager.js): `src/main/webapp/mxgraph/src/view/mxLayoutManager.js`
- [Swimlane Sizing](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/view/mxSwimlaneManager.js): `src/main/webapp/mxgraph/src/view/mxSwimlaneManager.js`
- [Undo History](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/mxgraph/src/util/mxUndoManager.js): `src/main/webapp/mxgraph/src/util/mxUndoManager.js`
- [Edge Routing](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/libavoid-js/libavoid-routing.js): `src/main/webapp/js/libavoid-js/libavoid-routing.js`

### Content Features

- [Stencil Palettes](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/sidebar/Sidebar.js): `src/main/webapp/js/diagramly/sidebar/Sidebar.js`
- [Diagram Importers](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/vsdxImporter.js): `src/main/webapp/js/vsdxImporter.js`
- [Diagram Export](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/export.js): `src/main/webapp/js/export.js`

### Storage Integrations

- [File Persistence](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/StorageFile.js): `src/main/webapp/js/diagramly/StorageFile.js`
- [Library Persistence](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/StorageLibrary.js): `src/main/webapp/js/diagramly/StorageLibrary.js`
- [Drive Storage](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/DriveClient.js): `src/main/webapp/js/diagramly/DriveClient.js`
- [Dropbox Storage](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/DropboxClient.js): `src/main/webapp/js/diagramly/DropboxClient.js`
- [GitHub Storage](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/GitHubClient.js): `src/main/webapp/js/diagramly/GitHubClient.js`
- [GitLab Storage](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/GitLabClient.js): `src/main/webapp/js/diagramly/GitLabClient.js`
- [OneDrive Storage](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/diagramly/OneDriveClient.js): `src/main/webapp/js/diagramly/OneDriveClient.js`

### Platform Services

- **Browser Storage**
- [Offline Cache](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/service-worker.js): `src/main/webapp/service-worker.js`
- [Auth Servlets](https://github.com/jgraph/drawio/blob/dev/src/main/server/java/com/mxgraph/online/GoogleAuthServlet.java): `src/main/server/java/com/mxgraph/online/GoogleAuthServlet.java`

### Other components

- **Diagram User**
- **Cloud Providers**
- **Identity Providers**
- **Web Browser**

## Connections

- Diagram User → Application Shell: opens editor
- Application Shell → Editor UI: starts UI
- Editor UI → Editor Controller: controls editor
- Editor Controller → Graph Engine: edits graph
- Graph Engine → Edge Editing: creates handlers
- Graph Engine → Automatic Layout: dispatches changes
- Graph Engine → Swimlane Sizing: dispatches changes
- Graph Engine → Undo History: emits edits
- Edge Editing → Edge Routing: routes edges
- Editor UI → Stencil Palettes: loads palettes
- Editor UI → Diagram Importers: imports diagrams
- Editor UI → Diagram Export: exports diagrams
- Editor UI → File Persistence: saves files
- File Persistence → Browser Storage: reads writes
- Library Persistence → File Persistence: specializes persistence
- Editor UI → Drive Storage: uses storage
- Editor UI → Dropbox Storage: uses storage
- Editor UI → GitHub Storage: uses storage
- Editor UI → GitLab Storage: uses storage
- Editor UI → OneDrive Storage: uses storage
- Drive Storage → Cloud Providers: syncs files
- Dropbox Storage → Cloud Providers: syncs files
- GitHub Storage → Cloud Providers: syncs files
- GitLab Storage → Cloud Providers: syncs files
- OneDrive Storage → Cloud Providers: syncs files
- Auth Servlets → Identity Providers: authenticates users
- Web Browser → Offline Cache: runs worker
- Offline Cache → Browser Storage: caches assets
