# ibrahimibrahimi/excalidraw architecture

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

- Interactive diagram: https://gitdiagram.com/ibrahimibrahimi/excalidraw
- Repository: https://github.com/ibrahimibrahimi/excalidraw

## Overview

Excalidraw is a hand-drawn whiteboard editor, with the hosted app adding local-first persistence, shareable links, and encrypted real-time collaboration. Users create and manipulate diagrams in the editor, then save locally, export/share, or collaborate. The graph separates the app shell, editor interaction/rendering, data handling, and hosted-app capabilities. Some subsystems are represented from README claims and the source index; their internal wiring is omitted where excerpts do not establish it.

Main entry points: [`excalidraw-app/App.tsx`](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/App.tsx) (App shell), [`packages/excalidraw/components/App.tsx`](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/components/App.tsx) (Editor canvas), [`excalidraw-app/collab/Collab.tsx`](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/collab/Collab.tsx) (Collaboration session), [`excalidraw-app/data/firebase.ts`](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/firebase.ts) (Firebase persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Hosted App"]
  node_shell["App shell<br/>[App.tsx]"]
  node_appstate["App state<br/>[app-jotai.ts]"]
  node_constants["App settings<br/>[app_constants.ts]"]
end

subgraph group_editor["Editor Runtime"]
  node_editor["Editor canvas<br/>[App.tsx]"]
  node_actions["Action manager<br/>[manager.tsx]"]
  node_drag["Element manipulation<br/>[dragElements.ts]"]
  node_viewport["Viewport controls<br/>[viewport.ts]"]
  node_appstatecore["Editor state<br/>[appState.ts]"]
  node_i18n["Localization<br/>[i18n.ts]"]
  node_clipboard["Clipboard<br/>[clipboard.ts]"]
  node_library["Shape library<br/>[library.ts]"]
end

subgraph group_data["Scene Data"]
  node_restore["Scene restore<br/>[restore.ts]"]
  node_filemanager["Image files<br/>[FileManager.ts]"]
  node_localdata["Local persistence<br/>[LocalData.ts]"]
  node_browserstore[("Browser storage<br/>[localStorage.ts]")]
  node_appdata["Scene import/export<br/>[index.ts]"]
  node_status["File status<br/>[fileStatusStore.ts]"]
end

subgraph group_collab["Sharing &amp; Sync"]
  node_collab["Collaboration session<br/>[Collab.tsx]"]
  node_firebase["Firebase persistence<br/>[firebase.ts]"]
  node_tabs["Tab synchronization<br/>[tabSync.ts]"]
  node_share["Share dialog<br/>[ShareDialog.tsx]"]
end

node_user(("Diagram user"))
node_backend[("Share backend")]
node_collaborators(("Collaborators"))

node_user -->|"opens"| node_shell
node_shell -->|"hosts"| node_editor
node_shell -->|"provides store"| node_appstate
node_shell -->|"imports and exports"| node_appdata
node_shell -->|"updates file status"| node_filemanager
node_shell -->|"loads shared files"| node_firebase
node_editor -->|"dispatches"| node_actions
node_editor -.->|"manipulates elements"| node_drag
node_editor -->|"controls view"| node_viewport
node_editor -.->|"maintains state"| node_appstatecore
node_editor -.->|"supports clipboard"| node_clipboard
node_editor -.->|"supports shape libraries"| node_library
node_editor -->|"localizes interface"| node_i18n
node_editor -->|"restores elements"| node_restore
node_shell -.->|"autosaves locally"| node_localdata
node_localdata -->|"reads and writes"| node_browserstore
node_shell -->|"checks pending files"| node_status
node_filemanager -.->|"stores image files"| node_firebase
node_shell -->|"starts collaboration"| node_collab
node_collab -->|"gets syncable elements"| node_appdata
node_collab -->|"loads and saves scenes"| node_firebase
node_collab -->|"saves username"| node_browserstore
node_collab -.->|"syncs scene"| node_collaborators
node_shell -.->|"offers sharing"| node_share
node_shell -->|"exports share link"| node_backend
node_appdata -->|"uploads share files"| node_firebase
node_tabs -.->|"coordinates tabs"| node_browserstore
node_constants -.->|"defines sync events"| node_collab

click node_shell "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/App.tsx"
click node_appstate "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/app-jotai.ts"
click node_constants "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/app_constants.ts"
click node_editor "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/components/App.tsx"
click node_actions "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/actions/manager.tsx"
click node_drag "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/element/src/dragElements.ts"
click node_viewport "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/viewport.ts"
click node_appstatecore "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/appState.ts"
click node_i18n "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/i18n.ts"
click node_clipboard "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/clipboard.ts"
click node_library "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/data/library.ts"
click node_restore "https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/data/restore.ts"
click node_filemanager "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/FileManager.ts"
click node_localdata "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/LocalData.ts"
click node_browserstore "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/localStorage.ts"
click node_appdata "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/index.ts"
click node_status "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/fileStatusStore.ts"
click node_collab "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/collab/Collab.tsx"
click node_firebase "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/firebase.ts"
click node_tabs "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/tabSync.ts"
click node_share "https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/share/ShareDialog.tsx"

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_shell,node_appstate,node_constants,node_user toneBlue
class node_editor,node_actions,node_drag,node_viewport,node_appstatecore,node_i18n,node_clipboard,node_library,node_backend toneAmber
class node_restore,node_filemanager,node_localdata,node_browserstore,node_appdata,node_status toneMint
class node_collab,node_firebase,node_tabs,node_share toneRose
class node_collaborators toneIndigo
```

## Components

### Hosted App

- [App shell](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/App.tsx): `excalidraw-app/App.tsx`
- [App state](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/app-jotai.ts): `excalidraw-app/app-jotai.ts`
- [App settings](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/app_constants.ts): `excalidraw-app/app_constants.ts`

### Editor Runtime

- [Editor canvas](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/components/App.tsx): `packages/excalidraw/components/App.tsx`
- [Action manager](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/actions/manager.tsx): `packages/excalidraw/actions/manager.tsx`
- [Element manipulation](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/element/src/dragElements.ts): `packages/element/src/dragElements.ts`
- [Viewport controls](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/viewport.ts): `packages/excalidraw/viewport.ts`
- [Editor state](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/appState.ts): `packages/excalidraw/appState.ts`
- [Localization](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/i18n.ts): `packages/excalidraw/i18n.ts`
- [Clipboard](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/clipboard.ts): `packages/excalidraw/clipboard.ts`
- [Shape library](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/data/library.ts): `packages/excalidraw/data/library.ts`

### Scene Data

- [Scene restore](https://github.com/ibrahimibrahimi/excalidraw/blob/master/packages/excalidraw/data/restore.ts): `packages/excalidraw/data/restore.ts`
- [Image files](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/FileManager.ts): `excalidraw-app/data/FileManager.ts`
- [Local persistence](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/LocalData.ts): `excalidraw-app/data/LocalData.ts`
- [Browser storage](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/localStorage.ts): `excalidraw-app/data/localStorage.ts`
- [Scene import/export](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/index.ts): `excalidraw-app/data/index.ts`
- [File status](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/fileStatusStore.ts): `excalidraw-app/data/fileStatusStore.ts`

### Sharing & Sync

- [Collaboration session](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/collab/Collab.tsx): `excalidraw-app/collab/Collab.tsx`
- [Firebase persistence](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/firebase.ts): `excalidraw-app/data/firebase.ts`
- [Tab synchronization](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/data/tabSync.ts): `excalidraw-app/data/tabSync.ts`
- [Share dialog](https://github.com/ibrahimibrahimi/excalidraw/blob/master/excalidraw-app/share/ShareDialog.tsx): `excalidraw-app/share/ShareDialog.tsx`

### Other components

- **Diagram user**
- **Share backend**
- **Collaborators**

## Connections

- Diagram user → App shell: opens (evidence: `README.md`)
- App shell → Editor canvas: hosts (evidence: `excalidraw-app/App.tsx`)
- App shell → App state: provides store (evidence: `excalidraw-app/App.tsx`)
- App shell → Scene import/export: imports and exports (evidence: `excalidraw-app/App.tsx`)
- App shell → Image files: updates file status (evidence: `excalidraw-app/App.tsx`)
- App shell → Firebase persistence: loads shared files (evidence: `excalidraw-app/App.tsx`)
- Editor canvas → Action manager: dispatches (evidence: `packages/excalidraw/components/App.tsx`)
- Editor canvas → Element manipulation: manipulates elements
- Editor canvas → Viewport controls: controls view (evidence: `packages/excalidraw/components/App.tsx`)
- Editor canvas → Editor state: maintains state (evidence: `packages/excalidraw/components/App.tsx`)
- Editor canvas → Clipboard: supports clipboard (evidence: `README.md`)
- Editor canvas → Shape library: supports shape libraries (evidence: `README.md`)
- Editor canvas → Localization: localizes interface (evidence: `packages/excalidraw/components/App.tsx`)
- Editor canvas → Scene restore: restores elements (evidence: `packages/excalidraw/components/App.tsx`)
- App shell → Local persistence: autosaves locally (evidence: `README.md`)
- Local persistence → Browser storage: reads and writes (evidence: `excalidraw-app/data/LocalData.ts`)
- App shell → File status: checks pending files (evidence: `excalidraw-app/App.tsx`)
- Image files → Firebase persistence: stores image files
- App shell → Collaboration session: starts collaboration (evidence: `excalidraw-app/App.tsx`)
- Collaboration session → Scene import/export: gets syncable elements (evidence: `excalidraw-app/collab/Collab.tsx`)
- Collaboration session → Firebase persistence: loads and saves scenes (evidence: `excalidraw-app/collab/Collab.tsx`)
- Collaboration session → Browser storage: saves username (evidence: `excalidraw-app/collab/Collab.tsx`)
- Collaboration session → Collaborators: syncs scene (evidence: `README.md`)
- App shell → Share dialog: offers sharing (evidence: `README.md`)
- App shell → Share backend: exports share link (evidence: `excalidraw-app/App.tsx`)
- Scene import/export → Firebase persistence: uploads share files (evidence: `excalidraw-app/data/index.ts`)
- Tab synchronization → Browser storage: coordinates tabs
- App settings → Collaboration session: defines sync events (evidence: `excalidraw-app/collab/Collab.tsx`)
