Skip to content
System Design Explorer
Company architectureadvanced

Figma System Design

Multiplayer design editing in the browser, and Postgres sharded 100x

By Ankur NayakReviewed

How Figma lets many people edit the same design at once: each open document gets its own server process that is the single authority, conflicts resolve per property with last-writer-wins, and ordering uses fractional indexes. Around it, Figma's metadata grew almost 100x in four years and moved from one Postgres instance to horizontally sharded Postgres.

Open in Studio· edit a copy
Database growth
Almost 100x
Vertical partitions
A dozen
First sharded table
Sept 2023
Cache uptime
Six nines
Figma system design architecture diagramComponents: Browser Editor, Collaborator's Editor, Multiplayer (Document servers), File Storage, Application Services, DBProxy (Go), Sharded Postgres (RDS), FigCache (Redis). Connections: Browser Editor to Multiplayer (changes); Multiplayer to Collaborator's Editor (broadcast); Browser Editor to File Storage (download file); Multiplayer to File Storage (persist); Browser Editor to Application Services (comments, teams); Application Services to DBProxy (SQL); DBProxy to Sharded Postgres (route by shard key); Application Services to FigCache (cache).Browser EditorClientCollaborator's EditorClientMultiplayerDocument serversFile StorageObject storageApplication ServicesAPI gatewayDBProxyGoSharded PostgresRDSFigCacheRedis

Requirements

Functional

  • Let many people edit the same file at the same time and see each other's changes live
  • Let people keep working offline and merge their edits on reconnect
  • Undo and redo that behave sensibly with other people editing
  • Store comments, users, teams, projects and file metadata

Non-functional

  • Changes appear for everyone in real time
  • Every client converges to the same document
  • Metadata storage that keeps scaling with very fast growth
  • Database changes with almost no downtime

In depth

Many cursors, one document

Figma made real-time collaboration the default for design: several people in the same file, each seeing the others' cursors and edits as they happen, in a browser. Figma's co-founder Evan Wallace explained how it works in two posts (2017 on ordering, 2019 on multiplayer), and the company has since written about scaling the Postgres databases behind the rest of the product (2024) and its caching layer (2026). This page covers both halves: the live document and the metadata around it.

The document model

A Figma document is a tree of objects, much like the HTML DOM: a page contains frames, frames contain groups and shapes. Each object has an ID and a set of properties with values. Figma describes the whole document as a two-level map: Map<ObjectID, Map<Property, Value>>. Changing a rectangle's colour sets one property on one object.

That model is the key to everything that follows, because it turns most conflicts into non-conflicts. If Alice changes a shape's colour while Bob changes its width, they are editing different properties, and both changes simply apply.

One process per document

Figma clients are web pages that talk to a cluster of servers over WebSockets. When people open a multiplayer document, the server starts a separate process for that document, and everyone editing it connects to that process. The server is the central authority: it defines the order of changes. Figma's 2018 post on Rust describes this per-document process being rewritten in Rust, running as a child of a Node.js host that kept the networking.

When two people do change the same property of the same object at the same moment, the server keeps whichever value it receives last: last-writer-wins per property. Figma's post compares this to a last-writer-wins register from the CRDT literature, but explains that Figma isn't using true CRDTs: because the server is the authority and orders changes, it can drop the extra machinery CRDTs need for decentralised merging. See collaborative editing.

Making it feel instant

Clients apply their own changes immediately, without waiting for the server. That creates a subtle problem: an older value from the server can arrive after you've made a newer local change and briefly overwrite it, causing flicker. Figma's rule is that a client discards incoming server changes that conflict with its own unacknowledged property changes. Once the server acknowledges a change, the client goes back to trusting the server's values.

Some operations need more care:

  • Creating and deleting objects are explicit actions. The server doesn't keep the properties of deleted objects; they live in the undo buffer of the client that deleted them, so undo can restore them.
  • Reparenting (moving an object into another group) is stored as a property on the child. Two concurrent moves could create a cycle, A inside B and B inside A, so the server rejects any parent change that would cause one. Until the rejection arrives, clients temporarily detach the affected objects.
  • Undo and redo follow a principle: undoing a lot, copying something and redoing back to the present shouldn't change the document.
  • Offline: Figma lets you keep editing for an arbitrary amount of time offline. When you reconnect, the client downloads a fresh copy of the document and reapplies your offline edits on top.

Ordering with fractional indexes

Layers have an order, and people reorder them constantly. Figma's 2017 post describes fractional indexing: every object has a position that is a fraction between 0 and 1, and children are sorted by it. Inserting an object between two others means choosing a value between theirs, typically the average. Reordering touches just one value, and there's no renumbering of siblings.

Figma stores these indexes as arbitrary-precision fractions written as strings (in base 95, without the leading "0."), avoiding the precision limits of 64-bit floats. Two drawbacks are acknowledged: indexes can grow long, and concurrent inserts at the same spot can interleave. If two clients choose the same index, the server assigns a unique one. The post contrasts this with operational transformation, where adding operation types makes the implementation quadratically more complex.

Everything else: Postgres

Comments, users, teams and projects aren't part of the multiplayer system; they're stored in Postgres. Figma's 2024 post describes what happened as that database grew almost 100x after 2020.

In 2020 Figma ran a single Postgres database on AWS's largest physical instance. By the end of 2022 it had caching, read replicas and a dozen vertically partitioned databases, each holding groups of related tables such as files or organizations. But vertical partitioning can't help once a single table outgrows a database, so Figma built horizontal sharding:

  • Tables are grouped into colos (colocations) that share a sharding key such as UserID, FileID or OrgID, and joins are allowed only within a colo on the sharding key.
  • Rows are routed by a hash of the sharding key.
  • Logical sharding is separated from physical sharding. Logical shards were first represented as Postgres views over the existing table, so traffic could be routed through them and rolled back in seconds before any data moved.
  • DBProxy, a new Go service between the application and PgBouncer, parses each query, plans it and routes it to the right shard or shards.
  • A shadow application readiness framework predicted how real traffic would behave under candidate sharding keys.

The first horizontally sharded table shipped in September 2023, with only ten seconds of partial availability on database primaries; the first table took roughly nine months. See online migrations.

Caching

In 2026 Figma described FigCache, a stateless proxy that speaks the Redis protocol in front of a fleet of ElastiCache Redis clusters, used for ephemeral data and caching. After rolling it out for all Redis traffic from the main API service, connection counts on the Redis clusters dropped by an order of magnitude, and the layer has achieved six nines of uptime.

The trade-offs

A central server per document makes conflict resolution simple and predictable, but real-time collaboration depends on that server being reachable. Per-property last-writer-wins means most concurrent edits never conflict, but two edits to the same property silently keep only one. Fractional indexing makes moves cheap, at the cost of growing index strings. On the metadata side, Figma chose to shard Postgres itself rather than adopt a new distributed database, preserving its operational experience at the price of building a query proxy.

Compare with Notion, which also sharded Postgres but by workspace, in application code.

What to take into an interview

  • Model the document as objects with properties, so most concurrent edits don't conflict
  • Use one authoritative process per document to order changes
  • Apply local edits immediately; ignore server values that conflict with your unacknowledged changes
  • Reject structural changes that would create cycles
  • Order siblings with fractional indexes
  • Keep metadata in a sharded relational store, and make sharding reversible before moving data

Components

Browser Editor

Client. The Figma web app. Applies your edits locally right away and syncs them over a WebSocket.

Collaborator's Editor

Client. Another person with the same file open.

Multiplayer

Document servers

Realtime gateway. A cluster of servers that clients talk to over WebSockets. Each open multiplayer document gets its own process, which everyone editing it connects to. The server is the central authority that orders changes.

Why: Because one server orders every change, Figma doesn't need the extra machinery of true CRDTs or operational transformation.

Building block: Collaborative Editing (OT & CRDTs), WebSockets & Persistent Connections

Document Process

Rust

Service. One process per open document. In 2018 Figma rewrote this child process in Rust; it talks to a Node.js host that handles networking.

Property Resolver

Service. Keeps the latest value any client has sent for each property of each object: last-writer-wins in the order the server receives changes.

Tree Validator

Service. Parent links are a property of the child. The server rejects parent changes that would create a cycle.

Fractional Index Order

Service. Each child's position is a fraction between 0 and 1; inserting between two objects uses a value between theirs. The server breaks ties when two clients pick the same index.

File Storage

inferred

Object storage. Where document contents are persisted between sessions. When a document is opened, the client downloads a copy of the file. Figma's posts don't describe this store.

Application Services

API gateway. Figma's main API and application services for everything outside the live document: comments, users, teams, projects and file metadata.

DBProxy

Go

Service. A Go service between the application and PgBouncer: its query engine parses each query, plans it and routes it to the right shard or shards.

Building block: Database Sharding

PgBouncer

Load balancer. Connection pooling in front of the Postgres instances.

Sharded Postgres

RDS

SQL database. Metadata in Postgres on AWS RDS: from one instance in 2020, to a dozen vertically partitioned databases by end of 2022, to horizontally sharded tables grouped into 'colos' by sharding keys such as UserID, FileID or OrgID.

Building block: Database Sharding, Online Migrations

FigCache

Redis

Cache. A stateless proxy speaking the Redis protocol in front of a fleet of ElastiCache Redis clusters, for Figma's ephemeral data and caching. Connection counts dropped by an order of magnitude after rollout.

Building block: Cache

Request flows

Edit together in real time

  1. Alice opens a file; her client downloads a copy of the document.
  2. She connects to the document's process over a WebSocket and moves a frame. Her screen updates immediately.
  3. The server records the new property value and broadcasts it to Bob's editor.
  4. The server acknowledges Alice's change; until then her client ignores incoming values that conflict with it, avoiding flicker.
  5. The document is saved so it can be reopened later.

Edit offline, then reconnect

  1. Alice loses her connection on a train but keeps editing; changes stay local.
  2. When she reconnects, her client downloads a fresh copy of the document.
  3. It reapplies her offline edits on top and sends them; last-writer-wins merges them with everyone else's.

Leave a comment

  1. Bob comments on a frame; comments aren't part of the multiplayer document.
  2. The API sends the query to DBProxy.
  3. DBProxy hashes the sharding key and routes the write to the shard that owns it.

Failure scenarios

What if: a multiplayer server dies?

Clients lose the WebSocket. Because each client keeps its own unsaved changes and can work offline, it reconnects, downloads a fresh copy and reapplies its pending edits, the same path as coming back online.

User impact: A brief 'reconnecting' state; no lost work.

  • Clients keep unacknowledged changes
  • Reconnect and reapply

What if: a table outgrows its database?

Vertical partitioning moves whole tables to their own databases, but it can't help once a single table outgrows one database. Figma sharded such tables horizontally, first logically with Postgres views, then physically, with a failover that caused only ten seconds of partial availability.

User impact: Without sharding: rising latency and eventual write failures.

  • Logical sharding via views before physical moves
  • Shadow application readiness checks
  • DBProxy routing and planning

Trade-offs

A central server instead of true CRDTs

Make one process per document the authority, and resolve conflicts per property in the order it receives them.

Pros
  • Simpler than OT or full CRDTs
  • Easy to reason about: everyone converges on the server's order
Cons
  • Needs a live server for real-time collaboration
  • Every document's traffic goes through one process

Per-property last-writer-wins

Treat each property of each object as an independent register.

Pros
  • Two people editing different properties never conflict
  • Cheap to apply and broadcast
Cons
  • Concurrent edits to the same property silently keep only the last

Fractional indexing for order

Give every child a fractional position and insert between neighbours by averaging.

Pros
  • A move edits one value
  • No need to renumber siblings
Cons
  • Index strings can grow long
  • Concurrent inserts at the same spot may interleave

Shard Postgres instead of switching databases

Build horizontal sharding on RDS Postgres with a Go query proxy, rather than adopt a new distributed database.

Pros
  • Keeps years of Postgres operating experience
  • Incremental, reversible rollout with views
Cons
  • About nine months to shard the first table
  • Cross-shard queries need a query engine

Frequently asked questions

How does Figma's multiplayer work?

Clients connect over WebSockets to a server process dedicated to each open document. The server is the central authority: it keeps the latest value received for every property of every object and broadcasts changes. Conflicts on the same property resolve as last-writer-wins in the server's order.

Does Figma use CRDTs or operational transformation?

Not true CRDTs. Figma's 2019 post says each property behaves like a last-writer-wins register from the CRDT literature, but because a central server orders all changes, Figma can skip the extra overhead true CRDTs need for decentralised merging.

What is fractional indexing?

A way to order items where each item's position is a fraction between 0 and 1. To insert between two items you pick a value between their positions, so a move only changes one item's index. Figma stores these as arbitrary-precision strings.

How did Figma scale Postgres?

From a single RDS instance in 2020, Figma split related tables into a dozen vertical partitions by the end of 2022, then sharded tables horizontally by keys such as UserID, FileID and OrgID. A Go service, DBProxy, parses and routes queries to the right shard. The first horizontally sharded table shipped in September 2023.

Building blocks used

Sources