Latest / The CTO Podcast with Fexingo: Technical Leadership, Architecture, and Engineering Org / How Notion Uses Atomic Blocks to Beat Document Chaos
Transcript
- Lucas: If you work in tech, you've probably used Notion. But have you ever stopped to think about what makes it tick? Notion isn't really a document editor — it's a database wearing a document editor's clothes. Luna: I've definitely felt that. You can have a database of tasks inside a page inside a project wiki. It's powerful, but sometimes I wonder how it doesn't just fall apart. Lucas: That's exactly the question. And the answer is something Notion calls the 'atomic block.' Every piece of content in Notion — a paragraph, a heading, a to-do, an image — is a block. And those blocks are the fundamental unit of everything: rendering, syncing, permissions, even the database itself. Luna: So instead of one big document with a bunch of text, you have a list of discrete objects. That sounds a lot like how engineers think about data. Lucas: Right. And it's a deliberate choice. When you open a Notion page, you're not loading a document — you're querying a set of blocks. That's why you can embed a database inside a page, or reference the same block from multiple places. It's composition, not flat text. Luna: If these conversations are useful for what you're building or running, there's a simple way to keep them going and ad-free. Lucas: Yeah, if today's episode was worth a coffee to you, that's the link. Really. It's buy me a coffee dot com slash fexingo. No pressure, no perks, just keeping the lights on. Luna: We don't run ads, so listener support is what keeps this going. And it genuinely helps us spend time on episodes like this one. Lucas: Alright, back to blocks. So the key insight is that every block has a unique ID, a type, and a set of properties. When you edit a paragraph, you're sending a mutation to that specific block. That's what enables real-time collaboration without the whole document locking. Luna: That sounds similar to how Google Docs handles it with operational transform. But Notion uses something different, right? Lucas: Exactly. Google Docs uses OT, which works great for a single stream of text. But Notion's block model lends itself better to a different approach called CRDTs — conflict-free replicated data types. Each block can be edited independently, and CRDTs resolve conflicts mathematically without a central server having to decide who wins. Luna: So if two people edit the same block at the same time, the CRDT merges the changes deterministically. That means no lost edits, even offline. Lucas: Right. And that's a big deal for Notion's offline mode. When you go offline, edits are stored locally as pending operations. When you reconnect, they sync as CRDT mutations. No conflict resolution popups, no 'this version or that version.' It just works. Luna: But I've heard that CRDTs have a downside: they can bloat the data over time. Every edit adds a new operation to the log. Doesn't that get unwieldy? Lucas: It does. That's why Notion periodically compacts the operation log — it takes the current state of each block and creates a snapshot, then discards the history. They also have a garbage collection process for blocks that are deleted. It's not trivial, but it's manageable at their scale. Luna: Let's talk about permissions. Because blocks can be nested, permissions get complicated. If I have a database inside a team page, and I share the database with someone but not the page, what happens? Lucas: That's the tricky part. Notion uses an inheritance model with overrides. Each block has an access control list. By default, a child block inherits from its parent. But you can override it. So the database block might have its own ACL that grants access to a different set of users. That's powerful, but it also means the permission check is O — you have to walk up the block tree to see if the user has access. Luna: And that can get slow if you have deeply nested pages. How do they keep it fast? Lucas: They cache the resolved permissions at each block level. When a user opens a page, the server computes the effective permissions for every block in that page and caches the result. If a permission changes, they invalidate the cache for that subtree. It's a classic tradeoff: more memory for faster reads. Luna: So the block model is elegant, but it comes with real engineering costs. You need smart caching, compaction, and a robust sync layer. It's not something you'd build as a side project. Lucas: Absolutely. And that's why there aren't many clones. The block model is simple to describe but hard to implement at scale. Notion had to solve sync, permissions, offline, and real-time collaboration — all on top of a database that's also a document editor. That's a lot of moving parts. Luna: One thing I've always wondered: how does Notion handle block types that are more complex, like a database view? That's not just a block — it's a whole interface. Lucas: Great question. Database views — like table, board, calendar — are also blocks. They have a type, say 'database_view', and they store properties like which columns to show, what filters to apply, etc. The actual data lives in the database block. So you can have multiple views of the same database, each with different settings, and they all reference the same underlying data. Luna: That's clean. It means you can have a table view for engineering tasks and a calendar view for deadlines, all from the same database. And because it's all blocks, you can embed that database view anywhere. Lucas: Exactly. And that's the killer feature: composability. You can build a dashboard by embedding multiple database views, each filtered differently, on a single page. That's hard to do with traditional document editors. Luna: But it also means the rendering engine has to handle a lot of complexity. How does Notion render a page with hundreds of blocks without lagging? Lucas: They use virtual scrolling — only render the blocks that are visible in the viewport. And blocks are lazy-loaded: the page loads the first N blocks, then fetches more as you scroll. For databases, they paginate the results. So even if you have 10,000 tasks, the UI stays snappy. Luna: What about search? If everything is blocks, you can search across all blocks in a workspace. That's actually a huge advantage over file-based tools. Lucas: Right. Notion indexes every block's text content. When you search, it's essentially querying a full-text search index over blocks. And because blocks have types, you can filter by type — search only in to-do blocks, for example. That's something you can't do with Google Docs or Word. Luna: So the block model enables features that would be awkward in a traditional document. But it also means the data model is more complex. When you export a Notion page, you get Markdown, but that's a lossy conversion because Markdown doesn't have the concept of a database view. Lucas: Exactly. Export is a one-way street. The richness of the block model is lost when you flatten it. That's a deliberate tradeoff — they prioritize the in-product experience over interoperability. Luna: How does Notion handle block-level version history? Can you see who edited a specific paragraph? Lucas: They offer page-level version history, not block-level. That's a limitation. Because blocks can be moved and reordered, tracking per-block history is much harder. You'd have to store the position of the block within the page at each point in time. It's doable, but it adds complexity. Luna: I imagine that's something they could add in the future. For now, the page history shows you the state of all blocks at a given time. Lucas: Right. And that's already useful. You can restore a page to a previous state, which effectively restores all blocks to that state. It's not granular, but it covers the most common use case: 'I accidentally deleted something.' Luna: Let's talk about the engineering team itself. Notion's team is relatively small for a product with this much complexity. How do they manage? Lucas: They're very focused on modularity. The block system is extensible — they can add new block types without rewriting the core. Each block type is essentially a plugin. The rendering engine, the sync layer, the permission system — they all treat blocks generically. That lets them ship new features quickly. Luna: So if someone wants to add a 'video' block, they just define the type, the properties, and the rendering component, and everything else just works. Lucas: Exactly. The hard part is the sync and collaboration layer, but that's abstracted away from individual block types. That's why Notion can add new integrations, like embedding Figma or Loom, without breaking anything. Luna: It's a good example of how a strong architectural choice — the atomic block — pays off in the long run. Even if it's harder to build initially. Lucas: Absolutely. And it's a reminder that sometimes the best engineering decisions are the ones that feel like overkill at the start. Notion's block model was unconventional in 2015, but now it's the foundation of everything they do. Luna: It makes you wonder: what other products could benefit from a similar rethink of their data model? Most collaboration tools still think in terms of files or documents. Lucas: That's the big question. As more tools move toward real-time collaboration and composability, we might see more block-inspired architectures. But it's not a silver bullet — it works for Notion because their use case is fundamentally about structured content. Luna: So the lesson might be: think carefully about your fundamental unit of data. For Notion, it's the block. For other products, it could be something else. But whatever it is, it should be flexible enough to grow with you. Lucas: Well said. And that's where we'll leave it. Thanks for listening.