Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Figma 13 min read Opinion easyNovice

How Figma draws inspiration from the gaming world

Figma's architecture resembles a game engine more than a typical web stack: a C++ canvas compiled to WebAssembly for 2D rendering, a React/TypeScript UI layer, and a Rust multiplayer server, plus layered systems for multiplayer, animation, collisions, chat and plugins. Because these systems are interdependent, bugs cross boundaries; a layout change from six months earlier made FigJam connectors oscillate between clients, flooding multiplayer messages and overloading autosave. Making FigJam tables collaborative without locking required resolving concurrent edits and adding an animation system so observers can follow row and column moves.

Related posts

  • Figma rendering: Powered by WebGPU

    Figma mediumAdept

    Figma migrated its C++ renderer from WebGL to WebGPU while keeping WebGL as a fallback, first refactoring its graphics interface to pass draw-call state explicitly and to batch uniform uploads into a single buffer per submit to avoid performance regressions. Legacy WebGL 1 GLSL shaders are kept and automatically translated to WGSL via a custom shader processor plus naga, and Dawn is used for both the Emscripten/Wasm build and native server-side builds. Because WebGPU only supports asynchronous readback and can fail mid-session on Windows, Figma built a dynamic fallback that swaps backends to WebGL at runtime and blocklists devices by fallback rate. Benchmarks across Windows, Mac and ChromeOS showed gains on some device classes and neutral results elsewhere with no regressions, and compute shaders, MSAA and RenderBundles are next.

  • Keeping Figma fast

    Figma mediumAdept

    Figma replaced its single-MacBook performance testing setup with two systems sharing one CI scheduler. The first runs end-to-end tests in headless Chromium on GPU-enabled cloud VMs for every pull request, finishes within 10 minutes through parallel runs, and uses a 20% pass margin to catch large regressions despite VM noise. The second is a small fleet of older real laptops for on-demand runs such as bisecting subtle regressions and benchmarking hot-path optimizations. Instruction counting and a full device farm were rejected because Figma's WASM/WebGL workload is bound variously by CPU, GPU and I/O. Case studies show the setup validating rendering time-slicing that prioritizes local edits over remote multiplayer changes, improving perceived frame rate on slow devices.

  • Create a Figma Clone app with Flutter and Supabase Realtime

    Supabase mediumAdept

    A collaborative design canvas, a simplified Figma, built by combining Supabase Realtime Broadcast for low-latency client-to-client messaging with Flutter's CustomPainter for low-level canvas rendering. Users can draw circles and rectangles, drag them around, and see each other's cursors live, while canvas state persists to a Postgres table of JSONB objects behind simple RLS policies. The walkthrough covers project setup, a SyncedObject class hierarchy with JSON serialization and hit-testing, and a custom painter that renders cursors and shapes. Auth is skipped and users get random UUIDs.

  • Speeding up file load times, one page at a time

    Figma mediumAdept

    Figma extended dynamic page loading from view-only files and prototypes to editable files, cutting load times for the slowest 5% of loads by 33% and reducing client memory. Editing requires write dependencies as well as read dependencies. These are the inverse edges that let an edit to a component, style or variable propagate to cached derived data on instances and auto layout frames, which may sit on unloaded pages. The QueryGraph dependency framework in the multiplayer server became a bidirectional graph with explicit foreign-key edges and implicit edges such as auto layout. The server uses it to compute each session's reachable subset as collaborators edit, and a shadow-mode validator flagged edits outside the computed write set, uncovering missed cross-page dependencies before launch.

  • The evolution of Figma’s mobile engine: Compiling away our custom programming language

    Figma mediumAdept

    Figma migrated its prototype viewer's mobile engine from Skew, an in-house compile-to-JavaScript language, to TypeScript using a custom Skew-to-TypeScript transpiler and a three-phase rollout (write/build Skew, write Skew/build TypeScript, write/build TypeScript) that never paused development. The move became viable once mobile WebAssembly support let hot paths move to the C++ engine, removing the need for Skew's optimizing compiler. Transpiler pitfalls included slow JavaScript array destructuring (direct indexing improved per-frame latency by up to 25%), behavior differences from Skew's devirtualization that broke Smart Animate on null receivers, and TypeScript's initialization-order rules. Source maps were maintained so developers could keep debugging throughout.

The quest for software engineering knowledge.

Look:
Layout: