Skip to main content
ExplainerSoftware Architecture· Updated · 4 min read· in Content Types

How CRDTs Solve Offline Data Conflicts in Local-First Software Without Cloud Servers

By moving the primary database to the user's device and using mathematical algorithms to resolve conflicts, local-first software eliminates loading spinners and returns data ownership to the user.

By Naina Verma

Share this story

Listen

In short

  • Local-first software stores the primary copy of user data on the local device, using the cloud only for background synchronization.
  • This architecture eliminates network latency, enabling sub-millisecond response times and genuine offline capability.
  • Conflict-free Replicated Data Types (CRDTs) allow multiple offline users to edit the same data and merge it perfectly without a central server.

Cloud applications like Google Docs and Trello enable seamless real-time collaboration, but they do so by centralizing data storage on remote servers. This architecture strips users of true ownership over their files and introduces an irreducible network latency floor, as every interaction requires a round-trip to a data center.[1]

In response, the independent research lab Ink & Switch coined the term "local-first software" in a 2019 manifesto. The paradigm proposes a radical inversion of the modern web: the primary, authoritative copy of a user's data should live on their local device, with the cloud acting merely as a secondary, background syncing mechanism.[1][3]

This architectural shift fundamentally changes the performance profile of web applications. By querying a local embedded database instead of waiting for a remote server to respond, local-first applications can deliver sub-millisecond response times, eliminate loading spinners entirely, and provide genuine offline capability.[5]

By querying a local database instead of a remote server, local-first apps bypass network latency.

However, moving the primary database to the client introduces a massive distributed systems challenge: how do you resolve conflicts when multiple users edit the exact same document offline and then reconnect? Historically, this required either manual merging by the user or a centralized server arbitrarily picking a "winner" and discarding the other edits.[5]

The breakthrough that makes modern local-first software possible is a mathematical data structure called a Conflict-free Replicated Data Type (CRDT). Formally defined by researcher Marc Shapiro and colleagues in 2011, CRDTs solve the conflict problem without requiring any central authority or server coordination.[2][4]

CRDTs guarantee a property known as "Strong Eventual Consistency." This means that as long as two devices eventually exchange their updates, their local databases will mathematically converge to the exact same state, regardless of the order in which the network delivered the updates.[2][4]

They achieve this convergence through specific algebraic properties. In a state-based CRDT, the merge function must be commutative (the order of operations does not matter), associative (the grouping of operations does not matter), and idempotent (repeating the exact same merge operation does not change the final result).[2]

For example, in a collaborative text editor, instead of tracking the document as a single flat string of text, a CRDT tracks every individual character insertion and deletion. Each character is assigned a unique cryptographic identifier and a logical timestamp.[2][6]

CRDTs use mathematical properties to guarantee that divergent edits will always converge to the same state.

When two users edit the same paragraph while offline, their devices do not need to ask a server how to merge the text. The CRDT algorithm mathematically interleaves the characters based on their unique identifiers, guaranteeing that both users see the exact same merged result once their devices reconnect.[4][6]

This decentralized approach to conflict resolution enables true peer-to-peer collaboration. Devices can sync directly over local Wi-Fi or Bluetooth, completely bypassing the internet and ensuring that the software continues to function indefinitely even if the vendor goes out of business.[1]

Despite their theoretical elegance, CRDTs introduce significant engineering trade-offs. Because they must guarantee mathematical convergence under any circumstance, many CRDT implementations store the entire history of every operation ever performed on the data.[6]

This historical append-only log can lead to severe memory and disk bloat. A document that is only a few kilobytes of plain text might require megabytes of CRDT metadata to track the lineage of every edit, deletion, and merge over its lifetime.[6]

Because CRDTs track the history of every operation, they can consume significantly more memory than plain text.

Furthermore, while CRDTs automatically resolve data conflicts, they do not necessarily resolve semantic conflicts. Two users might concurrently edit a document in a way that mathematically merges perfectly but results in a grammatically incoherent sentence or a logically broken application state.[7]

To mitigate these issues, modern local-first frameworks are developing advanced garbage collection and log-compaction techniques. These systems attempt to prune historical data and compress the metadata footprint without breaking the mathematical guarantees of the underlying CRDT.[6]

As browser storage APIs mature and devices become increasingly powerful, the local-first paradigm is moving rapidly from academic research into production. It promises a future where software feels instantaneous, works flawlessly offline, and finally returns data sovereignty to the user.[1][3][5]

How we did this

Method
Synthesizing the mathematical constraints of state-based and operation-based CRDTs with modern network latency metrics to calculate the theoretical performance delta of local-first architectures.
What we found
By offloading conflict resolution from a centralized server to local mathematical operations (CRDTs), local-first architectures can bypass the network latency floor entirely, shifting the performance bottleneck from network transmission to local disk I/O and achieving sub-millisecond interaction latency without sacrificing multi-user consistency.
What we worked from
  • Local-first response time: sub-millisecond — RxDB
  • Eventual consistency merge requirements: Commutative, associative, and idempotent operations — Wikipedia
Limits of this analysis
This analysis relies on theoretical latency floors and does not account for the computational overhead of merging large CRDT histories on low-powered devices.

Terms to know

Local-first software
An application architecture that prioritizes local storage and local networks over remote cloud servers.
CRDT
Conflict-free Replicated Data Type, a data structure that automatically resolves conflicts when merging data from multiple independent sources.
Strong Eventual Consistency
A guarantee that all devices will mathematically converge to the exact same state once they have received the same set of updates.
Commutative operation
A mathematical property where the order in which operations are applied does not change the final result.
Idempotent
An operation that can be applied multiple times without changing the result beyond the initial application.

Questions readers ask

What is local-first software?

It is a software architecture where the primary copy of your data lives on your local device, allowing instant response times and offline use, with the cloud acting only as a background sync mechanism.

How is local-first different from offline mode?

Traditional offline modes cache a subset of cloud data temporarily. In local-first, the local database is the authoritative source of truth, and the app is designed to function indefinitely without a connection.

What is a CRDT?

A Conflict-free Replicated Data Type is a mathematical data structure that allows multiple devices to edit the same data independently and guarantees they will merge perfectly without a central server.

Does local-first mean my data is never backed up?

No. Local-first apps still sync to cloud servers or peer devices in the background to ensure data is backed up and available across all your devices.

Different angles

Local-First Developers

Advocate for user agency, data ownership, and the elimination of network latency.

This camp argues that the cloud era stripped users of control over their own files. By returning the primary database to the local device, developers can build applications that respond instantly and never show a loading spinner. They view CRDTs as the foundational technology needed to break the monopoly of centralized SaaS providers and return to the data sovereignty of desktop applications.

Distributed Systems Theorists

Focus on the mathematical elegance and consistency guarantees of decentralized conflict resolution.

Researchers emphasize that CRDTs solve a fundamental problem in the CAP theorem by providing Strong Eventual Consistency. They are less concerned with the consumer benefits of offline apps and more focused on the algebraic properties—commutativity, associativity, and idempotency—that allow distributed databases to converge without expensive consensus protocols.

Cloud Architecture Proponents

Highlight the practical challenges, memory overhead, and security risks of decentralized data.

Skeptics point out that while CRDTs are mathematically sound, they introduce massive metadata bloat by storing the entire history of every operation. Furthermore, trusting client devices with the primary copy of a database complicates access control, schema migrations, and enterprise compliance, making the cloud model far more practical for most businesses.

Local-First Developers 45%Distributed Systems Theorists 35%Cloud Architecture Proponents 20%
Local-First Developers
Advocate for user agency, data ownership, and the elimination of network latency.
Distributed Systems Theorists
Focus on the mathematical elegance and consistency guarantees of decentralized conflict resolution.
Cloud Architecture Proponents
Highlight the practical challenges, memory overhead, and security risks of decentralized data.

Perspectives this story doesn't cover

  • Enterprise IT Administrators
  • Cloud Infrastructure Providers

Sources

Source coverage

7 outlets

3 viewpoints surfaced

Local-First Developers 45%Distributed Systems Theorists 35%Cloud Architecture Proponents 20%
  1. [1]Ink & SwitchLocal-First Developers

    Local-first software: you own your data, in spite of the cloud

    Read on Ink & Switch →
  2. [2]WikipediaLocal-First Developers

    Conflict-free replicated data type

    Read on Wikipedia →
  3. [3]WikipediaLocal-First Developers

    Local-first software

    Read on Wikipedia →
  4. [4]CRDT.techDistributed Systems Theorists

    Conflict-free Replicated Data Types

  5. [5]RxDBLocal-First Developers

    Why Local-First Software Is the Future and what are its Limitations

    Read on RxDB →
  6. [6]LoroDistributed Systems Theorists

    The Emergence of CRDTs

    Read on Loro →
  7. [7]Factlen Editorial TeamCloud Architecture Proponents

    Synthesis by Factlen editorial team

    Read on Factlen Editorial Team →
Listen

Comments

Stay informed

Every angle. Every day.

Get Content Types stories with full source coverage and perspective breakdowns, free every day.