# jgraph/drawio-github architecture

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

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

## Overview

This repository provides browser-based tools and examples for editing diagrams.net diagrams stored in GitHub. The main workflow is to open an editable diagram, launch diagrams.net, exchange diagram data, and—when self-editing mode is enabled—save the containing page through the GitHub Contents API. The graph focuses on the implemented editor and documented embedding examples; the standalone editor’s internals are not sampled, so its integration links are based on README descriptions.

Main entry points: [`nanocms.js`](https://github.com/jgraph/drawio-github/blob/main/nanocms.js) (NanoCMS editor), [`edit-diagram.html`](https://github.com/jgraph/drawio-github/blob/main/edit-diagram.html) (Standalone editor), [`self-editing.html`](https://github.com/jgraph/drawio-github/blob/main/self-editing.html) (Self-editing page), [`nanocms.css`](https://github.com/jgraph/drawio-github/blob/main/nanocms.css) (Embedded diagram styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Diagram Editing"]
  node_editpage["Standalone editor<br/>[edit-diagram.html]"]
  node_nanocms["NanoCMS editor<br/>[nanocms.js]"]
  node_drawio["diagrams.net"]
end

subgraph group_github["GitHub Persistence"]
  node_contentsapi["GitHub Contents API"]
  node_githubrepo[("GitHub repository")]
end

subgraph group_examples["Embedding Examples"]
  node_diagramassets["Diagram examples"]
  node_selfhtml["Self-editing page<br/>[self-editing.html]"]
  node_styles["Embedded diagram styles<br/>[nanocms.css]"]
end

node_user(("Diagram user"))

node_user -->|"opens editor"| node_editpage
node_editpage -->|"embeds editor"| node_drawio
node_editpage -->|"reads and saves"| node_contentsapi
node_user -->|"opens page"| node_selfhtml
node_selfhtml -->|"uses editor"| node_nanocms
node_user -->|"double-clicks diagram"| node_nanocms
node_nanocms -->|"exchanges diagram data"| node_drawio
node_nanocms -->|"reads and saves"| node_contentsapi
node_contentsapi -.->|"updates file"| node_githubrepo
node_diagramassets -.->|"supports editing"| node_nanocms
node_selfhtml -.->|"uses styles"| node_styles

click node_editpage "https://github.com/jgraph/drawio-github/blob/main/edit-diagram.html"
click node_nanocms "https://github.com/jgraph/drawio-github/blob/main/nanocms.js"
click node_selfhtml "https://github.com/jgraph/drawio-github/blob/main/self-editing.html"
click node_styles "https://github.com/jgraph/drawio-github/blob/main/nanocms.css"

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_editpage,node_nanocms,node_drawio,node_user toneBlue
class node_contentsapi,node_githubrepo toneAmber
class node_diagramassets,node_selfhtml,node_styles toneMint
```

## Components

### Diagram Editing

- [Standalone editor](https://github.com/jgraph/drawio-github/blob/main/edit-diagram.html): `edit-diagram.html`
- [NanoCMS editor](https://github.com/jgraph/drawio-github/blob/main/nanocms.js): `nanocms.js`
- **diagrams.net**

### GitHub Persistence

- **GitHub Contents API**
- **GitHub repository**

### Embedding Examples

- **Diagram examples**
- [Self-editing page](https://github.com/jgraph/drawio-github/blob/main/self-editing.html): `self-editing.html`
- [Embedded diagram styles](https://github.com/jgraph/drawio-github/blob/main/nanocms.css): `nanocms.css`

### Other components

- **Diagram user**

## Connections

- Diagram user → Standalone editor: opens editor (evidence: `README.md`)
- Standalone editor → diagrams.net: embeds editor (evidence: `README.md`)
- Standalone editor → GitHub Contents API: reads and saves (evidence: `README.md`)
- Diagram user → Self-editing page: opens page (evidence: `README.md`)
- Self-editing page → NanoCMS editor: uses editor (evidence: `README.md`)
- Diagram user → NanoCMS editor: double-clicks diagram (evidence: `nanocms.js`)
- NanoCMS editor → diagrams.net: exchanges diagram data (evidence: `nanocms.js`)
- NanoCMS editor → GitHub Contents API: reads and saves (evidence: `nanocms.js`)
- GitHub Contents API → GitHub repository: updates file (evidence: `README.md`)
- Diagram examples → NanoCMS editor: supports editing (evidence: `README.md`)
- Self-editing page → Embedded diagram styles: uses styles (evidence: `README.md`)
