# ahandan/whiteboards architecture

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

- Interactive diagram: https://gitdiagram.com/ahandan/whiteboards
- Repository: https://github.com/ahandan/whiteboards

## Overview

Tableau is a browser-based teaching whiteboard. The user works in a Fabric.js canvas, choosing drawing tools and managing pages, then saves or exports the result locally. State and tool behavior live in a dedicated hook, with helpers for canvas features and separate modules for file serialization and image/PDF export. The README documents additional capabilities, including image import, undo/redo, and multi-page boards. Edges reflect shown calls, imports, or documented behavior; unsampled details are not inferred.

Main entry points: [`src/components/whiteboard/Whiteboard.tsx`](https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/Whiteboard.tsx) (Board shell), [`src/hooks/useWhiteboardState.ts`](https://github.com/ahandan/whiteboards/blob/main/src/hooks/useWhiteboardState.ts) (Fabric canvas state), [`src/app/page.tsx`](https://github.com/ahandan/whiteboards/blob/main/src/app/page.tsx) (App entry), [`src/components/whiteboard/TopBar.tsx`](https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/TopBar.tsx) (Action bar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Whiteboard interface"]
  node_entry["App entry<br/>[page.tsx]"]
  node_board["Board shell<br/>[Whiteboard.tsx]"]
  node_topbar["Action bar<br/>[TopBar.tsx]"]
  node_toolbar["Tool controls<br/>[Toolbar.tsx]"]
  node_pages["Page navigator<br/>[PageNavigator.tsx]"]
  node_clock["Clock and timer<br/>[ClockTimer.tsx]"]
end

subgraph group_canvas["Canvas interaction"]
  node_canvas["Fabric canvas state"]
  node_shortcuts["Keyboard shortcuts"]
  node_helpers["Canvas helpers<br/>[canvasHelpers.ts]"]
  node_types["Board model<br/>[whiteboard.ts]"]
end

subgraph group_documents["Document workflows"]
  node_serialization["Local file handling<br/>[serialization.ts]"]
end

subgraph group_formats["File formats"]
  node_pdf["PDF export<br/>[exportPdf.ts]"]
  node_png["PNG export<br/>[exportPng.ts]"]
end

node_user(("Teacher"))

node_user -->|"opens"| node_entry
node_entry -->|"renders"| node_board
node_user -.->|"uses"| node_board
node_board -->|"renders"| node_topbar
node_board -->|"renders"| node_toolbar
node_board -->|"renders"| node_pages
node_topbar -->|"renders"| node_clock
node_board -->|"uses state"| node_canvas
node_board -->|"registers"| node_shortcuts
node_canvas -->|"calls"| node_helpers
node_canvas -->|"loads and saves"| node_serialization
node_canvas -->|"uses model"| node_types
node_toolbar -->|"uses tool definitions"| node_types
node_board -->|"exports pages"| node_pdf
node_board -->|"exports page"| node_png
node_board -->|"routes actions"| node_canvas
node_board -->|"passes page actions"| node_pages
node_user -.->|"downloads or opens"| node_serialization
node_user -.->|"exports"| node_pdf
node_user -.->|"exports"| node_png

click node_entry "https://github.com/ahandan/whiteboards/blob/main/src/app/page.tsx"
click node_board "https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/Whiteboard.tsx"
click node_topbar "https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/TopBar.tsx"
click node_toolbar "https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/Toolbar.tsx"
click node_pages "https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/PageNavigator.tsx"
click node_clock "https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/ClockTimer.tsx"
click node_canvas "https://github.com/ahandan/whiteboards/blob/main/src/hooks/useWhiteboardState.ts"
click node_shortcuts "https://github.com/ahandan/whiteboards/blob/main/src/hooks/useKeyboardShortcuts.ts"
click node_helpers "https://github.com/ahandan/whiteboards/blob/main/src/lib/canvasHelpers.ts"
click node_types "https://github.com/ahandan/whiteboards/blob/main/src/types/whiteboard.ts"
click node_serialization "https://github.com/ahandan/whiteboards/blob/main/src/lib/serialization.ts"
click node_pdf "https://github.com/ahandan/whiteboards/blob/main/src/lib/exportPdf.ts"
click node_png "https://github.com/ahandan/whiteboards/blob/main/src/lib/exportPng.ts"

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_entry,node_board,node_topbar,node_toolbar,node_pages,node_clock toneBlue
class node_canvas,node_shortcuts,node_helpers,node_types toneAmber
class node_serialization toneMint
class node_pdf,node_png toneRose
class node_user toneIndigo
```

## Components

### Whiteboard interface

- [App entry](https://github.com/ahandan/whiteboards/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Board shell](https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/Whiteboard.tsx): `src/components/whiteboard/Whiteboard.tsx`
- [Action bar](https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/TopBar.tsx): `src/components/whiteboard/TopBar.tsx`
- [Tool controls](https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/Toolbar.tsx): `src/components/whiteboard/Toolbar.tsx`
- [Page navigator](https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/PageNavigator.tsx): `src/components/whiteboard/PageNavigator.tsx`
- [Clock and timer](https://github.com/ahandan/whiteboards/blob/main/src/components/whiteboard/ClockTimer.tsx): `src/components/whiteboard/ClockTimer.tsx`

### Canvas interaction

- [Fabric canvas state](https://github.com/ahandan/whiteboards/blob/main/src/hooks/useWhiteboardState.ts): `src/hooks/useWhiteboardState.ts`
- [Keyboard shortcuts](https://github.com/ahandan/whiteboards/blob/main/src/hooks/useKeyboardShortcuts.ts): `src/hooks/useKeyboardShortcuts.ts`
- [Canvas helpers](https://github.com/ahandan/whiteboards/blob/main/src/lib/canvasHelpers.ts): `src/lib/canvasHelpers.ts`
- [Board model](https://github.com/ahandan/whiteboards/blob/main/src/types/whiteboard.ts): `src/types/whiteboard.ts`

### Document workflows

- [Local file handling](https://github.com/ahandan/whiteboards/blob/main/src/lib/serialization.ts): `src/lib/serialization.ts`

### File formats

- [PDF export](https://github.com/ahandan/whiteboards/blob/main/src/lib/exportPdf.ts): `src/lib/exportPdf.ts`
- [PNG export](https://github.com/ahandan/whiteboards/blob/main/src/lib/exportPng.ts): `src/lib/exportPng.ts`

### Other components

- **Teacher**

## Connections

- Teacher → App entry: opens (evidence: `src/app/page.tsx`)
- App entry → Board shell: renders (evidence: `src/app/page.tsx`)
- Teacher → Board shell: uses (evidence: `README.md`)
- Board shell → Action bar: renders (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Board shell → Tool controls: renders (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Board shell → Page navigator: renders (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Action bar → Clock and timer: renders (evidence: `src/components/whiteboard/TopBar.tsx`)
- Board shell → Fabric canvas state: uses state (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Board shell → Keyboard shortcuts: registers (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Fabric canvas state → Canvas helpers: calls (evidence: `src/hooks/useWhiteboardState.ts`)
- Fabric canvas state → Local file handling: loads and saves (evidence: `src/hooks/useWhiteboardState.ts`)
- Fabric canvas state → Board model: uses model (evidence: `src/hooks/useWhiteboardState.ts`)
- Tool controls → Board model: uses tool definitions (evidence: `src/components/whiteboard/Toolbar.tsx`)
- Board shell → PDF export: exports pages (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Board shell → PNG export: exports page (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Board shell → Fabric canvas state: routes actions (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Board shell → Page navigator: passes page actions (evidence: `src/components/whiteboard/Whiteboard.tsx`)
- Teacher → Local file handling: downloads or opens (evidence: `README.md`)
- Teacher → PDF export: exports (evidence: `README.md`)
- Teacher → PNG export: exports (evidence: `README.md`)
