Skip to content

Local-First software, reinventing the way we interact with systems

Updated: at 11:49 AM

I’m no specialist in Local First, I’m just curious learner sharing what I’ve learnt :)

Table of contents

Open Table of contents

Local First software

Local first software has been around for some years but lately they are getting more traction with some famous softwares like Excalidraw, Linear and Miro (up to some point). And the concept is around this definition

A set of principles for software that enables both collaboration and ownership for users. Local-first ideals include the ability to work offline and collaborate across multiple devices, while also improving the security, privacy, long-term preservation, and user control of data.

— Martin Kleppmann, Adam Wiggins, Peter van Hardenberg, and Mark McGranaghan.

Break free from Internet access and servers

As the name suggests, local-first software is focused in having its local data as its main source of truth. This way the application uses the server to make validations, sync data and commit transactions that should be available to other uses. And as soon as you go online you can sync all of the users data into a final version.

But in the end your client application has all the data and code it needs to operate, this way not being relied on internet access. So as soon as it gets connected to the internet it syncs with the server and other Peers.

This makes possible to overcome problems like internet instability way easier. Because now you rely in the data you already know and just complement it with the latest data from the server or other clients in the network. You always have all the data you need.

Take ownership of your data

We are used to send data to the cloud and let the service manage and serve our data. But with local first we can also have control over our data because its present in our Browser/Application alongside all the code we need to operate the software.

This brings some benefits like only sharing necessary data when needed and also being the owner of your data, if for some reason the software you use decides to charge you for the sync feature, you can just continue using it locally indefinably.

This way you are not anymore dependent to the internet and your service provider to see your data. Notion offline experience:

notion offline page

Or even, not sharing data at all

Since we have all or most of the data we need, we can integrate ourselves with other apps and run an collaborative application without even needing to send data to the servers. This peer-to-peer network enables us to be practically be independent from a central server, making availability of a server a well lower priority 🎉 🤞

diagram of a p2p network with local dbs

Some example are DXOS and GUN, with decentralized databases that leverages WebRTC for Peer to Peer (P2P) interactions between clients.

And its FAST!

Since we don’t need to request to the serves every time we want some up to date information or to write something in order to update the screen we have a way smother and fast experience. Local first software usually operates over optimistic updates, which tries to make a local operation, updates the interface and then try to sync with the server. In case of an error or failure to sync the data it just returns to the previous state, making it consistent with other peers.

Unexpected benefits 💸

Since we don’t have to put everything though a server to both operate and serve the information, in some use cases the server becomes a simple router/connector. This can bring huge savings as the servers doesn’t need to process data from the customers. Usually with Client <> Server architectures, the more clients you have, the bigger your server has to be to handle everything. But for peer-to-peer systems this isn’t true, for example you can create a Google Meets like service with all its features and 4k streaming with just a 1vCPU 2GB RAM server for 5-6USD a month.

Ok, now where is the BUT on the free lunch?

Complexity

As you can imagine sync all data from all uses collaborating can become a mess. So this is one of the main challenges of Local-first software, making sure all data is synced as it should and in the way we expect. For solving this there are CRDT (Conflict-free Replicated Data Type) implementations such as Automerge to make easier to manage this situations across devices and across data over time. Here is a representation of the data that needs to be handled by this algorithms

crdt representation

Yes its not that easy and brace yourselves for eventual consistency and conflict resolution!

Well… your data is valuable ¯\(ツ)

Its good to have control over the customer data and be the gatekeeper for this information. In a age where Data is power, having this creates a leverage point in which big corporations and some apps don’t want to make it accessible for everyone. Making the users bounded to their systems its also a way of controlling how your application is used and how you can create new ways of providing the customer data in a more commercialized way.

X/Twitter Brazil ban case

One example of situation of local-first solutions that could have helped. In Brazil we just had a country ban to X (former Twitter) that overnight the social network was banned. The social network had many legal implications, I’m not get into, but a lot of the users were left hanging with a

Twitter DNS off after ban

So maybe years of Tweets of a user are suddenly unavailable. This in a local first scenario wouldn’t be a problem because all data would still be available at least for extraction. All the likes, people you follow, saved insightful posts are just gone.

One example is BlueSky (now Twitter/X replacement in Brazil), that its experimenting a Federated approach to servers, which you can host and provide your on Data feeding it into the network of servers. And this becomes way interesting when its not platform or service bounded, in a way that the data con be shared and feeded into multiple social networks besides BlueSky.

Wrap Up

Hope in this week post you could get a glimpse into the Local First movement and its big bets! And also is hoping that in the near future we won’t see this icon anymore

loading spinner

References and Material

Updates