Home
← All questions

Design a drawing tool (like Excalidraw/Figma-lite) | Frontend System Design

HardPremiumSystem Design

Frontend System Design interview practice: Frontend system design for a canvas-based drawing/whiteboard application.

Problem

Design the frontend of a drawing tool like Excalidraw or a lightweight Figma: an infinite canvas where people draw shapes, arrows, text and freehand strokes, select, move, resize and rotate them, undo anything, and optionally edit the same board together, seeing each other's cursors.

Interviewers use it to test rendering choices and performance at 60 frames per second, how you model a scene, handle pointer input and hit testing without the DOM's help, build undo and redo, keep many collaborators consistent, and make a visual canvas usable from a keyboard and a screen reader.

Functional requirements

  • Create and edit elements: shapes, arrows that stick to shapes, freehand strokes, text and images; select, move, resize, rotate, group, reorder and style them; undo and redo.
  • Pan and zoom smoothly on an infinite canvas.
  • Collaborate live with others on the same board, and keep working offline.
  • Export to PNG, SVG and a file that can be imported again.

Constraints

  • Boards with up to about 10,000 elements, and zoom from 10% to 3,000%.
  • Drawing, dragging, panning and zooming run at 60 frames per second, and the pen's ink keeps up with a stylus.
  • Up to about 20 people on one board; changes reach others within about 200 ms, and every client ends up with the same board.
  • No stroke is lost on a refresh, a crash, a dropped connection or offline work.
  • Mouse, trackpad, touch and stylus, and accessible to WCAG 2.2 AA as far as a canvas allows.

Discussion areas

  • Core entities and key actions: what the board, elements, files, camera, selection and presence are, and which user actions shape the design.
  • Rendering: DOM, SVG, Canvas or WebGL for the scene, and how to keep every frame within budget.
  • Architecture: the layers between UI components, the scene, rendering and the server, and the component tree.
  • Scene model: how to store elements, positions, rotation, order and groups.
  • Input and tools: pointer events, hit testing, selection handles, snapping and freehand strokes.
  • History: undo and redo, alone and with collaborators.
  • Collaboration: how changes and cursors travel, how conflicts resolve, and how deleted elements stay deleted.
  • Persistence and offline: saving, opening fast, export and import, and working without a connection.
  • Performance at scale: thousands of elements, deep zoom, and big exports.
  • Accessibility: using a canvas app with a keyboard and a screen reader, and alternatives to dragging.

Follow-up questions interviewers ask

  • Canvas, SVG or DOM?
  • Why two canvases?
  • How do you hit test on a canvas?
  • How do you keep 60 fps with 10,000 elements?
  • How does undo work with several people?
  • Why versions and nonces instead of timestamps?
  • Why not a CRDT?
  • How do you make a canvas accessible?
Premium question

Unlock the full model solution for this question with Mentoxis Premium.

Unlock with Premium