DEV Community

Cover image for CRDT vs Operational Transformation: How Google Docs and Notion Actually Avoid Edit Chaos
Abdullah al Mubin
Abdullah al Mubin

Posted on

CRDT vs Operational Transformation: How Google Docs and Notion Actually Avoid Edit Chaos

You’re typing in a document.

Someone else deletes the sentence you’re writing.

Another person edits the same line from another country.

And somehow…

nothing breaks.

No overwrites.
No duplicated text.
No “conflict error” popups.

It feels like magic.

But behind this smooth experience are two competing ideas:

Operational Transformation (OT)
Conflict-free Replicated Data Types (CRDTs)

Both solve the same problem:

How do multiple people edit the same thing at the same time without breaking it?

But they do it in completely different ways.

Let’s break it down like a story.

Index


1. The Problem They Both Solve

Imagine this text:

txt id="base_doc"
Hello World
Enter fullscreen mode Exit fullscreen mode

Two people edit it at the same time:

  • Person A inserts “Beautiful ”
  • Person B deletes “World”

Now the system has a question:

What is the final correct version?

This is where chaos usually begins.

Unless you have OT or CRDT.


2. The Two Philosophies

Operational Transformation (OT)

OT says:

“We will fix conflicts in real-time by transforming operations.”

Think of it like:

A smart referee adjusting players’ moves so the game stays fair.


CRDT (Conflict-free Replicated Data Types)

CRDT says:

“Let’s design the system so conflicts can NEVER happen.”

Think of it like:

Everyone follows a rulebook so good that disagreement is impossible.


3. A Real-Life Analogy

OT = Traffic Cop

Cars (edits) arrive at an intersection.

The cop (server) decides:

  • who goes first
  • how to adjust timing
  • how to avoid crashes

  • Central coordination required


CRDT = Self-Driving Cars

Every car knows the rules.

They coordinate locally.

No cop needed.

  • No central authority

4. How OT Works (Simple Version)

OT systems:

  1. User sends an operation
  2. Server receives multiple operations
  3. Server transforms operations based on order
  4. Everyone gets adjusted updates

Example:

txt id="ot_flow"
Enter fullscreen mode Exit fullscreen mode

Insert("Beautiful ", pos=6)
Delete("World", pos=6)

If order changes, OT adjusts positions so both still make sense.

  • The key idea: transform before applying

5. How CRDT Works (Simple Version)

CRDT systems don’t “fix conflicts”.

Instead they:

  • assign unique IDs to everything
  • allow independent edits
  • merge changes mathematically

So instead of:

“Where should this insert go?”

CRDT says:

“This character has a permanent identity. Merge is automatic.”

Even if users were offline.

  • The key idea: design data that always merges safely

6. The BIG Difference

Feature OT CRDT
Coordination Central server No central server needed
Conflict handling Transformed in real-time Designed to avoid conflicts
Offline support Weak Excellent
Complexity High in server logic High in data structure
Scaling Harder at large scale Easier in distributed systems

7. Mental Model That Actually Helps

OT = Editing is a live conversation

Everyone talks at once
A referee keeps adjusting meaning so it stays understandable


CRDT = Everyone writes in ink that auto-merges

Each person writes independently
Ink is designed to blend perfectly later


8. Where You’ve Seen Them Without Knowing

OT is used in:

  • Classic Google Docs architecture
  • Etherpad
  • Some collaborative editors

CRDT is used in:

  • Notion (modern systems)
  • Figma (parts of it)
  • Offline-first apps
  • Distributed databases
  • Multiplayer collaborative tools

9. Why OT Feels Hard

OT struggles with:

  • ordering edits correctly
  • concurrent transformations
  • edge cases explosion
  • server coordination bottlenecks

But it works extremely well in controlled systems.


10. Why CRDT Feels Magical

CRDT shines because:

  • works offline
  • merges automatically
  • no central conflict resolution
  • scales beautifully across systems

But…

It requires very carefully designed data structures.


11. The Key Insight

Both OT and CRDT are trying to solve the same deep problem:

“How do humans collaborate in real time without stepping on each other’s work?”

But they approach it differently:

OT:

Fix conflicts as they happen

CRDT:

Design so conflicts never happen


12. Final Thought

The next time you see multiple cursors typing in a document…

remember:

You’re not just seeing text editing.

You’re seeing one of two invisible systems at work:

Either a referee constantly rewriting reality (OT)
Or a system designed so reality never disagrees (CRDT)

And that’s what makes modern collaboration tools feel effortless.


Top comments (0)