# evolus/pencil architecture

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

- Interactive diagram: https://gitdiagram.com/evolus/pencil
- Repository: https://github.com/evolus/pencil

## Overview

Pencil is an Electron-based GUI prototyping and mockup application. Its user workflow is to create or open a design, edit pages and shapes, then save or export the result. The README highlights zip-based documents, tree-structured pages, embedded fonts, and printing/PDF export. The sampled entry point shows startup of background rendering, printing, and shortcut services; most editor and document-stage connections are inferred from documented capabilities, so those links are marked unverified.

Main entry points: [`app/views/ApplicationPane.js`](https://github.com/evolus/pencil/blob/master/app/views/ApplicationPane.js) (Design workspace), [`app/index.js`](https://github.com/evolus/pencil/blob/master/app/index.js) (Electron entry), [`app/pencil-core/document/document.js`](https://github.com/evolus/pencil/blob/master/app/pencil-core/document/document.js) (Document model), [`app/pencil-core/common/renderer.js`](https://github.com/evolus/pencil/blob/master/app/pencil-core/common/renderer.js) (Background renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_electron["Electron entry<br/>[index.js]"]
  node_updater["App updater<br/>[updater.js]"]
  node_shortcuts["Shortcut service"]
  node_mac_menu["macOS menu<br/>[MacOSToolbar.js]"]
end

subgraph group_design["Design workspace"]
  node_editor["Design workspace<br/>[ApplicationPane.js]"]
  node_canvas["Canvas and shapes"]
  node_page_tree["Page management<br/>[PageListView.js]"]
  node_properties["Shape properties"]
end

subgraph group_assets["Documents and assets"]
  node_document["Document model<br/>[document.js]"]
  node_file_io["Document file I/O<br/>[FileHandler.js]"]
  node_collections["Shape collections"]
  node_private_collections["Private collections"]
  node_font_support["Font support<br/>[FontLoader.js]"]
end

subgraph group_output["Rendering and output"]
  node_renderer["Background renderer<br/>[renderer.js]"]
  node_queue["Task queue<br/>[QueueHandler.js]"]
  node_shared_util["Font utilities<br/>[shared-util.js]"]
  node_export["Document export"]
  node_printer["Print and PDF<br/>[webPrinter.js]"]
end

node_user(("Designer"))

node_user -->|"launches"| node_electron
node_electron -->|"starts"| node_renderer
node_electron -->|"starts"| node_printer
node_electron -->|"starts"| node_shortcuts
node_electron -->|"creates on macOS"| node_mac_menu
node_renderer -->|"queues render tasks"| node_queue
node_renderer -->|"builds font CSS"| node_shared_util
node_printer -->|"queues print tasks"| node_queue
node_user -.->|"edits designs"| node_editor
node_editor -.->|"edits shapes"| node_canvas
node_editor -.->|"manages pages"| node_page_tree
node_editor -.->|"adjusts properties"| node_properties
node_editor -.->|"works with document"| node_document
node_document -.->|"saves and opens"| node_file_io
node_editor -.->|"uses shape collections"| node_collections
node_editor -.->|"uses private shapes"| node_private_collections
node_document -.->|"embeds custom fonts"| node_font_support
node_editor -.->|"requests rendering"| node_renderer
node_document -.->|"exports document"| node_export
node_export -.->|"prints or creates PDF"| node_printer

click node_electron "https://github.com/evolus/pencil/blob/master/app/index.js"
click node_editor "https://github.com/evolus/pencil/blob/master/app/views/ApplicationPane.js"
click node_canvas "https://github.com/evolus/pencil/tree/master/app/pencil-core/target"
click node_page_tree "https://github.com/evolus/pencil/blob/master/app/views/common/PageListView.js"
click node_properties "https://github.com/evolus/pencil/tree/master/app/pencil-core/editor"
click node_document "https://github.com/evolus/pencil/blob/master/app/pencil-core/document/document.js"
click node_file_io "https://github.com/evolus/pencil/blob/master/app/pencil-core/common/FileHandler.js"
click node_collections "https://github.com/evolus/pencil/blob/master/app/pencil-core/definition/collectionManager.js"
click node_private_collections "https://github.com/evolus/pencil/blob/master/app/pencil-core/privateCollection/privateCollectionManager.js"
click node_font_support "https://github.com/evolus/pencil/blob/master/app/pencil-core/common/FontLoader.js"
click node_renderer "https://github.com/evolus/pencil/blob/master/app/pencil-core/common/renderer.js"
click node_queue "https://github.com/evolus/pencil/blob/master/app/pencil-core/common/QueueHandler.js"
click node_shared_util "https://github.com/evolus/pencil/blob/master/app/pencil-core/common/shared-util.js"
click node_export "https://github.com/evolus/pencil/blob/master/app/pencil-core/exporter/documentExportManager.js"
click node_printer "https://github.com/evolus/pencil/blob/master/app/pencil-core/common/webPrinter.js"
click node_updater "https://github.com/evolus/pencil/blob/master/app/updater.js"
click node_shortcuts "https://github.com/evolus/pencil/blob/master/app/tools/global-shortcut-main.js"
click node_mac_menu "https://github.com/evolus/pencil/blob/master/app/views/toolbars/MacOSToolbar.js"

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_electron,node_updater,node_shortcuts,node_mac_menu toneBlue
class node_editor,node_canvas,node_page_tree,node_properties toneAmber
class node_document,node_file_io,node_collections,node_private_collections,node_font_support toneMint
class node_renderer,node_queue,node_shared_util,node_export,node_printer toneRose
class node_user toneIndigo
```

## Components

### Application runtime

- [Electron entry](https://github.com/evolus/pencil/blob/master/app/index.js): `app/index.js`
- [App updater](https://github.com/evolus/pencil/blob/master/app/updater.js): `app/updater.js`
- [Shortcut service](https://github.com/evolus/pencil/blob/master/app/tools/global-shortcut-main.js): `app/tools/global-shortcut-main.js`
- [macOS menu](https://github.com/evolus/pencil/blob/master/app/views/toolbars/MacOSToolbar.js): `app/views/toolbars/MacOSToolbar.js`

### Design workspace

- [Design workspace](https://github.com/evolus/pencil/blob/master/app/views/ApplicationPane.js): `app/views/ApplicationPane.js`
- [Canvas and shapes](https://github.com/evolus/pencil/tree/master/app/pencil-core/target): `app/pencil-core/target`
- [Page management](https://github.com/evolus/pencil/blob/master/app/views/common/PageListView.js): `app/views/common/PageListView.js`
- [Shape properties](https://github.com/evolus/pencil/tree/master/app/pencil-core/editor): `app/pencil-core/editor`

### Documents and assets

- [Document model](https://github.com/evolus/pencil/blob/master/app/pencil-core/document/document.js): `app/pencil-core/document/document.js`
- [Document file I/O](https://github.com/evolus/pencil/blob/master/app/pencil-core/common/FileHandler.js): `app/pencil-core/common/FileHandler.js`
- [Shape collections](https://github.com/evolus/pencil/blob/master/app/pencil-core/definition/collectionManager.js): `app/pencil-core/definition/collectionManager.js`
- [Private collections](https://github.com/evolus/pencil/blob/master/app/pencil-core/privateCollection/privateCollectionManager.js): `app/pencil-core/privateCollection/privateCollectionManager.js`
- [Font support](https://github.com/evolus/pencil/blob/master/app/pencil-core/common/FontLoader.js): `app/pencil-core/common/FontLoader.js`

### Rendering and output

- [Background renderer](https://github.com/evolus/pencil/blob/master/app/pencil-core/common/renderer.js): `app/pencil-core/common/renderer.js`
- [Task queue](https://github.com/evolus/pencil/blob/master/app/pencil-core/common/QueueHandler.js): `app/pencil-core/common/QueueHandler.js`
- [Font utilities](https://github.com/evolus/pencil/blob/master/app/pencil-core/common/shared-util.js): `app/pencil-core/common/shared-util.js`
- [Document export](https://github.com/evolus/pencil/blob/master/app/pencil-core/exporter/documentExportManager.js): `app/pencil-core/exporter/documentExportManager.js`
- [Print and PDF](https://github.com/evolus/pencil/blob/master/app/pencil-core/common/webPrinter.js): `app/pencil-core/common/webPrinter.js`

### Other components

- **Designer**

## Connections

- Designer → Electron entry: launches (evidence: `app/index.js`)
- Electron entry → Background renderer: starts (evidence: `app/index.js`)
- Electron entry → Print and PDF: starts (evidence: `app/index.js`)
- Electron entry → Shortcut service: starts (evidence: `app/index.js`)
- Electron entry → macOS menu: creates on macOS (evidence: `app/index.js`)
- Background renderer → Task queue: queues render tasks (evidence: `app/pencil-core/common/renderer.js`)
- Background renderer → Font utilities: builds font CSS (evidence: `app/pencil-core/common/renderer.js`)
- Print and PDF → Task queue: queues print tasks (evidence: `app/pencil-core/common/webPrinter.js`)
- Designer → Design workspace: edits designs
- Design workspace → Canvas and shapes: edits shapes
- Design workspace → Page management: manages pages
- Design workspace → Shape properties: adjusts properties
- Design workspace → Document model: works with document
- Document model → Document file I/O: saves and opens
- Design workspace → Shape collections: uses shape collections
- Design workspace → Private collections: uses private shapes
- Document model → Font support: embeds custom fonts
- Design workspace → Background renderer: requests rendering
- Document model → Document export: exports document
- Document export → Print and PDF: prints or creates PDF
