Latest / The CTO Podcast with Fexingo: Technical Leadership, Architecture, and Engineering Org / How Figma Coexisted With Google Docs
Transcript
- Lucas: So in 2020, Figma launched a feature that let you embed and edit a Figma file directly inside a Google Docs sidebar. No new tab, no pop-out window — it was just there, inside the iframe, rendering pixel-perfect vectors. Luna: I remember that. It felt like magic. But I also remember it quietly disappeared a couple years later. Lucas: Right. And that arc — from 'how did they do that' to 'why did they stop' — is actually a really good window into the kind of architectural trade-offs that CTOs face when you're embedding your software into someone else's platform. Luna: Let's start with the how. Because embedding a full design tool inside a Google Docs iframe — that's not just a CSS tweak. Lucas: No. The core problem was that Figma needed to run its entire application inside a cross-origin iframe. Google Docs lives at docs.google.com. Figma was rendering inside an iframe served from a different domain. And the browser enforces strict same-origin policies around that. Luna: Which means you can't just access the parent document's DOM or JavaScript context. You're basically in a sandbox. Lucas: Exactly. So Figma had to use postMessage — the browser API that lets two windows exchange stringified data across origins. But that's not enough for a real-time collaborative design tool. You need low latency, bidirectional updates, and you need to synchronize state between two separate application clocks. Luna: Two clocks? You mean the Google Docs clock and the Figma iframe clock? Lucas: Yeah. Each application has its own event loop, its own render cycle. When a user moves a rectangle in Figma, the iframe needs to send that delta to the parent Docs window, which then sends it to Figma's servers — but the sequence has to be ordered correctly alongside any Docs-native edits happening at the same time. Luna: And this is where CRDTs come in, right? Conflict-free Replicated Data Types. Lucas: That's the foundation. Figma already used a custom CRDT for multiplayer collaboration inside its own app. But for the Docs integration, they had to extend that CRDT to work across two contexts. Each edit — whether it came from the Docs sidebar or the standalone Figma tab — needed a unique timestamp that both sides could agree on. Luna: How did they get the timestamps to agree across an iframe boundary? postMessage is asynchronous, and there's no shared clock. Lucas: They used a hybrid approach. The parent Docs window acted as the authoritative clock. Every time the iframe sent a message, the parent stamped it with its own server-side timestamp before forwarding it to Figma's backend. That way, the ordering was always determined by the parent's perspective, not the iframe's. Luna: But that introduces latency. The iframe sends a message, the parent stamps it, then forwards it. There's a round-trip before the edit even leaves the browser. Lucas: It does. And Figma accepted that trade-off because the alternative — trying to do peer to peer timestamp negotiation — would have been far more complex and error-prone. They optimized for correctness over raw speed. Luna: Was it fast enough that users didn't notice? Lucas: For most interactions, yes. The visible latency was maybe 100 to 150 milliseconds — comparable to the standalone Figma experience over a good connection. But there was one thing that users definitely noticed: the iframe sandbox broke keyboard shortcuts. Luna: Oh, right. Google Docs owns the global keyboard listener. If you press Command-Z in the Figma iframe, Docs intercepts it first. Lucas: Exactly. Figma had to negotiate a keyboard passthrough protocol. The iframe would listen for key events, but only if the parent explicitly granted it focus. That required a handshake every time the user clicked inside the Figma canvas. It worked — but it was fragile. Luna: I remember sometimes the handshake would fail and you'd be typing 'ctrl-z' into a text layer inside the Doc instead of undoing in Figma. Lucas: Yeah. Those edge cases were hard to eliminate entirely. And the bigger issue was that Google kept updating Docs' own iframe handling code. Each update risked breaking the postMessage protocol that Figma depended on. Luna: So they were maintaining a tightrope integration with a platform they didn't control. Lucas: That's the crux. And eventually, the maintenance burden outweighed the usage. Figma's product team saw that most collaborations were happening inside the standalone app, not inside Docs. The integration was elegant, but it wasn't driving enough new usage to justify the ongoing engineering cost. Luna: And that's the part that's easy to ignore when you're reading a blog post about CRDTs and postMessage — the elegance of the solution doesn't mean it's the right product bet. Lucas: Right. The architecture was brilliant. And it's worth studying because it shows how far you can push browser APIs. But the decision to deprecate it was also smart. A CTO has to know when technical cleverness is serving the product and when it's just a tax on the team. Luna: That feels like a good moment to mention something. These kinds of deep-dive conversations — if they're useful for what you're building or running, a couple of dollars a month is genuinely what keeps these going. Buy me a coffee dot com slash fexingo, if you've gotten something out of them. Lucas: Yeah. It's a small thing that makes a real difference. And it's what keeps this ad-free, which lets us get into the weeds like this. Luna: Alright. Back to the architecture. There's one more layer I want to dig into — how Figma handled the rendering inside the iframe. Lucas: Sure. The iframe was essentially a full screen rendering surface. Figma's entire canvas — the WebGL layer, the vector engine, the hit-testing — all of it ran inside that iframe. The only thing that changed was the chrome around it. The toolbar, the layer panel, that was all Figma's own UI, just smaller. Luna: Did they have to strip down any features to fit in the sidebar? Lucas: They did. They hid the advanced prototyping tools and some of the plugin menus. But the core editing experience — creating rectangles, moving layers, editing text — was identical. They even supported multiplayer cursors inside the iframe. Luna: Multiplayer cursors across an iframe boundary. That's another synchronization problem. Cursor positions are updated at 60 frames per second. Lucas: Yeah, and they couldn't send 60 postMessages per second per user. That would flood the parent's event loop. So they batched cursor updates — sent them every 100 milliseconds, with interpolation on the receiving end to smooth the movement. That's a common pattern in real-time systems: send less, predict more. Luna: Did they ever consider using a SharedWorker or a ServiceWorker to handle the cross-origin coordination? Lucas: They considered it. But SharedWorkers have their own origin restrictions — they're tied to the domain of the page that creates them. A ServiceWorker could intercept requests, but it can't directly manage the real-time message channel between two different origins. postMessage was actually the simplest reliable option. Luna: And the most browser-compatible. postMessage has been around since Internet Explorer 8. Lucas: Exactly. It's battle-tested. The challenge was building a protocol on top of it that could handle out-of-order delivery and dropped messages. They ended up with a sequence-numbered, acknowledged messaging layer — every message had an ID, and the receiver had to ACK it. If the sender didn't get an ACK within a timeout, it retried. Luna: That's basically TCP over postMessage. Lucas: Pretty much. And it was surprisingly robust. The integration ran in production for about two years with very few reported issues. The deprecation wasn't because of technical failures — it was a product call. Luna: Let's talk about that product call. How do you, as a CTO, weigh the cost of maintaining an integration like this? Lucas: You look at three things: the number of active users on the integration, the engineering hours per month required to keep it stable, and the strategic alignment. If Figma was trying to become the default collaboration layer inside Google's productivity suite, then the integration was mission-critical. But if Figma's strategy was to be the standalone design tool of record, then the integration was just a nice to have. Luna: And their strategy was clearly the latter. Lucas: Yeah. So the CTO, Dylan Field, made the call to sunset it gracefully. They gave users a six-month migration window, exported all the embedded files, and shut it down. That's the kind of decision that doesn't get a blog post, but it's as important as any architectural choice. Luna: I think there's a broader lesson here. Engineering teams love solving hard problems. And the Figma-Google Docs integration was a really hard problem. But the best teams also know when to say 'we solved it, and now we're done'. Lucas: Exactly. The architecture was a work of art. But the product decision was the real leadership move.