

Omkar
162 posts

@omkar_builds
Curious mind First Principles thinker chasing rabbit-holes Backend | AI | Open Source | Algorithms | Infra







🌅 Morning Guys, First off, a massive shoutout to @Hi_Mrinal—you really inspired me to get my curiosity back and start diving deep into engineering blogs again. Thanks for the spark, buddy! 🙌 Putting that curiosity right to work, I spent yesterday reading Figma’s famous write-up on their multiplayer architecture, and it absolutely made my day. I went in with a pretty naive mental model. I was thinking: "How difficult could it really be? You just sync some JSON state over a WebSocket, resolve a few conflicts, and call it a day, right?" By paragraph three, I was hit with Operational Transformations (OT), CRDTs, fractional indexing, and reparenting cycle detection. Instead of feeling overwhelmed, my curiosity absolutely spiked. The engineering rabbit hole was fascinating. Here is the story of how they solved it: ❌ [THE GOOGLE DOCS TRAP] ━━━━━━━━━━━━━━━━━━━━━━ My first thought was, "Google Docs solved multiplayer a decade ago, why not just copy their homework?" Google Docs uses Operational Transformation (OT). It’s brilliant for fine-grained text editing, but the mathematical correctness proofs required for OT absolutely explode in complexity just for simple insert/delete operations. Figma isn't a text editor; it's a canvas of objects. Implementing OT would have been a massive bottleneck. ✳️ [THE PURE CRDT ILLUSION] ━━━━━━━━━━━━━━━━━━━━━━ So, if not OT, then you might think this is a classic use-case for CRDTs (Conflict-free Replicated Data Types). But even that isn't true! Pure CRDTs are explicitly designed for completely decentralized, peer-to-peer systems where nobody is in charge. Figma realized they didn't need that. They have a server, a central authority already exists. So, they built a beautiful hybrid approach. They adopted the mathematical convergence guarantees of CRDTs, but dropped the heavy overhead required for true decentralization. ↳ The ultimate takeaway: The "standard" textbook algorithm isn't always the right answer. Your specific architecture and constraints dictate the solution. THE FOUR PILLARS If you want to see a masterclass in practical system design, you should definitely read the full blog. They break down the architecture into these four specific problems: ▹ Syncing Object Properties (Surgical diffs over full state) ▹ Syncing Trees of Objects (Detecting infinite reparenting cycles) ▹ Reordering Objects (The magic of fractional indexing) ▹ Implementing Undo Let me tell you... that last point on Undo is the most mind-bending piece of logic I've read in a long time. The way they dynamically recalculate history stacks the exact second you press "Undo" to protect your coworkers' edits is pure genius. Highly recommend giving it a read! » figma.com/blog/how-figma…





