Design a Drawing Tool like Figma
Problem statement
Design a Figma-style drawing tool with a scene graph, high-frequency canvas interactions, hit testing, layers, snapping, undo, and autosave.
Asked In
Key Challenges
- ·Canvas coordinate transforms for pan, zoom, selection, and hit testing
- ·Rendering many vector nodes without blocking pointer feedback
- ·Layer ordering, grouping, snapping, resize, and rotate interactions
- ·Undoable edit commands with autosave and conflict-aware sync
- ·Accessible non-pointer alternatives for a visual canvas
2-Minute Answer — High-Level TL;DR
Read this before your interview
HLD Interview Focus
I would model the document as a scene graph with stable node ids, z-order, transforms, and styles. The viewport owns pan and zoom; an interaction controller owns transient drag, resize, marquee, and snap state; a renderer paints the committed scene plus overlays. Pointer moves update lightweight interaction state and render selection outlines immediately, then drop commits a command into history and autosave. Hit testing uses transformed bounds and a spatial index so large canvases remain responsive. React is useful for toolbars, layer panels, inspectors, and document chrome, while canvas or WebGL handles the dense scene rendering path.
My Approach: Building the Solution
How to think about this problem
I'll start from dragging 500 nodes at once — what runs at 60fps — then design scene graph, hit test spatial index, and tool state.
Why This Approach?
Most candidates stack absolute divs. Strong answers separate scene graph, hit testing, and a render loop that stays at interactive frame rates under pan/zoom.
Think of the UI as a camera looking at a scene graph: moving the camera is not the same as moving a shape.
Requirements: What Makes a Great Solution?
Clarify scope before designing anything
Requirements Exploration Questions
Ask your interviewer these questions to refine requirements
What object types are supported?
- ·Rectangles, text, pen paths, images, frames
- ·Groups, components, and constraints
- ·Vector precision vs whiteboard looseness
Which editing interactions are core?
- ·Select, multi-select, pan, zoom, resize, rotate
- ·Snap guides, align, duplicate, reorder
- ·Touch, stylus, and keyboard expectations
What scale is required?
- ·Nodes per page
- ·Nested layer depth
- ·Artboards and multiple pages
What persistence and collaboration level?
- ·Local autosave
- ·Versioned cloud saves
- ·Presence and concurrent edits as follow-up
What accessibility scope?
- ·Layer tree operations
- ·Inspector forms
- ·Keyboard nudge and arrange actions
Functional Requirements
Must Have — MVP
- ✓Infinite or artboard canvas with pan and zoom
- ✓Create, select, move, resize, rotate, group, and delete shapes
- ✓Layer panel and properties inspector
- ✓Undo, redo, autosave, loading, and save-error states
- ✓Snap guides and visible selection handles
- ✓Keyboard-accessible layer operations and inspector controls
Advanced (If Time Permits)
- +Pen paths and boolean operations
- +WebGL renderer or worker-backed rasterization
- +Multiplayer presence and comments
- +Export PNG, SVG, and copy-paste
Non-Functional Requirements
Performance Targets
- ·Pointer feedback updates in one frame
- ·Zoom and pan stay smooth on large documents
- ·Offscreen or tiny nodes avoid unnecessary work
- ·Text editing isolates browser DOM overlays from canvas paint
Reliability & Consistency
- ·Undo restores node order and selection
- ·Autosave retries idempotent command batches
- ·Renderer recovers after asset load failure
- ·Conflicting remote versions do not drop local work
Accessibility & Input Support
- ·Keyboard-first flows with visible focus and predictable tab order
- ·Screen-reader announcements for async changes using aria-live where appropriate
- ·Reduced-motion alternatives for animated transitions
- ·Pointer, touch, and keyboard parity for every core action
Security & Privacy
- ·Sanitize imported SVG and external image references
- ·Restrict clipboard HTML and file decoding
- ·Do not leak private canvas thumbnails to telemetry
Observability
- ·Track Core Web Vitals plus domain-specific interaction latency
- ·Measure API error rate, retry rate, stale-cache usage, and client exceptions
- ·Emit structured events for critical user journeys and abandoned flows
The full solution is part of HelloFrontend Pro
The question above is free to read in full. Upgrade to unlock the interactive workspace and the senior-level walkthrough that go with it.
- Full RADIO-framework walkthrough with architecture diagrams
- Data model, API design, and rendering strategy trade-offs
- Performance, accessibility, and offline sections plus a model answer
Already a member? Log in to open the workspace.