# heyimjames/tela architecture

> Architecture diagram of the GitHub repository heyimjames/tela, 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/heyimjames/tela
- Repository: https://github.com/heyimjames/tela

## Overview

Tela is a local-first editor for social and ad creatives. Users start in the file library, open or create a design from a template or blank canvas, edit layers on a multi-format canvas, and export or resize the result. The editor combines interaction hooks, persisted design/workspace state, and rendering/export engines; optional AI generation and the RPC bridge extend that workflow. The README documents these capabilities, while several implementation details are unsampled, so those links are documented rather than inferred from filenames.

Main entry points: [`src/store/useDesignStore.ts`](https://github.com/heyimjames/tela/blob/main/src/store/useDesignStore.ts) (Design document), [`src/components/layout/PreviewPanel.tsx`](https://github.com/heyimjames/tela/blob/main/src/components/layout/PreviewPanel.tsx) (Editor canvas), [`src/store/useWorkspaceStore.ts`](https://github.com/heyimjames/tela/blob/main/src/store/useWorkspaceStore.ts) (Workspace frames), [`src/App.tsx`](https://github.com/heyimjames/tela/blob/main/src/App.tsx) (Tela app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and library"]
  node_app["Tela app<br/>[App.tsx]"]
  node_library["File library<br/>[HomePage.tsx]"]
  node_templates["Templates<br/>[templates.ts]"]
end

subgraph group_editing["Canvas editing"]
  node_canvas["Editor canvas<br/>[PreviewPanel.tsx]"]
  node_interaction["Canvas interaction"]
  node_snap["Snap computation"]
  node_drawing["Freehand drawing<br/>[useDrawTool.ts]"]
  node_shortcuts["Keyboard shortcuts"]
end

subgraph group_domain["Design state and brand"]
  node_design["Design document<br/>[useDesignStore.ts]"]
  node_workspace["Workspace frames"]
  node_files[("File persistence<br/>[useFileStore.ts]")]
  node_brand["Brand system<br/>[brand.config.ts]"]
  node_model["Layer model<br/>[design.ts]"]
end

subgraph group_render["Render and export"]
  node_svgscene["SVG scene<br/>[DesignSvgScene.tsx]"]
  node_reflow["Format reflow<br/>[reflow.ts]"]
  node_renderer["Layer renderer<br/>[layerRenderer.ts]"]
  node_compositor["Export compositor<br/>[compositor.ts]"]
end

subgraph group_extensions["Optional integrations"]
  node_ai["AI generation<br/>[useAIStore.ts]"]
  node_rpc["RPC bridge<br/>[rpc.ts]"]
end

node_user(("Designer"))
node_aiendpoint{{"Configured AI endpoint"}}
node_parent(("Parent app or agent"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_library
node_library -->|"offers templates"| node_templates
node_user -->|"edits designs"| node_canvas
node_app -->|"mounts editor"| node_canvas
node_canvas -->|"renders scene"| node_svgscene
node_canvas -.->|"handles gestures"| node_interaction
node_interaction -->|"computes snapping"| node_snap
node_interaction -->|"updates selection"| node_design
node_drawing -->|"adds strokes"| node_design
node_shortcuts -->|"dispatches edits"| node_design
node_shortcuts -->|"duplicates frames"| node_workspace
node_design -->|"syncs active frame"| node_workspace
node_design -->|"reflows layers"| node_reflow
node_workspace -->|"reflows formats"| node_reflow
node_design -->|"uses layer types"| node_model
node_brand -->|"configures starter designs"| node_templates
node_design -->|"supplies layer model"| node_renderer
node_renderer -.->|"renders bitmap"| node_compositor
node_user -->|"exports artwork"| node_compositor
node_library -->|"loads and saves files"| node_files
node_design -->|"persists locally"| node_files
node_workspace -->|"persists locally"| node_files
node_canvas -->|"requests relayout"| node_ai
node_ai -->|"posts prompts"| node_aiendpoint
node_parent -->|"dispatches commands"| node_rpc
node_rpc -->|"routes commands"| node_design

click node_app "https://github.com/heyimjames/tela/blob/main/src/App.tsx"
click node_library "https://github.com/heyimjames/tela/blob/main/src/components/library/HomePage.tsx"
click node_templates "https://github.com/heyimjames/tela/blob/main/src/brand/templates.ts"
click node_canvas "https://github.com/heyimjames/tela/blob/main/src/components/layout/PreviewPanel.tsx"
click node_svgscene "https://github.com/heyimjames/tela/blob/main/src/components/canvas/DesignSvgScene.tsx"
click node_interaction "https://github.com/heyimjames/tela/blob/main/src/hooks/useCanvasInteraction.ts"
click node_snap "https://github.com/heyimjames/tela/blob/main/src/hooks/canvas/useSnapComputation.ts"
click node_drawing "https://github.com/heyimjames/tela/blob/main/src/hooks/useDrawTool.ts"
click node_shortcuts "https://github.com/heyimjames/tela/blob/main/src/hooks/useKeyboardShortcuts.ts"
click node_design "https://github.com/heyimjames/tela/blob/main/src/store/useDesignStore.ts"
click node_workspace "https://github.com/heyimjames/tela/blob/main/src/store/useWorkspaceStore.ts"
click node_files "https://github.com/heyimjames/tela/blob/main/src/store/useFileStore.ts"
click node_brand "https://github.com/heyimjames/tela/blob/main/src/brand/brand.config.ts"
click node_model "https://github.com/heyimjames/tela/blob/main/src/types/design.ts"
click node_reflow "https://github.com/heyimjames/tela/blob/main/src/engine/reflow.ts"
click node_renderer "https://github.com/heyimjames/tela/blob/main/src/engine/layerRenderer.ts"
click node_compositor "https://github.com/heyimjames/tela/blob/main/src/engine/compositor.ts"
click node_ai "https://github.com/heyimjames/tela/blob/main/src/store/useAIStore.ts"
click node_rpc "https://github.com/heyimjames/tela/blob/main/src/agent/rpc.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_app,node_library,node_templates toneBlue
class node_canvas,node_interaction,node_snap,node_drawing,node_shortcuts toneAmber
class node_design,node_workspace,node_files,node_brand,node_model toneMint
class node_svgscene,node_reflow,node_renderer,node_compositor toneRose
class node_ai,node_rpc,node_user,node_aiendpoint,node_parent toneIndigo
```

## Components

### App and library

- [Tela app](https://github.com/heyimjames/tela/blob/main/src/App.tsx): `src/App.tsx`
- [File library](https://github.com/heyimjames/tela/blob/main/src/components/library/HomePage.tsx): `src/components/library/HomePage.tsx`
- [Templates](https://github.com/heyimjames/tela/blob/main/src/brand/templates.ts): `src/brand/templates.ts`

### Canvas editing

- [Editor canvas](https://github.com/heyimjames/tela/blob/main/src/components/layout/PreviewPanel.tsx): `src/components/layout/PreviewPanel.tsx`
- [Canvas interaction](https://github.com/heyimjames/tela/blob/main/src/hooks/useCanvasInteraction.ts): `src/hooks/useCanvasInteraction.ts`
- [Snap computation](https://github.com/heyimjames/tela/blob/main/src/hooks/canvas/useSnapComputation.ts): `src/hooks/canvas/useSnapComputation.ts`
- [Freehand drawing](https://github.com/heyimjames/tela/blob/main/src/hooks/useDrawTool.ts): `src/hooks/useDrawTool.ts`
- [Keyboard shortcuts](https://github.com/heyimjames/tela/blob/main/src/hooks/useKeyboardShortcuts.ts): `src/hooks/useKeyboardShortcuts.ts`

### Design state and brand

- [Design document](https://github.com/heyimjames/tela/blob/main/src/store/useDesignStore.ts): `src/store/useDesignStore.ts`
- [Workspace frames](https://github.com/heyimjames/tela/blob/main/src/store/useWorkspaceStore.ts): `src/store/useWorkspaceStore.ts`
- [File persistence](https://github.com/heyimjames/tela/blob/main/src/store/useFileStore.ts): `src/store/useFileStore.ts`
- [Brand system](https://github.com/heyimjames/tela/blob/main/src/brand/brand.config.ts): `src/brand/brand.config.ts`
- [Layer model](https://github.com/heyimjames/tela/blob/main/src/types/design.ts): `src/types/design.ts`

### Render and export

- [SVG scene](https://github.com/heyimjames/tela/blob/main/src/components/canvas/DesignSvgScene.tsx): `src/components/canvas/DesignSvgScene.tsx`
- [Format reflow](https://github.com/heyimjames/tela/blob/main/src/engine/reflow.ts): `src/engine/reflow.ts`
- [Layer renderer](https://github.com/heyimjames/tela/blob/main/src/engine/layerRenderer.ts): `src/engine/layerRenderer.ts`
- [Export compositor](https://github.com/heyimjames/tela/blob/main/src/engine/compositor.ts): `src/engine/compositor.ts`

### Optional integrations

- [AI generation](https://github.com/heyimjames/tela/blob/main/src/store/useAIStore.ts): `src/store/useAIStore.ts`
- [RPC bridge](https://github.com/heyimjames/tela/blob/main/src/agent/rpc.ts): `src/agent/rpc.ts`

### Other components

- **Designer**
- **Configured AI endpoint**
- **Parent app or agent**

## Connections

- Designer → Tela app: opens (evidence: `README.md`)
- Tela app → File library: routes to (evidence: `src/App.tsx`)
- File library → Templates: offers templates (evidence: `src/components/library/HomePage.tsx`)
- Designer → Editor canvas: edits designs (evidence: `README.md`)
- Tela app → Editor canvas: mounts editor (evidence: `src/App.tsx`)
- Editor canvas → SVG scene: renders scene (evidence: `src/components/layout/PreviewPanel.tsx`)
- Editor canvas → Canvas interaction: handles gestures (evidence: `src/components/layout/PreviewPanel.tsx`)
- Canvas interaction → Snap computation: computes snapping (evidence: `src/hooks/useCanvasInteraction.ts`)
- Canvas interaction → Design document: updates selection (evidence: `src/hooks/useCanvasInteraction.ts`)
- Freehand drawing → Design document: adds strokes (evidence: `src/hooks/useDrawTool.ts`)
- Keyboard shortcuts → Design document: dispatches edits (evidence: `src/hooks/useKeyboardShortcuts.ts`)
- Keyboard shortcuts → Workspace frames: duplicates frames (evidence: `src/hooks/useKeyboardShortcuts.ts`)
- Design document → Workspace frames: syncs active frame (evidence: `src/store/useDesignStore.ts`)
- Design document → Format reflow: reflows layers (evidence: `src/store/useDesignStore.ts`)
- Workspace frames → Format reflow: reflows formats (evidence: `src/store/useWorkspaceStore.ts`)
- Design document → Layer model: uses layer types (evidence: `src/store/useDesignStore.ts`)
- Brand system → Templates: configures starter designs (evidence: `src/brand/templates.ts`)
- Design document → Layer renderer: supplies layer model (evidence: `README.md`)
- Layer renderer → Export compositor: renders bitmap
- Designer → Export compositor: exports artwork (evidence: `README.md`)
- File library → File persistence: loads and saves files (evidence: `src/components/library/HomePage.tsx`)
- Design document → File persistence: persists locally (evidence: `README.md`)
- Workspace frames → File persistence: persists locally (evidence: `README.md`)
- Editor canvas → AI generation: requests relayout (evidence: `src/components/layout/PreviewPanel.tsx`)
- AI generation → Configured AI endpoint: posts prompts (evidence: `README.md`)
- Parent app or agent → RPC bridge: dispatches commands (evidence: `README.md`)
- RPC bridge → Design document: routes commands (evidence: `src/agent/rpc.ts`)
