# aanasmahfouz/figma-clone architecture

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

- Interactive diagram: https://gitdiagram.com/aanasmahfouz/figma-clone
- Repository: https://github.com/aanasmahfouz/figma-clone

## Overview

FigPro is a browser-based collaborative vector editor. A designer enters the editor, creates or modifies canvas objects, and sees shared changes alongside collaborators’ cursors, reactions, and spatial comment threads; the canvas can also be exported as PDF. The graph combines sampled call sites and imports with README-documented capabilities. Several feature implementations and the room setup were not excerpted, so their connections are included only where documentation or the source index supports them.

Main entry points: [`app/app.tsx`](https://github.com/aanasmahfouz/figma-clone/blob/main/app/app.tsx) (Editor orchestrator), [`components/live.tsx`](https://github.com/aanasmahfouz/figma-clone/blob/main/components/live.tsx) (Collaboration UI), [`liveblocks.config.ts`](https://github.com/aanasmahfouz/figma-clone/blob/main/liveblocks.config.ts) (Presence and storage), [`lib/canvas.ts`](https://github.com/aanasmahfouz/figma-clone/blob/main/lib/canvas.ts) (Fabric canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Editor entry"]
  node_page["Editor page<br/>[page.tsx]"]
  node_layout["Root layout<br/>[layout.tsx]"]
  node_room["Room setup<br/>[room.tsx]"]
  node_editor["Editor orchestrator<br/>[app.tsx]"]
end

subgraph group_canvas["Canvas editing"]
  node_fabric["Fabric canvas<br/>[canvas.ts]"]
  node_shape_ops["Shape creation<br/>[shapes.ts]"]
  node_keyboard["Keyboard actions<br/>[key-events.ts]"]
  node_pdf_export["PDF export<br/>[export.tsx]"]
end

subgraph group_collaboration["Live collaboration"]
  node_live_ui["Collaboration UI<br/>[live.tsx]"]
  node_presence["Presence and storage"]
  node_users["Active users<br/>[active-users.tsx]"]
  node_cursor_chat["Cursor chat<br/>[cursor-chat.tsx]"]
  node_cursors["Live cursors<br/>[live-cursors.tsx]"]
  node_reactions["Flying reactions"]
end

subgraph group_comments["Spatial comments"]
  node_comment_tool["Thread placement<br/>[new-thread.tsx]"]
  node_pinned_composer["Pinned composer"]
  node_comment_threads["Comment threads<br/>[comments.tsx]"]
  node_comment_overlay["Comment overlay"]
end

subgraph group_interface["Editor interface"]
  node_inspector["Design inspector<br/>[right-sidebar.tsx]"]
  node_layers["Layer list<br/>[left-sidebar.tsx]"]
  node_toolbar["Editor toolbar<br/>[navbar.tsx]"]
  node_shape_menu["Shape menu<br/>[shapes-menu.tsx]"]
end

node_designer(("Designer"))
node_live_service["Liveblocks service"]

node_designer -->|"opens"| node_page
node_page -->|"loads"| node_editor
node_layout -->|"wraps in"| node_room
node_editor -->|"initializes and renders"| node_fabric
node_editor -->|"syncs drawn shapes"| node_shape_ops
node_fabric -->|"creates shapes"| node_shape_ops
node_editor -->|"dispatches delete"| node_keyboard
node_editor -->|"renders"| node_inspector
node_editor -->|"renders"| node_layers
node_editor -->|"renders"| node_live_ui
node_editor -.->|"provides editor controls"| node_toolbar
node_toolbar -->|"renders"| node_shape_menu
node_toolbar -->|"opens"| node_comment_tool
node_inspector -->|"offers export"| node_pdf_export
node_fabric -.->|"exports canvas"| node_pdf_export
node_room -.->|"configures room"| node_presence
node_editor -->|"mutates shared shapes"| node_presence
node_presence -->|"syncs presence and storage"| node_live_service
node_live_ui -->|"uses collaboration hooks"| node_presence
node_live_ui -->|"renders"| node_cursors
node_live_ui -->|"renders"| node_cursor_chat
node_live_ui -->|"renders"| node_reactions
node_live_ui -->|"renders"| node_comment_threads
node_presence -.->|"supplies collaborator state"| node_users
node_comment_tool -->|"renders"| node_pinned_composer
node_comment_tool -->|"creates threads"| node_presence
node_comment_overlay -.->|"displays threads"| node_comment_threads
node_live_service -.->|"broadcasts presence"| node_cursors
node_live_service -.->|"broadcasts reactions"| node_reactions

click node_page "https://github.com/aanasmahfouz/figma-clone/blob/main/app/page.tsx"
click node_layout "https://github.com/aanasmahfouz/figma-clone/blob/main/app/layout.tsx"
click node_room "https://github.com/aanasmahfouz/figma-clone/blob/main/app/room.tsx"
click node_editor "https://github.com/aanasmahfouz/figma-clone/blob/main/app/app.tsx"
click node_fabric "https://github.com/aanasmahfouz/figma-clone/blob/main/lib/canvas.ts"
click node_shape_ops "https://github.com/aanasmahfouz/figma-clone/blob/main/lib/shapes.ts"
click node_keyboard "https://github.com/aanasmahfouz/figma-clone/blob/main/lib/key-events.ts"
click node_inspector "https://github.com/aanasmahfouz/figma-clone/blob/main/components/right-sidebar.tsx"
click node_layers "https://github.com/aanasmahfouz/figma-clone/blob/main/components/left-sidebar.tsx"
click node_toolbar "https://github.com/aanasmahfouz/figma-clone/blob/main/components/navbar.tsx"
click node_shape_menu "https://github.com/aanasmahfouz/figma-clone/blob/main/components/shapes-menu.tsx"
click node_pdf_export "https://github.com/aanasmahfouz/figma-clone/blob/main/components/settings/export.tsx"
click node_live_ui "https://github.com/aanasmahfouz/figma-clone/blob/main/components/live.tsx"
click node_presence "https://github.com/aanasmahfouz/figma-clone/blob/main/liveblocks.config.ts"
click node_users "https://github.com/aanasmahfouz/figma-clone/blob/main/components/users/active-users.tsx"
click node_cursor_chat "https://github.com/aanasmahfouz/figma-clone/blob/main/components/cursor/cursor-chat.tsx"
click node_cursors "https://github.com/aanasmahfouz/figma-clone/blob/main/components/cursor/live-cursors.tsx"
click node_reactions "https://github.com/aanasmahfouz/figma-clone/blob/main/components/reaction/flying-reaction.tsx"
click node_comment_tool "https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/new-thread.tsx"
click node_pinned_composer "https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/pinned-composer.tsx"
click node_comment_threads "https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/comments.tsx"
click node_comment_overlay "https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/comments-overlay.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_page,node_layout,node_room,node_editor toneBlue
class node_fabric,node_shape_ops,node_keyboard,node_pdf_export toneAmber
class node_live_ui,node_presence,node_users,node_cursor_chat,node_cursors,node_reactions toneMint
class node_comment_tool,node_pinned_composer,node_comment_threads,node_comment_overlay toneRose
class node_inspector,node_layers,node_toolbar,node_shape_menu,node_designer,node_live_service toneIndigo
```

## Components

### Editor entry

- [Editor page](https://github.com/aanasmahfouz/figma-clone/blob/main/app/page.tsx): `app/page.tsx`
- [Root layout](https://github.com/aanasmahfouz/figma-clone/blob/main/app/layout.tsx): `app/layout.tsx`
- [Room setup](https://github.com/aanasmahfouz/figma-clone/blob/main/app/room.tsx): `app/room.tsx`
- [Editor orchestrator](https://github.com/aanasmahfouz/figma-clone/blob/main/app/app.tsx): `app/app.tsx`

### Canvas editing

- [Fabric canvas](https://github.com/aanasmahfouz/figma-clone/blob/main/lib/canvas.ts): `lib/canvas.ts`
- [Shape creation](https://github.com/aanasmahfouz/figma-clone/blob/main/lib/shapes.ts): `lib/shapes.ts`
- [Keyboard actions](https://github.com/aanasmahfouz/figma-clone/blob/main/lib/key-events.ts): `lib/key-events.ts`
- [PDF export](https://github.com/aanasmahfouz/figma-clone/blob/main/components/settings/export.tsx): `components/settings/export.tsx`

### Live collaboration

- [Collaboration UI](https://github.com/aanasmahfouz/figma-clone/blob/main/components/live.tsx): `components/live.tsx`
- [Presence and storage](https://github.com/aanasmahfouz/figma-clone/blob/main/liveblocks.config.ts): `liveblocks.config.ts`
- [Active users](https://github.com/aanasmahfouz/figma-clone/blob/main/components/users/active-users.tsx): `components/users/active-users.tsx`
- [Cursor chat](https://github.com/aanasmahfouz/figma-clone/blob/main/components/cursor/cursor-chat.tsx): `components/cursor/cursor-chat.tsx`
- [Live cursors](https://github.com/aanasmahfouz/figma-clone/blob/main/components/cursor/live-cursors.tsx): `components/cursor/live-cursors.tsx`
- [Flying reactions](https://github.com/aanasmahfouz/figma-clone/blob/main/components/reaction/flying-reaction.tsx): `components/reaction/flying-reaction.tsx`

### Spatial comments

- [Thread placement](https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/new-thread.tsx): `components/comments/new-thread.tsx`
- [Pinned composer](https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/pinned-composer.tsx): `components/comments/pinned-composer.tsx`
- [Comment threads](https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/comments.tsx): `components/comments/comments.tsx`
- [Comment overlay](https://github.com/aanasmahfouz/figma-clone/blob/main/components/comments/comments-overlay.tsx): `components/comments/comments-overlay.tsx`

### Editor interface

- [Design inspector](https://github.com/aanasmahfouz/figma-clone/blob/main/components/right-sidebar.tsx): `components/right-sidebar.tsx`
- [Layer list](https://github.com/aanasmahfouz/figma-clone/blob/main/components/left-sidebar.tsx): `components/left-sidebar.tsx`
- [Editor toolbar](https://github.com/aanasmahfouz/figma-clone/blob/main/components/navbar.tsx): `components/navbar.tsx`
- [Shape menu](https://github.com/aanasmahfouz/figma-clone/blob/main/components/shapes-menu.tsx): `components/shapes-menu.tsx`

### Other components

- **Designer**
- **Liveblocks service**

## Connections

- Designer → Editor page: opens
- Editor page → Editor orchestrator: loads (evidence: `app/page.tsx`)
- Root layout → Room setup: wraps in (evidence: `app/layout.tsx`)
- Editor orchestrator → Fabric canvas: initializes and renders (evidence: `app/app.tsx`)
- Editor orchestrator → Shape creation: syncs drawn shapes (evidence: `app/app.tsx`)
- Fabric canvas → Shape creation: creates shapes (evidence: `lib/canvas.ts`)
- Editor orchestrator → Keyboard actions: dispatches delete (evidence: `app/app.tsx`)
- Editor orchestrator → Design inspector: renders (evidence: `app/app.tsx`)
- Editor orchestrator → Layer list: renders (evidence: `app/app.tsx`)
- Editor orchestrator → Collaboration UI: renders (evidence: `app/app.tsx`)
- Editor orchestrator → Editor toolbar: provides editor controls (evidence: `app/app.tsx`)
- Editor toolbar → Shape menu: renders (evidence: `components/navbar.tsx`)
- Editor toolbar → Thread placement: opens (evidence: `components/navbar.tsx`)
- Design inspector → PDF export: offers export (evidence: `components/right-sidebar.tsx`)
- Fabric canvas → PDF export: exports canvas
- Room setup → Presence and storage: configures room
- Editor orchestrator → Presence and storage: mutates shared shapes (evidence: `app/app.tsx`)
- Presence and storage → Liveblocks service: syncs presence and storage
- Collaboration UI → Presence and storage: uses collaboration hooks (evidence: `components/live.tsx`)
- Collaboration UI → Live cursors: renders (evidence: `components/live.tsx`)
- Collaboration UI → Cursor chat: renders (evidence: `components/live.tsx`)
- Collaboration UI → Flying reactions: renders (evidence: `components/live.tsx`)
- Collaboration UI → Comment threads: renders (evidence: `components/live.tsx`)
- Presence and storage → Active users: supplies collaborator state (evidence: `components/users/active-users.tsx`)
- Thread placement → Pinned composer: renders (evidence: `components/comments/new-thread.tsx`)
- Thread placement → Presence and storage: creates threads (evidence: `components/comments/new-thread.tsx`)
- Comment overlay → Comment threads: displays threads
- Liveblocks service → Live cursors: broadcasts presence
- Liveblocks service → Flying reactions: broadcasts reactions
