How Figma’s multiplayer technology works

https://www.figma.com/blog/how-figmas-multiplayer-technology-works/

  • Figma’s architecture is inspired by CRDTs, but doesn’t use “full” CRDTs because a central source of truth (the Figma server) is available to resolve conflicts. This appears to imply that (in the context of a single document, at least) the Figma server itself is a single node, without any replication involved. I wonder if a max-editors-per-doc limit exists for this reason.

  • The team created a prototype environment/sandbox to test interactions of this nature before making changes to Figma’s actual codebase.

  • At a high level, a document has pages, each of which has objects, each of which has properties. If two users edit a property on the same object, this causes a conflict, but any other combination of changes are separate. Property conflicts are handled with LWW, but this is a curious quote:

    we don’t need a timestamp because the server can define the order of events

    Not sure what this means; what about late-arriving events?

  • Cycle detection is possibly a problem while reparenting pages, but this happens rarely enough that their solution is to remove the offending objects from the UI until the cycle is resolved via updates from the server.

  • Relative ordering is handled with fractional indexing; not sure how this works once the precision limit is hit, but this post should have more info.

  1. Portfolio of Basic CRDTs
  2. Rust in Production at Figma

Look Up

  1. Operational Transforms
  2. CRDTs

Notes

Edit