Urgent.News

What's breaking now, across hundreds of outlets.

Tech

More of the Software You Build May Need to Work Without the Server

A field engineer opens your app in a basement plant room with no signal. The screen shows a spinner, then an error. The job sheet they need was on their phone ten minutes ago, but the app only knows how to ask the server, and the server is out of reach. For years, most apps have been built this way. The real data lives on the server, and the device shows a copy for as long as the connection…

In a basement plant room with no signal, a field engineer opens an app on their phone only to see a spinning icon and an error message. The job sheet they need was available on their phone a mere ten minutes ago, but the app only knows how to seek permission from a server, which is inaccessible at the moment. For years, the majority of applications have been designed in this manner.

The actual data resides on the server, while the device displays a replica as long as the connection remains active. This approach is straightforward to comprehend and functions adequately within an office setting. However, a novel concept has been gaining traction. In 2019, researchers at the lab Ink and Switch, led by Martin Kleppmann, published a paper titled "Local-first software: you own your data, in spite of the cloud."

They advocated for the primary copy of a user's data to reside on their personal device. The application should function seamlessly offline, with the cloud being utilized solely for synchronization and backup purposes across devices and collaborators, rather than serving as the sole repository for the data. The primary challenge arises when two individuals edit the same content while disconnected.

The paper delved into a range of data structures known as CRDTs, or conflict-free replicated data types, which are engineered to ensure that independent changes can consistently merge into the same outcome. Open-source libraries such as Automerge and Yjs have now rendered this practical for shared documents, lists, and notes. While not every application should be constructed this way, certain tools that individuals employ daily, including notes, task lists, design files, and forms completed on-site, could operate significantly better if they never necessitated seeking approval from a server before saving.

For developers, this alters familiar inquiries. Where does the source of truth lie? What constitutes a conflict, and who witnesses it? How does one modify the structure of data that already exists on thousands of devices? How does one delete an item across all platforms? It is not strictly necessary to rebuild anything at present.

Yet, the next time a developer designs a feature, they should consider what happens when there is no connection at all. If the candid response is a spinning icon, it may be worthwhile contemplating whether the data could reside a bit closer to the user employing it.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Don't Blink: a horror game that only moves when you blink

This is a submission for the Presage SmartSpectra SDK Challenge . What I Built Don't Blink is a horror game played with your face. Something is standing at the end of a candlelit hall.

  • Don't Blink moves only when player blinks
  • Ghost advances with each blink, changing pose
  • Game tracks resting heart rate, quickens ghost speed

My Hermes agent used a GitHub token it never saw

Hermes Agent already protects you from the obvious mistake. Ask it to read a .env file and the read is refused. Point it at an ordinary config file holding a token and the token comes back cut down to…

  • Hermes agent accessed GitHub token despite disabled redaction
  • WARDEN firewall protects model while allowing token access
  • Placeholder hash transmitted to model, actual token remained hidden

More from Monday 23 November →