# samchemman/octet-draw architecture

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

- Interactive diagram: https://gitdiagram.com/samchemman/octet-draw
- Repository: https://github.com/samchemman/octet-draw

## Overview

Octet Draw is a desktop chemical-structure editor. Users create or open a drawing, edit and render it, then save or export it; additional capabilities include chemical naming, property and NMR analysis, templates, and search. The graph combines documented product workflows with sampled frontend and chemistry relationships and native-module references. Several major subsystems are represented by exact tree paths but were not sampled, so their internal wiring is omitted rather than inferred.

Main entry points: [`src/edit.ts`](https://github.com/samchemman/octet-draw/blob/main/src/edit.ts) (Editing operations), [`src-tauri/src/main.rs`](https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/main.rs) (Desktop commands), [`src-tauri/src/clipboard.rs`](https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/clipboard.rs) (Clipboard formats), [`src/Editor.tsx`](https://github.com/samchemman/octet-draw/blob/main/src/Editor.tsx) (Drawing editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Drawing experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_editor["Drawing editor<br/>[Editor.tsx]"]
  node_template_library["Template library"]
  node_gallery["Gallery<br/>[Gallery.tsx]"]
end

subgraph group_chemistry["Chemistry engine"]
  node_editing["Editing operations<br/>[edit.ts]"]
  node_chem_model["Chemistry model<br/>[chem.ts]"]
  node_labels["Chemical labels<br/>[labels.ts]"]
  node_renderer["Structure renderer<br/>[render.ts]"]
  node_query["Query structures<br/>[query.ts]"]
  node_cycle["Ring geometry<br/>[cycle.ts]"]
end

subgraph group_files["Files and output"]
  node_file_formats["File formats<br/>[file.ts]"]
  node_cdxml["ChemDraw exchange<br/>[cdxml.ts]"]
  node_export_ui["Export workflow<br/>[export.ts]"]
end

subgraph group_native["Desktop integration"]
  node_clipboard["Clipboard formats<br/>[clipboard.rs]"]
  node_native_export["Native export<br/>[export.rs]"]
  node_vector["Vector output<br/>[vector.rs]"]
  node_native_commands["Desktop commands<br/>[main.rs]"]
end

subgraph group_analysis["Chemical analysis"]
  node_naming["Structure naming<br/>[namer.ts]"]
  node_properties["Formula and mass<br/>[mass.ts]"]
  node_nmr["NMR prediction<br/>[nmr.ts]"]
  node_search["Structure search<br/>[search.rs]"]
end

node_user(("Chemist"))
node_github["GitHub updates"]
node_office["Office apps"]

node_user -->|"draws in"| node_editor
node_app -->|"renders"| node_editor
node_app -->|"renders"| node_gallery
node_editor -.->|"edits structures"| node_editing
node_editor -.->|"inserts templates"| node_template_library
node_editing -.->|"updates model"| node_chem_model
node_chem_model -->|"uses"| node_renderer
node_editing -->|"uses"| node_renderer
node_editing -->|"uses"| node_cycle
node_editing -->|"uses"| node_labels
node_renderer -->|"reads query labels"| node_query
node_renderer -->|"reads ring geometry"| node_cycle
node_user -->|"opens and saves"| node_file_formats
node_file_formats -->|"exchanges ChemDraw files"| node_cdxml
node_user -->|"exports drawing"| node_export_ui
node_export_ui -.->|"requests native export"| node_native_export
node_native_export -->|"uses vector output"| node_vector
node_native_commands -->|"registers commands"| node_clipboard
node_native_commands -->|"registers commands"| node_native_export
node_clipboard -->|"uses export"| node_native_export
node_clipboard -->|"uses vector output"| node_vector
node_user -->|"pastes drawings"| node_office
node_clipboard -->|"provides drawing formats"| node_office
node_user -->|"converts names"| node_naming
node_user -->|"views properties"| node_properties
node_user -->|"predicts shifts"| node_nmr
node_user -->|"searches structures"| node_search
node_native_commands -->|"registers commands"| node_search
node_native_commands -->|"checks updates"| node_github

click node_app "https://github.com/samchemman/octet-draw/blob/main/src/App.tsx"
click node_editor "https://github.com/samchemman/octet-draw/blob/main/src/Editor.tsx"
click node_template_library "https://github.com/samchemman/octet-draw/blob/main/src/TemplateLibrary.tsx"
click node_gallery "https://github.com/samchemman/octet-draw/blob/main/src/Gallery.tsx"
click node_editing "https://github.com/samchemman/octet-draw/blob/main/src/edit.ts"
click node_chem_model "https://github.com/samchemman/octet-draw/blob/main/src/chem.ts"
click node_labels "https://github.com/samchemman/octet-draw/blob/main/src/labels.ts"
click node_renderer "https://github.com/samchemman/octet-draw/blob/main/src/render.ts"
click node_query "https://github.com/samchemman/octet-draw/blob/main/src/query.ts"
click node_cycle "https://github.com/samchemman/octet-draw/blob/main/src/cycle.ts"
click node_file_formats "https://github.com/samchemman/octet-draw/blob/main/src/file.ts"
click node_cdxml "https://github.com/samchemman/octet-draw/blob/main/src/cdxml.ts"
click node_export_ui "https://github.com/samchemman/octet-draw/blob/main/src/export.ts"
click node_clipboard "https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/clipboard.rs"
click node_native_export "https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/export.rs"
click node_vector "https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/vector.rs"
click node_native_commands "https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/main.rs"
click node_naming "https://github.com/samchemman/octet-draw/blob/main/src/namer.ts"
click node_properties "https://github.com/samchemman/octet-draw/blob/main/src/mass.ts"
click node_nmr "https://github.com/samchemman/octet-draw/blob/main/src/nmr.ts"
click node_search "https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/search.rs"

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,node_template_library,node_gallery toneBlue
class node_editing,node_chem_model,node_labels,node_renderer,node_query,node_cycle toneAmber
class node_file_formats,node_cdxml,node_export_ui toneMint
class node_clipboard,node_native_export,node_vector,node_native_commands toneRose
class node_naming,node_properties,node_nmr,node_search,node_user,node_github,node_office toneIndigo
```

## Components

### Drawing experience

- [App shell](https://github.com/samchemman/octet-draw/blob/main/src/App.tsx): `src/App.tsx`
- [Drawing editor](https://github.com/samchemman/octet-draw/blob/main/src/Editor.tsx): `src/Editor.tsx`
- [Template library](https://github.com/samchemman/octet-draw/blob/main/src/TemplateLibrary.tsx): `src/TemplateLibrary.tsx`
- [Gallery](https://github.com/samchemman/octet-draw/blob/main/src/Gallery.tsx): `src/Gallery.tsx`

### Chemistry engine

- [Editing operations](https://github.com/samchemman/octet-draw/blob/main/src/edit.ts): `src/edit.ts`
- [Chemistry model](https://github.com/samchemman/octet-draw/blob/main/src/chem.ts): `src/chem.ts`
- [Chemical labels](https://github.com/samchemman/octet-draw/blob/main/src/labels.ts): `src/labels.ts`
- [Structure renderer](https://github.com/samchemman/octet-draw/blob/main/src/render.ts): `src/render.ts`
- [Query structures](https://github.com/samchemman/octet-draw/blob/main/src/query.ts): `src/query.ts`
- [Ring geometry](https://github.com/samchemman/octet-draw/blob/main/src/cycle.ts): `src/cycle.ts`

### Files and output

- [File formats](https://github.com/samchemman/octet-draw/blob/main/src/file.ts): `src/file.ts`
- [ChemDraw exchange](https://github.com/samchemman/octet-draw/blob/main/src/cdxml.ts): `src/cdxml.ts`
- [Export workflow](https://github.com/samchemman/octet-draw/blob/main/src/export.ts): `src/export.ts`

### Desktop integration

- [Clipboard formats](https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/clipboard.rs): `src-tauri/src/clipboard.rs`
- [Native export](https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/export.rs): `src-tauri/src/export.rs`
- [Vector output](https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/vector.rs): `src-tauri/src/vector.rs`
- [Desktop commands](https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`

### Chemical analysis

- [Structure naming](https://github.com/samchemman/octet-draw/blob/main/src/namer.ts): `src/namer.ts`
- [Formula and mass](https://github.com/samchemman/octet-draw/blob/main/src/mass.ts): `src/mass.ts`
- [NMR prediction](https://github.com/samchemman/octet-draw/blob/main/src/nmr.ts): `src/nmr.ts`
- [Structure search](https://github.com/samchemman/octet-draw/blob/main/src-tauri/src/search.rs): `src-tauri/src/search.rs`

### Other components

- **Chemist**
- **GitHub updates**
- **Office apps**

## Connections

- Chemist → Drawing editor: draws in
- App shell → Drawing editor: renders (evidence: `src/App.tsx`)
- App shell → Gallery: renders (evidence: `src/App.tsx`)
- Drawing editor → Editing operations: edits structures
- Drawing editor → Template library: inserts templates
- Editing operations → Chemistry model: updates model (evidence: `src/chem.ts`)
- Chemistry model → Structure renderer: uses (evidence: `src/chem.ts`)
- Editing operations → Structure renderer: uses (evidence: `src/edit.ts`)
- Editing operations → Ring geometry: uses (evidence: `src/edit.ts`)
- Editing operations → Chemical labels: uses (evidence: `src/edit.ts`)
- Structure renderer → Query structures: reads query labels (evidence: `src/render.ts`)
- Structure renderer → Ring geometry: reads ring geometry (evidence: `src/render.ts`)
- Chemist → File formats: opens and saves
- File formats → ChemDraw exchange: exchanges ChemDraw files
- Chemist → Export workflow: exports drawing
- Export workflow → Native export: requests native export
- Native export → Vector output: uses vector output (evidence: `src-tauri/src/export.rs`)
- Desktop commands → Clipboard formats: registers commands (evidence: `src-tauri/src/main.rs`)
- Desktop commands → Native export: registers commands (evidence: `src-tauri/src/main.rs`)
- Clipboard formats → Native export: uses export (evidence: `src-tauri/src/clipboard.rs`)
- Clipboard formats → Vector output: uses vector output (evidence: `src-tauri/src/clipboard.rs`)
- Chemist → Office apps: pastes drawings
- Clipboard formats → Office apps: provides drawing formats
- Chemist → Structure naming: converts names
- Chemist → Formula and mass: views properties
- Chemist → NMR prediction: predicts shifts
- Chemist → Structure search: searches structures
- Desktop commands → Structure search: registers commands (evidence: `src-tauri/src/main.rs`)
- Desktop commands → GitHub updates: checks updates
