Local-First Architecture: Building Applications That Work Offline
Understanding how local-first software with CRDTs enables offline-first experiences, real-time sync, and user-owned data.
From Cloud-First to Local-First: Architectures, Sync & CRDTs
-
Cloud apps like Google Docs and Trello (project management tool) are popular because they enable real-time collaboration with colleagues, and they make it easy to access work from all of your devices.
-
However, by centralizing data storage on servers, cloud apps also take away ownership from users. If a service shuts down, the software stops functioning, and the data created with that software is lost.
Local-first software means a set of principles for software that enables both collaboration and ownership for users: the ability to work offline and collaborate across multiple devices, while also improving the security, privacy, long term preservation, and user control of data.
This breakdown covers the existing approaches to data storage and sharing (email attachments, web apps, Firebase-backed mobile apps), the trade-offs of each, and Conflict-free Replicated Data Types (CRDTs): data structures that are multi-user from the ground up while also being fundamentally local and private.
#Collaboration and Ownership
-
It's amazing how easily we can collaborate online today. Google Docs for documents, Figma for interface designs, Slack for communication, Trello for tracking tasks, and so on.
-
We depend on these and many other online services for taking notes, planning projects or events, remembering contacts, and a whole raft of business uses.
Cloud apps means services you could just call "SaaS" or "web-based apps." What they have in common is that you typically access them through a web browser or mobile app, and that they store their data on a server.
-
Today's cloud apps offer big benefits compared to earlier generations of software: seamless collaboration, and being able to access data from any device.
-
As we run more and more of our lives and work through these apps, they become more and more critical to us. The more time invested in using one of these apps, the more valuable the data in it becomes.
-
But research with creative professionals surfaced the same recurring concern: cloud apps came with real trade-offs.
Why Ownership Matters for Creative Work
-
When you put a lot of creative energy and effort into making something, you tend to have a deep emotional attachment to it. "Creative work" here isn't just visual art, music, or poetry, it's also explaining a technical topic, implementing an complex algorithm, designing a user interface, or figuring out how to lead a team toward a goal all count too.
-
In the process of doing that creative work, you produce files and data: documents, presentations, spreadsheets, code, notes, drawings. You want to keep that data for reference and inspiration, for a portfolio, or simply because you feel proud of it.
-
Cloud apps are problematic here. Although they let you access your data anywhere, all data access must go via the server, and you can only do the things the server lets you do.
"There is no cloud, it's just someone else's computer."
-
"ownership” isn’t about intellectual property or copyright; it’s about how creators perceive their relationship with their data
-
Once data lives on someone else’s servers, you’re relying on that third party to control and manage it. If the service is unavailable, you cannot use the software and can no longer access the data created with it.
-
If the service shuts down, exporting your data may not be enough, you still can’t keep running the software yourself. You remain dependent on the company to keep the service available.
Old-Fashioned Apps vs. Cloud Apps
-
Before web apps, we had "old-fashioned" apps: programs running on the local computer, reading and writing files on the local disk. Text editors and IDEs, Git and other version control systems, graphics applications, CAD software all fall into this category.
-
This focuses on apps for creating and managing documents or text files, graphics, spreadsheets, CAD drawings, music as well as personal data repositories such as notes, calendars, to-do lists, and password managers.
-
It does not cover banking, e-commerce, social networking, ride-sharing, or similar services that are better suited to centralized systems.
-
In old-fashioned apps, data lives in files on the local disk, so you have full ownership: long-term archiving, backups, manipulating files with other programs, or deleting them if you no longer want them. You don't need anybody's permission to access your own files, and you don't depend on servers operated by another company.
The cloud gives us collaboration, but old-fashioned apps give us ownership. The goal is both , the convenient cross-device access and real-time collaboration of cloud apps, and the sense of personal ownership that old-fashioned software provided.
#The Seven Ideals for Local-First Software
- Data ownership and real-time collaboration can coexist. It's possible to build software with all the advantages of cloud apps while retaining full ownership of the data, documents, and files you create.
Local-first software means software that prioritizes the use of local storage (the disk built into your computer) and local networks (like your home WiFi) over servers in remote datacenters.
- In cloud apps, the data on the server is the primary, authoritative copy; The client holds only a cache; the server remains the source of truth. Any modification must be sent to the server, or it "didn't happen."
Authoritative copy means the version of the data that is considered the definitive or trusted source.
- Local-first applications swap these roles: the copy of the data on your local device: laptop, tablet, or phone becomes the primary copy. Servers still exist, but they hold secondary copies of your data in order to assist with access from multiple devices.
Seven core ideals define the goals of local-first software:
1. No spinners: your work at your fingertips
-
Much of today's software feels slower than previous generations, even as CPUs get faster, because there is a noticeable delay between user input and the result appearing on the display.
-
With cloud apps, since the primary copy of the data is on a server, all modifications and many lookups require a round-trip to a server. Depending on where you live, that server may be on another continent, so the speed of light limits how fast the software can be.
Optimistic UI means a pattern where the interface shows an operation as complete even though the request is still in progress. It hides latency, but until the request finishes there's always a chance it fails (e.g. an unstable connection), so it still sometimes exposes the network round-trip when an error occurs.
-
Local-first software is different: because it keeps the primary copy of the data on the local device, there is never a need to wait for a server request to complete. All operations are reads/writes on the local disk, and data synchronization with other devices happens quietly in the background.
-
This doesn't by itself guarantee speed, but local-first software has the potential to respond near instantaneously to input, never needing to show a spinner.
2. Your work is not trapped on one device
-
Users rely on several computing devices to do their work for capturing ideas on a phone, organizing them on a tablet, writing up the outcome on a laptop.
-
This means local-first apps keep data in local storage on each device, but that data also needs to be synchronized across all the devices a user works on.
-
Most cross-device sync services also store a copy of the data on a server, which provides a convenient off-site backup. These solutions work well as long as each file is only edited by one person at a time. If several people edit the same file at once, conflicts arise.
3. The network is optional
-
Personal mobile devices move through areas of varying network availability: unreliable coffee shop WiFi, a plane, an elevator, a parking garage. In developing countries or rural areas, infrastructure can be inconsistent or unreliable. Many mobile users disable cellular data while traveling internationally due to roaming cost.
-
"Old fashioned" apps work fine without an internet connection, but cloud apps typically don't. The Offline First movement has encouraged developers to improve offline support, but it has been difficult to retrofit offline support into cloud apps because tools and libraries designed for a server centric model don't easily adapt to users making edits while offline.
-
Since local-first applications store the primary copy of their data in each device's local filesystem, the user can read and write it anytime, even offline. It's synchronized with other devices later, when a connection is available and that sync need not go via the internet at all; local-first apps could use Bluetooth or local WiFi to sync to nearby devices.
-
For reliable offline support, it’s preferable for the software to run as a locally installed app rather than a browser tab. Mobile apps already follow this model, downloading the application to the device before it’s used.
4. Seamless collaboration with your colleagues
-
Collaboration typically involves multiple people contributing to the same document or file. In old-fashioned software, several people working on the same file at the same time is problematic, the result is often a conflict.
-
In text files, resolving these conflicts can be difficult; in complex formats like spreadsheets or graphics documents it can be very difficult or impossible. So collaborators often have to decide in advance who edits the file and when, taking turns.
-
A "conflicted copy" on Dropbox requires manual merging. In Evernote, a concurrently changed note is moved to a "conflicting changes" notebook with nothing to help resolve it, not even a way to compare versions.
-
In Git, several people modifying the same file in different commits can produce merge conflicts, resolved with tools such as DiffMerge but these tools are designed for line-oriented text files; support for other formats is much weaker.
-
Cloud apps like Google Docs make collaboration easy. Multiple people can edit the same document at the same time, without sending files back and forth or dealing with conflicts. Today, people expect this kind of real-time collaboration in many apps.
-
The goal for local-first apps is to offer real-time collaboration as good as, or better than, today’s best cloud apps. Achieving this is one of the biggest challenges of local-first software.
-
Local-first apps should support different ways of collaborating. Sometimes several people need to edit the same document at the same time. In other cases, one person may want to suggest changes that someone else can review and choose to accept or reject, like Google Docs’ suggesting mode or GitHub pull requests.
5. The Long Now
-
An important aspect of data ownership is being able to keep accessing the data for a long time into the future even after the company that produced the software is gone.
-
Old-fashioned apps continue to work forever, as long as you have a copy of the data and some way of running the software.
-
Even if the author/creator goes out of business, you can keep running the last released version. Even if the OS and computer become no longer in use, you can run the software in a virtual machine or emulator. As storage media evolve, you can copy files to new media and keep accessing them.
-
Cloud apps, on the other hand, depend on the service continuing to be available. This means we are just betting that the creators will keep supporting it for as long as you care about the data and even with long-lived software, pricing or features can change in ways you don't like, with no option to keep using the old version.
-
Local-first software enables greater lifespan, because your data, and the software needed to read and modify it, are all stored locally. If our data cannot be preserved and accessed over time, we risk a “digital Dark Age,” in Vint Cerf’s words.
-
Some file formats (plain text, JPEG, PDF) are everywhere enough to probably remain readable for centuries. The US Library of Congress also recommends XML, JSON, or SQLite as archival formats. But to read less common formats and preserve interactivity, you need to be able to run the original software (if necessary in a VM or emulator) which local-first software enables.
6. Security and privacy by default
-
One problem with cloud apps architecture is that they store all the data from all of their users in a centralized database: an attractive target for attackers: a rogue employee, or a hacker who gains access to the company's servers, can read and tamper with all of your data.
-
Even a company with a world class security team can defend your data against external attackers while still being free, internally, to use your data in many ways such as feeding it into machine learning systems.
-
For many professions, dealing with sensitive data is core to the work: medical professionals handle sensitive patient data, investigative journalists handle confidential sources, governments and diplomats conduct sensitive negotiations. Many of these professionals cannot use cloud apps due to regulatory agreement and confidentiality responsibility.
-
Local-first apps have better privacy and security built into the core. Local devices store only your own data, avoiding a centralized database holding everybody's data. Local-first apps can use end-to-end encryption so that any servers storing a copy of your files only hold encrypted data they cannot read.
-
Modern messaging apps like iMessage, WhatsApp, and Signal already use end-to-end encryption; this trend is hoped to expand to other kinds of software too.
7. You retain ultimate ownership and control
-
With cloud apps, the service provider has the power to restrict user access, for example, in October 2017, several Google Docs users were locked out of their documents because an automated system incorrectly flagged them as abusive. In local-first apps, ownership of data gives strong personal interest or stake in the user.
-
Here, “ownership” is not meant in the legal or intellectual-property sense. It means having meaningful control over your data where it lives, how it is stored, who can access it, and whether you can continue using it independently of the service that created it.
-
You should be able to copy and modify data in any way, write down any thought, without a company restricting what you're allowed to do.
-
In cloud apps, the ways you can access and modify your data are limited by the APIs, user interfaces, and terms of service of the provider. With local-first software, all of the bytes that comprise your data are stored on your own device, so you have the freedom to process this data in arbitrary ways.
-
With data ownership comes responsibility: maintaining backups, protecting against ransomware, organizing and managing file archives. For many professional and creative users, the trade-off of more responsibility in exchange for more ownership is desirable, think of a PhD thesis, or the raw footage of a film.
-
Maintaining control and ownership of data doesn't require the software to be open source. It's possible for commercial and closed-source software to satisfy the local-first ideals, as long as it doesn't artificially restrict what users can do with their files. Examples of such restrictions: PDFs that disable printing, eBook readers that interfere with copy-paste, DRM(Digital Rights Management) on media files.
#Existing Data Storage and Sharing Models
The tables below show how well existing technologies align with the seven ideals like indicates a match, indicates a partial match, and indicates that the ideal is not met.
Many technologies satisfy some of the goals, but none satisfy them all.
Longevity means your data and software should remain usable for a long time, even if the original company or service shuts down.
Files and Email Attachments
| Approach | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| Files + email attachments | ✓ | — | ✓ | ✗ | ✓ | — | ✓ |
-
Traditional files have several important advantages: they work offline, give users full control over their data, and are easy to back up and preserve for the long term. Software built around local files can also be very fast because it doesn’t need to rely on a network connection.
-
Accessing files from multiple devices is trickier, though it's possible via: email, USB drives, a distributed file system (Network Attached Storage, Network File System, File Transfer Protocol, rsync), a cloud file storage service (Dropbox, Google Drive, OneDrive), or a version control system like Git.
-
Email attachments are probably the most common sharing mechanism, especially for non-technical users easy to understand, trustworthy, and don't spontaneously change (an attachment viewed six months later is still there in original form), and don't require a login.
-
The biggest weakness of email attachments is collaboration: typically, only one person can edit the file at a time. Otherwise, teams are stuck with manual merges, while versioning quickly turns into a mess of files.
-
A good starting point for apps adopting local-first principles is to offer exports in widely supported formats: plain text, PDF, PNG, or JPEG that users can easily share via email, Slack, or WhatsApp.
Web Apps: Google Docs, Trello, Figma, Pinterest, etc.
| App | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| Google Docs | — | ✓ | — | ✓ | — | ✗ | — |
| Trello | — | ✓ | — | ✓ | — | ✗ | ✗ |
| ✗ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ |
-
At the opposite end of the spectrum are pure web apps, where the local client whether a browser or mobile app is essentially a thin layer, while data is stored on remote servers, typically in large-scale databases that house data from millions of users.
-
Web apps have set the standard for real-time collaboration: you can trust that opening a document on any device shows the most current version. This is so useful for teamwork that these applications have become dominant even traditionally local-only software like Microsoft Office has transitioned to cloud services.
-
The trade-off is a loss of ownership and control: the server becomes the single source of truth, while any client-side data is merely a cache. Most web apps offer little to no offline support, so a network hiccup can interrupt your work or even lock you out mid-sentence.
-
A few of the best web apps mask server-communication latency with JavaScript and provide limited offline support, such as Google Docs’ offline mode. However, these capabilities often feel retrofitted onto an architecture fundamentally built around synchronous server interaction, leading to inconsistent experiences for users.
-
Some web apps, like Figma, offer installable desktop clients that are essentially repackaged web browsers. But when the network becomes unreliable, the vendor’s servers go down, or the company is acquired and the product is eventually shut down, it becomes clear that the work was never truly under the user’s control.
Dropbox, Google Drive, OneDrive, etc.
| Product | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| Dropbox | ✓ | — | — | ✗ | ✓ | — | ✓ |
-
Cloud-based file sync tools let you access your files across multiple devices. On a desktop, they monitor a specific folder on your local filesystem, so any app can read or modify the files, and the changes are automatically synced to your other devices.
-
Because they use the local filesystem, they have attractive properties: fast local access, offline works fine (files edited offline sync once a connection is available), and if the sync service shut down, files would remain unharmed on the local disk with easy switching to another service.
-
On mobile (iOS/Android), though, the model is quite different. These apps usually act as thin clients that fetch files from the server when needed, rather than keeping them available offline by default. There’s often a “Make available offline” option, but it’s clunky and usually only works while the app is open.
-
The biggest weakness of file sync is real-time collaboration. If the same file is edited on two devices at the same time, it creates a conflict that usually has to be resolved manually. Supporting any file format is a strength because it works with almost anything, but it’s also a weakness because the sync system can’t understand the file’s structure well enough to merge changes intelligently.
Git and GitHub
| Tooling | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| Git + GitHub | ✓ | — | ✓ | — | ✓ | — | ✓ |
-
Git and GitHub are mainly used by software engineers to collaborate on source code, and they’re probably one of the closest examples of true local-first software. Unlike server-centric systems like Subversion, Git works fully offline, is fast, gives users full control over their data, and is well suited for long-term preservation. A Git repository on your local machine is the primary copy of the data not just a cache of what’s stored on a server.
-
A repository hosting service like GitHub enables collaboration, multi-device access, and backup/archival. Mobile support is currently weak. GitHub stores repositories unencrypted; stronger privacy requires self-hosting a repository server.
-
Git currently has two major weaknesses: it's excellent for asynchronous collaboration (especially pull requests) but has no capability for real-time, fine-grained collaboration like the automatic instantaneous merging in Google Docs, Trello, or Figma; and it's highly optimized for code and line-based text files, treating other formats as binary blobs that can't meaningfully be edited or merged.
-
It’s interesting that most software engineers have been hesitant to move their editors, IDEs, runtimes, and build tools to the cloud. They often say things like, “It’s too slow,” “I don’t trust it,” or “I want my code on my machine.” These concerns are driven by many of the same ideas behind local-first software: speed, control, and ownership.
Web App (Thin Client)
| Architecture | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| Web apps | ✗ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ |
-
A web app in its purest form is usually a Rails, Django, PHP, or Node.js program running on a server, storing data in a SQL or NoSQL database, serving pages over HTTPS. All data is on the server; the browser is only a thin client.
-
Benefits: zero installation, nothing for the user to manage, can access from all devices, easy collaboration by logging into the same application. Frameworks like Meteor and ShareDB, and services like Pusher and Ably, make it easier to add realtime collaboration on top of protocols like WebSocket.
-
On the other hand, a web app that sends a request to the server for every user action can feel slow. Client-side JavaScript can hide some of that delay, but it often falls apart when the network connection is slow or unstable.
-
Despite efforts to make browsers more offline friendly (manifests, localStorage, service workers, Progressive Web Apps), the architecture remains fundamentally server-centric, offline support is an afterthought and fragile. In many browsers, clearing cookies also deletes local storage, making it unsuitable for anything of long-term importance.
Service workers are background JavaScript processes that run separately from a web page and let a web app handle things even when the page isn't actively open.
PWA stands for Progressive Web App. It’s basically a website that can behave more like a normal app. You can install it on your phone or desktop, open it from an app icon, and in some cases use it even without an internet connection.
PWAs commonly use service workers to cache files and handle requests when the network is unavailable. They also use a web app manifest to define things like the app name, icon, and how it should open.
- Relying on third-party web apps also scores poorly on longevity, privacy, and user control, self-hosting can help but isn't viable for most users, and most web apps are closed source anyway. Choosing to build a web app means choosing the path of data belonging to you and your company, not your users.
Mobile App with Local Storage (Thick Client)
| Architecture | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| Thick client | ✓ | — | ✓ | ✗ | — | ✗ | ✗ |
-
iOS and Android apps are installed locally, with the entire app downloaded (binaries) to the device before it runs. However, many are still thin clients that depend heavily on a server. Without a reliable internet connection, they can show loading spinners, errors, or behave unexpectedly.
-
Another category stores data on the local device first, using a persistence layer like SQLite, Core Data, or plain files. Some started as single user apps and added a cloud backend later, for syncing or sharing.
-
These thick-client apps are fast and can work offline because they handle most of the work locally and sync with the server in the background. They can usually keep working even if the server goes down. However, the level of privacy and control users have over their data depends on the app.
-
Things get more complicated when data can be changed on multiple devices or by multiple users at the same time. Mobile developers are usually focused on building user-facing apps rather than distributed systems, so custom diffing, merging, and conflict-resolution logic can easily become unreliable and brittle.
Backend-as-a-Service: Firebase, CloudKit, Realm
| Service | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| Firebase, CloudKit, Realm | — | ✓ | ✓ | — | ✗ | ✗ | ✗ |
-
Firebase is one of the most successful mobile backend-as-a-service platforms. At a high level, it combines a local database on the device with a cloud database and keeps them in sync. This enables offline use and data sharing across devices. However, because it is a proprietary, hosted service, it offers less control over privacy and long-term data ownership.
-
Parse was a popular alternative, but Facebook acquired it and shut it down in 2017, forcing apps to migrate elsewhere. It’s a good example of why longevity and control matter when your app depends on a third-party service.
-
Firebase offers a great developer experience (view/edit/delete data freely in the console), but the user has no comparable way to access, manipulate, and manage their own data leaving them with little ownership and control.
-
Apple’s CloudKit offers a Firebase-like experience for apps limited to the Apple ecosystem. It provides a key-value store, syncing, and good offline support, while being built directly into Apple’s platforms, so developers don’t have to deal with a separate login system. Apps like Ulysses, Bear, and Overcast use it.
-
Realm became popular as an alternative to Core Data because it offered a cleaner, simpler API. Its client-side database could sync with a Firebase-like backend called Realm Object Server, which was open source and self-hostable. This gave developers more control and reduced the risk of being locked into a single cloud provider.
-
Mobile apps that treat on-device data as the primary copy (or at least more than a disposable cache), using sync services like Firebase or iCloud, get a good bit of the way toward local-first software.
Think of multi-master replication like having multiple copies of the same database, where every copy is allowed to accept writes.
- In a normal primary-replica setup, you have one database that handles writes:
App
↓
Primary DB ← writes
↓
Replica ← readsIf the application does UPDATE users SET name = 'Kartikey' WHERE id = 10; , the primary database processes it and then replicates the change to the replicas.
- With multi-master replication, there isn't just one database that can accept writes.
┌── Master A
│
App ──────────┼── Master B
│
└── Master CAll three can receive INSERT, UPDATE, DELETE and they replicate their changes to each other.
Why would you want this?
Imagine your application has users in India and the US. If your only database is in the US , every write has to travel to the US. That's additional network latency.
India user --> US server --> US database- With multi-master, An Indian user can write to the Indian database, while a US user writes to the US database.
India users --> India DB
|
replication
|
US users ------> US DB-
An Indian user can write to the Indian database, while a US user writes to the US database. Both databases eventually synchronize.
-
This can improve availability and write latency, especially for globally distributed applications.
Difficult part
Suppose two users update the same record at almost the same time. Master A receives name = "Kartikey" and Master B receives name = "Kartik". At this moment, both databases think their own version is correct.
- Now replication happens. What should the final value be? That's a conflict. This is the biggest problem with multi-master replication.
#How do you solve conflicts?
Last Write wins
- There isn't one universal solution. You choose a strategy based on your application. The simplest approach is: The latest version (Last Write) wins.
Master A
name = Kartikey
timestamp = 10:01:05
Master B
name = Kartik
timestamp = 10:01:08Master B's value is newer, so name = Kartik wins.
- This is easy, but there's a problem. The earlier update is simply lost. That's okay for something like user theme but potentially bad for bank balance, inventory, orders, payments
Merge the changes or application decides
Sometimes changes can be combined. Imagine two users are adding tags
Master A:
tags = ["backend"]
Master B:
tags = ["database"]-
Instead of choosing one, you can merge them:
["backend", "database"]. This is the basic idea behind conflict-free data structures such as CRDTs. They're useful when your data naturally supports merging. -
You can also let your application resolve conflicts.
Eventual consistency
- Multi-master systems commonly use eventual consistency means: The databases don't necessarily have the exact same data immediately, but if no new changes happen, they will eventually converge to the same state.
For example: At 10:00
Master A → name = Kartikey
Master B → name = KartikThere is temporarily a difference. After replication and conflict resolution:
Master A → name = Kartikey
Master B → name = KartikeyNow they have converged. So multi-master gives you more write availability, but you usually give up some of the simplicity of immediate consistency.
Replication loops
Replication systems need metadata such as transaction ID, origin node, version, sequence number, timestamp to lets them understand that "system already processed this change."
Masters are database servers that accept write operations like inserts, updates, and delete.
-
With multiple independent masters, coordinating one transaction across geographically distributed databases becomes much more expensive and complicated.
-
Indian users perform operations to Indian master, US user perform operations to US master etc. Each master primarily handles its own users. The databases still replicate data between themselves, but you avoid having random masters simultaneously modifying the same records. This dramatically reduces conflicts.
CouchDB
| Database | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| CouchDB | — | — | ✓ | ✗ | — | — | — |
-
CouchDB introduced a multi master replication approach where multiple machines each keep a complete copy of the database. Each copy can be updated independently, and the replicas can sync with each other to exchange changes.
-
CouchDB is mainly designed for servers, while Cloudant provides a hosted version. PouchDB and Hoodie use the same synchronization approach but are designed to run on users’ devices.
-
CouchDB is closely aligned with local-first principles distributed consistency, replication, change notifications, multiversion concurrency control.
Distributed Consistency: When the same data exists on multiple machines, distributed consistency defines what data users should see and when.
Distributed consistency is about controlling how multiple machines behave when their copies of data aren't updated simultaneously.
Different consistency models handle this differently:
1. Strong consistency : every read sees the latest write.
2. Eventual consistency : replicas may temporarily differ, but eventually become the same.
3. Causal consistency : related operations are always seen in the correct order.
4. Read-your-writes : after you update something, you can immediately see your own update.-
While CouchDB/PouchDB allow multiple devices to concurrently change a database, the resulting conflicts must be explicitly resolved by application code, which is difficult to write correctly making CouchDB impractical for applications needing very fine-grained collaboration, like Google Docs, where every keystroke is potentially an individual change.
-
In practice, CouchDB’s approach hasn’t seen widespread adoption because managing a database per user doesn’t scale well, native mobile integration is difficult, conflicts are hard to handle, and its MapReduce query model can be unfamiliar.
Ideal Case
| Target | Fast | Multi-device | Offline | Collaboration | Longevity | Privacy | User control |
|---|---|---|---|---|---|---|---|
| ??? | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
- No existing data layer fully meets the goals of local-first development. This led to CRDTs (Conflict-free Replicated Data Types), which are designed to keep data synchronized across devices without relying on a central server.
#CRDTs as a Foundational Technology
CRDT means Conflict-free Replicated Data Type: a general purpose data structure like a hash map or a list that is multi-user from the ground up.
- Every application needs data structures to store its document state.
-
A text editor's core structure is the array of characters making up the document.
-
A spreadsheet's is a matrix of cells containing text, numbers, or formulas referencing other cells.
-
A vector graphics app's is a tree of graphical objects: text objects, rectangles, lines, shapes.
In a single-user app, you can keep your data in memory using objects, HashMaps, lists, or structs. In a collaborative app, CRDTs can replace these structures while also keeping data synchronized across users.
Example: A to-do list backed by a CRDT with a JSON data model: users can view and modify state on their local device, even while offline. The CRDT tracks any changes and syncs them with other devices in the background once a network connection is available.
-
Two devices start with the same to-do list. On device 1, a new item is appended with
.push(). Concurrently, on device 2, the first item is marked done. After the two devices communicate, the CRDT automatically merges the states so both changes take effect. -
If state is concurrently modified on different devices, the CRDT merges the changes e.g. concurrently added items end up in a consistent merged order, and concurrent changes to different objects merge easily.
-
The main case a CRDT can’t automatically resolve is when multiple users change the same property of the same object at the same time. Instead of silently choosing one, the CRDT keeps both conflicting values and lets the application decide how to resolve them.
- For example, if two users simultaneously change a document title: The CRDT preserves both values, and the application can decide whether to pick one, merge them, or ask the user to choose.
User A → title = "My Project"
User B → title = "Final Project"-
CRDTs have some similarity to version control systems like Git, except they operate on richer data types than text files. They can sync state via any communication channel: a server, a peer-to-peer connection, Bluetooth, even a USB stick. Tracked changes can be as small as a single keystroke (enabling Google Docs-style real-time collaboration), or batched into a larger set sent as a whole, more like a Git pull request.
-
Because CRDTs are general-purpose data structures, the same tools and infrastructure can handle their storage, synchronization, communication, and management. This means each application doesn’t have to build these systems from scratch.
An open-source JavaScript CRDT library called Automerge, built on earlier JSON CRDT research, was later combined with the Dat networking stack to create Hypermerge.
These tools don’t fully achieve the local-first vision by themselves, but they show how CRDTs could become a foundation for a new generation of software similar to how packet switching helped enable the internet and capacitive touchscreens enabled modern smartphones.
#Prototypes Reference
Academic research has made strong progress on CRDT algorithms, but real-world adoption has remained limited, especially in client-side creative applications. Most existing use has been in server-based systems such as Azure Cosmos DB, Redis and others.
This led to experiments with local-first collaborative apps built using CRDTs, inspired by tools like Trello, Figma.
The experiments focused on three areas:
-
Technology: Can CRDTs work reliably in real applications? What networking and installation infrastructure is needed?
-
User experience: Can local first apps provide smooth real-time collaboration like Google Docs, while also supporting offline and asynchronous workflows?
-
Developer experience: How does working with CRDTs compare with familiar tools like SQL databases, filesystems, or Core Data? Does distributed data make development significantly harder?
The prototypes were built with Electron, JavaScript, and React, combining development speed with downloadable desktop apps. This also reinforced an important local-first idea: users should feel that they own the software and their data locally.
Trellis: Kanban Board
-
Trellis is a Kanban board modeled after Trello, offering a Trello-like experience with local-first software. Networking used WebRTC.
-
On the UX side, Trellis included a basic change history, inspired by Git and Google Docs, allowing users to see what changed on the board and travel back through previous states.
Pixelpusher: Collaborative Drawing
-
Pixelpusher is a collaborative pixel-art drawing app designed to provide a Figma-like real-time editing experience. It used peer-to-peer networking libraries from the Dat project to synchronize changes between users.
-
UX experiments included shareable document URLs, Git-inspired visual branching and merging, and conflict resolution that highlighted conflicting pixels in red. It also introduced basic user identity through user-drawn avatars.
PushPin : Media Canvas
-
PushPin is a mixed-media canvas workspace similar to Miro, built on Automerge. It was the most fully developed of the three prototypes. Because the team actually used it for tasks like sprint planning, real-world usage exposed more challenges and limitations in the underlying data layer.
-
PushPin explored nested and connected documents, different ways to render CRDT-based data, and a more advanced identity system using an “outbox” model for sharing. It also supported temporary, real-time data, such as showing other users’ selections or highlights.
#Findings
The prototypes were tested through regular use by the five-person development team, critical reflection, and usability tests with around ten external users including designers, product managers, and engineers. It was an exploratory study rather than a formal evaluation.
CRDTs work in practice
Automerge was surprisingly reliable. Developers were able to integrate it fairly easily, and merging changes between users was usually automatic and seamless.
Offline experience was excellent
Users could go offline, keep working, and reconnect later to automatically merge their changes with others. Unlike traditional apps that may fail or become unusable without a network connection, the prototypes continued working normally.
CRDTs work well with React and Functional Reactive Programming
Functional Reactive Programming: It’s a programming model where the application reacts automatically to changes in data/state over time.
CRDTs receive changes from both the local user and other users over the network. React's functional reactive model naturally keeps the UI synchronized with this changing shared state.
- Developers didn't need to manually track and reconcile (compare different versions of something and bring them into agreement) every remote change. Local changes could also flow through a single reducer, making them easy to apply locally and broadcast to other users.
Overall: the prototypes achieved real-time collaboration and full offline support with relatively little extra work, allowing developers to focus on the application itself rather than managing distributed data.
Conflicts are less of a problem than expected
Users rarely ran into conflicts, and Automerge's built-in conflict handling worked well.
-
Fine grained tracking: Automerge tracks individual changes and understands the data type. For example, if two users insert items at the same position in a list, it can deterministically combine them instead of treating it as a conflict.
-
People naturally avoid conflicts: Users often coordinate their work. For example, agreeing who will edit which section.
-
Different parts merge cleanly: If users edit different parts of a document at the same time, Automerge can merge the changes automatically. Conflicts mainly happen when two users change the same property at the same time.
So far, Automerge's default conflict-resolution rules were enough for all the prototypes; custom merge logic wasn't necessary.
Document history is important
In collaborative systems, changes can arrive from other users at any time. Without history tools, it can be difficult to understand how the document reached its current state or who changed what.
Trellis's version history interface helped users move through previous document states and highlighted newly changed elements. This could become a useful general tool for understanding collaborative changes.
URLs work well for sharing
Using URLs to share documents felt natural to both users and developers. A link can easily be copied and shared through email or chat.
However, how to handle permissions and access control beyond private/secret URLs remains an open question.
#Challenges & Limitations
Peer to Peer systems aren't simply "online" or "offline"
A peer-to-peer (P2P) system is one where devices communicate directly with each other instead of relying on a central server. Each device can send, receive, and store data, rather than everything going through one central server.
In a centralized system, things are usually straightforward: the server is either available or unavailable.
-
In a peer-to-peer system, every user can have a different view of the data. One user's changes might remain on their laptop for hours or even days before they reconnect.
-
This makes it harder to know which version of document each user has and where their changes currently are.
Local-first systems give users more ownership of their data, but this creates new UX challenges around showing document state and synchronization.
CRDTs can accumulate too much history
CRDTs keep a history of changes so that they can merge updates from users who reconnect much later. For example, PushPin might store every individual text edit:
He
Hel
Hell
HelloOver time, this history can consume significant memory and disk space.
The difficult part is deciding what history can safely be deleted. A user might reconnect months later with an old version and still need that history to merge their changes.
This makes efficient history management and storage an important challenge for CRDT systems.
Networking is still a major challenge
CRDTs solve how changes are merged, but they don't solve how those changes get from one device to another.
- The prototypes experimented with WebRTC, Copying files through Dropbox or USB drives, IPFS, Hypercore/Dat peer-to-peer libraries
IPFS (InterPlanetary File System) is a decentralized, peer-to-peer protocol for storing and sharing files directly from a distributed network. Instead of asking a central server for specific file, you ask the network for the file using its content-based address (CID), and it can be retrieved from any peer that has it.
- P2P networking worked, but wasn't always reliable, especially with NAT traversal and different network configurations.
NAT traversal is the process of helping two devices connect directly to each other when they are behind routers/firewalls. Both laptops have private IP addresses, so they can't always connect directly. NAT traversal techniques like STUN, TURN, and ICE help establish the connection.
Still, being able to collaborate directly between computers even without a traditional centralized backend can feel almost magical.
Cloud servers still have a role
Local-first doesn't mean "no servers."
Imagine Alice shares a document with Bob and then closes her laptop. If Bob isn't online at the same time, there's no peer available to send him the document.
A cloud server can solve this by acting as another peer:
Alice ---> Cloud Peer <--- BobThe cloud can store a copy, forward changes when users come online, provide backups, connect to traditional APIs, or handle heavy computation.
The important difference is:
In traditional software, the server is the source of truth. In local-first software, the server is a supporting peer—the user's local data remains the source of truth.
#How You Can Help
- Local-first software shows that collaboration and data ownership don't have to be a tradeoff, users can have both. However, the underlying technologies are still evolving. CRDTs are promising for prototypes, but replacing a mature production platform like Firebase with an experimental solution such as Automerge may still be too risky.
For Distributed Systems and Programming Languages Researchers
Most CRDT research assumes a model where all collaborators immediately apply their edits to a single version of a document.
Practical applications need more flexibility
-
rejecting another collaborator's edits and making private changes not shared with others
-
applying changes speculatively (showing a change immediately on user interface before the system knows for sure that it will be accepted or successfully synchronized)
-
Change-history concepts from distributed version control, such as branches, forks, and rebasing, are well understood and can be applied to collaborative software.
Rebase means taking your changes and moving them on top of the latest version of another branch (update your branch with the latest base, while keeping your changes on top)
A fork is a separate copy of a project or document that can be changed independently from the original. Changes made in the fork don't affect the original unless they are later merged.
There is still limited research on collaboration models where multiple versions and branches of a document exist at the same time.
-
There are also open questions around types, schema migrations, and compatibility.
-
Different users may be running different versions of an app with different features, while there is no central database defining a single authoritative schema.
The challenge is to make these different versions work together safely as the data format evolves.
For Human-Computer Interaction Researchers
-
Decentralized systems introduce new UX challenges: how do you show whether someone is online, offline, or available/unavailable states when every user may have a different copy of the data? And what does “online” even mean when users can collaborate directly without an internet connection?
-
When documents naturally build up complex version histories, we need better ways to help users understand and navigate those changes. Today, we mainly use two approaches: Git-style diffs and patches or Google Docs-style suggestions and comments. The open question is whether these models work well enough for non-text data like designs, canvases, and other collaborative documents.
-
In centralized systems, access control and permissions determine who can access or modify data. In a local-first system, anyone who has a copy can modify it locally, so permissions work differently. Other users can choose whether to accept or sync those changes, but they can't control data that already exists on someone else's device.
-
This raises an important question: what does “stop sharing” mean if you can't remove a copy of the data from another person's device?
For Practitioners
-
Software engineers, designers, product managers, and independent developers can gradually move toward local-first software by evaluating their apps against the seven ideals and improving them one step at a time.
-
Fast: aggressive caching and pre downloading resources; trust the local cache by default instead of making the user wait for a network fetch.
-
Multi-device: Services like Firebase and iCloud make syncing data across devices relatively easy, but involve trade-offs around privacy and long-term control. Self-hosted options like Realm Object Server offer more control in exchange for additional setup and maintenance.
-
Offline: Progressive Web Apps can support offline use through Service Workers and app manifests. On mobile, also check for WebKit components or other features that still depend on the network. Test properly by turning off Wi-Fi or simulating poor network conditions.
-
Collaboration: besides CRDTs, the more established technology for real-time collaboration is Operational Transformation (OT), as implemented e.g. in ShareDB.
-
Longevity: Make sure users can export their data in open, standard formats like JSON or PDF. Support options such as bulk export, continuous backups, and direct document downloads so data remains accessible even if the software disappears.
-
Privacy: cloud apps are fundamentally non-private; for mobile/desktop apps, make it clear to users when data is stored only on their device v/s transmitted to a backend.
-
User control: can users easily back up, duplicate, or delete some or all of their documents within the application
-
Call for Startups
-
Developer infrastructure: Provide an easy-to-use local storage layer, that works across mobile, desktop, and web while supporting user control, privacy, multi-device sync, and collaboration.
-
A simple test for success: If all of the company's servers were shut down tomorrow, would its customers' apps and data still keep working?
#Final Take
Computers are among the most powerful creative tools we've built. Software is now where much of our work happens and where our work is stored.
-
To make these tools better, many applications moved to the cloud, making them collaborative, always up to date, accessible from anywhere, and removing the hassle of managing software versions or worrying about which device holds your files.
-
But with cloud software, the service often controls the data rather than the user. We may create and store our work there, but if the company shuts down the service, our data can become inaccessible. Unlike a simple webpage, a cloud app can't always be preserved and brought back later.
-
We don't have to choose between ownership and cloud features. Software can give users real ownership of their data while still providing easy collaboration, syncing, and access from anywhere giving us the best of both worlds.
-
There’s still a lot of work needed to make local-first software practical. Developers can start small by improving offline support and using local storage more effectively.
-
Researchers can improve the algorithms, programming models, and UX, while entrepreneurs can turn technologies like CRDTs and peer-to-peer networking into reliable, production-ready tools.
- Today, building a web app where the server controls all the data is easy. Building collaborative software where users own and control their data is much harder. Closing that gap requires better tools and infrastructure for local-first development.