DEV Community

Cover image for From Cloud to Device: The Shift Toward a First Local Architecture
Keiler Guardo Herrera
Keiler Guardo Herrera

Posted on

From Cloud to Device: The Shift Toward a First Local Architecture

Lately, I’ve started integrating the First Local approach into my applications—most notably in Keppli Finance, a personal finance app designed to help people manage their money more effectively. Through internal analysis using tools like Sentry, I noticed that several users were experiencing connectivity issues. Most of these cases were from people in rural areas or those relying on unstable mobile data connections. This brought to mind a conversation I had with my tech lead at the company I currently work for. We were discussing how the First Local development paradigm is becoming increasingly popular within the developer community, and how it can be used to significantly improve user experience, especially in contexts where internet access is unreliable. That conversation inspired me to write this article, where I’ll share some key concepts, benefits, and personal experiences applying this approach—both in Keppli Finance and other side projects. To get started, let’s briefly define what First Local actually means.

Introduction

In software development, the First Local approach—also known as local-first or offline-first is based on the idea that applications should manage and store data primarily on the user’s device, then synchronize it with the cloud whenever possible. In other words, the primary copy of the data lives locally—for example, in a database like SQLite—and the application doesn’t rely on a remote server to function continuously. Picture a collaborative document, for instance: instead of being hosted exclusively on a Google data center or any other provider, each user maintains a local copy on their device. They can make edits offline, and once they're back online, the changes are synced automatically. This paradigm aims to offer the best of both worlds: the benefits of the cloud—such as multi-device access and real-time collaboration—while always prioritizing the user’s local experience.

Why Is the “First Local” Approach Trending?

Several factors have fueled the recent rise of the First Local approach. First and foremost, user expectations have shifted: today, we use mobile apps in subways, on airplanes, or in areas with poor signal—and we expect them to work regardless of connectivity. An app that becomes useless without an internet connection creates a frustrating experience. As a Supabase blog points out, “the worst version of your app is the one that can’t be used”. That’s why developing with an offline-first mindset ensures that users can continue using the app even with unstable connections—dramatically improving satisfaction and reliability. There’s also a major added benefit: performance. Since apps don’t rely on a remote server for every interaction, First Local architectures provide ultra-low-latency experiences. Operations are executed directly against the device’s local database, removing network delays and creating a sense of instant response.

In a world where smartphones and laptops are increasingly powerful, it only makes sense to take advantage of that local hardware. On top of that, the First Local approach offers greater autonomy and can significantly reduce costs. By relying less on the cloud, infrastructure fees drop, and single points of failure are avoided. At the same time, users benefit from having more control over their data—it stays with them, rather than being locked behind a remote platform’s policies.

Benefits of the First Local Approach

The approach of storing and processing data locally before syncing it with the cloud brings multiple advantages over traditional cloud-centric models or simple caching mechanisms:

Offline Availability and Resilience

The app continues to work without an internet connection. All core functionalities operate against the local database, allowing users to open the app on a plane, in a tunnel, or in a rural area—and still view or input data normally. An offline-first design ensures that being offline doesn’t disrupt the user: they can continue working without interruption. Additionally, the app becomes more resilient to server or cloud outages. If the backend experiences downtime, users still retain their local data and can keep using the app as usual.

Faster User Experience (Low Latency)

By removing the need to wait for a server response with every action, First Local apps feel instantaneous. Reads and writes happen in milliseconds directly on the local database, avoiding network delays altogether. This results in snappier interfaces, free from constant loading spinners. Even when online, working locally improves overall speed, reduces data usage, and delivers a much smoother experience.

Optimistic and Non-Blocking Interactions

First Local apps make it easy to implement optimistic updates. When a user performs an action—like adding an item or editing a field—the interface reflects the change immediately using the local copy, without waiting for server confirmation. Most modern sync tools track these changes and push them later. If the backend rejects them, they can even be rolled back. This way, the user experiences instant feedback, with no blocking or interruptions.

Real-Time Collaboration Without Sacrificing Performance

While it might seem that a local-first approach limits collaboration, the reality is quite the opposite. By maintaining synchronized local copies, data can be updated in real time across users using notifications, CRDTs, or WebSockets. This enables collaborative experiences—such as text editors or real-time boards—while preserving local performance and smooth interactions, without relying entirely on the network.

Lower Data Usage and Efficient Operation

By reducing the frequency of server calls, these apps help save on mobile data usage. Sync operations can be configured to run only on Wi-Fi, or when there’s a strong signal or sufficient battery—optimizing resource consumption. This is especially valuable in regions where connectivity is limited or expensive.

Reduced Infrastructure Dependence and Costs

For startups and small teams, lowering the load on the backend means fewer expenses on servers and bandwidth. By processing more on the client side, it's possible to scale with less infrastructure. Additionally, simplifying—or even eliminating—multiple endpoints can reduce development and maintenance time. This allows teams to focus on what truly matters: the user experience.

Challenges and Limitations of the First Local Approach

Although the First Local approach offers numerous advantages, it also presents significant technical and design challenges:

Sync and Conflict Resolution

Maintaining multiple copies of data—one per device—synchronized with a central version introduces the risk of conflicts, especially when multiple users edit the same record while offline. Automatically resolving these conflicts without data loss is a complex task. Technologies like CRDTs (Conflict-free Replicated Data Types) enable all edits to converge eventually, but integrating them isn’t always straightforward. Tools like ElectricSQL already implement mathematically proven models for conflict resolution, but if you're building from scratch, you’ll need to carefully design merge algorithms. Even with simpler strategies like “last write wins”, precise decisions must be made to avoid losing valuable data or introducing inconsistencies.

Partial Replication and Managing Local Scope

It’s not always desirable to sync the entire database to every device. Due to space limitations, privacy concerns, or data volume, it’s necessary to define which subset of data should be kept locally. This requires additional logic to predict what to fetch and when. Some solutions implement dynamic partial replication, for example, downloading only a list of projects and syncing the details when one is opened. However, it's also important to consider how to clean up old data to prevent local storage from growing uncontrollably.

Client-Side Validation and Business Rules

In traditional architectures, validations and business rules live on the server. In an offline-first model, many of these rules need to be moved to the client—at least temporarily. For example, if only an admin is allowed to create a certain resource, how do you prevent an offline client from doing so? The server can reject the action once reconnected, but by then, the app has already shown a change that will be reverted, leading to confusion. Solutions like Postgres RLS (Row-Level Security) policies (as used in Supabase) can be adapted to the client with tools like ElectricSQL, but ensuring consistency without compromising the user experience remains a challenge.

Storage and Performance on Devices

Loading more data onto the device exposes physical limitations. Lower-end devices may struggle with limited storage, CPU, or RAM. Local databases must be optimized (using indexes, efficient queries) and stale data should be cleaned up regularly to prevent the app from becoming slow or unstable. On the web, there are also storage quotas in IndexedDB, and on mobile platforms like iOS, the system may terminate background processes—potentially interrupting sync operations if not handled properly.

How I’ve Used It in Personal Projects

In my personal projects, I’ve started actively incorporating the First Local approach as a key strategy to improve user experience—especially in contexts where connectivity is limited or intermittent. One of the most representative examples is Keppli Finance, a personal finance app I developed to help users understand, organize, and improve their relationship with money. During the initial testing phase, tools like PostHog and Sentry revealed that several users—particularly users in rural areas of Colombia who were experiencing issues loading data or recording transactions when they didn’t have a stable internet connection.

To address this, I implemented local storage using SharedPreferences in Flutter. While SharedPreferences is ideal for simple offline persistence, more complex or larger-scale syncing may require SQLite, Hive, or Isar.. Every time a user adds an income or expense, the data is temporarily saved on the device. Then, once connectivity is restored, the app automatically syncs this data with the backend (built with NestJS and Supabase), keeping track of any pending changes.

This allowed users to:

  • View all transaction history
  • Record transactions offline with a seamless experience.
  • Avoid data loss if the app closes unexpectedly before syncing.
  • Automatically sync changes in the background when the connection returns.

Additionally, local flags are used to track pending syncs, ensuring basic persistence of critical data until it can be sent to the server. This approach not only improved the app’s overall stability but also delivered a much smoother and more reliable user experience—even under poor connectivity conditions.

Final Thoughts

The First Local trend represents a natural evolution in software development, driven by the need to enhance user experience and increase application resilience. By prioritizing local data storage and processing before syncing with the cloud, apps become faster, functional offline, and offer users greater control over their information.

Of course, this model is not without its challenges. Distributed sync, conflict resolution, partial replication, and offline data validation all require a more complex architecture and a shift in mindset from the traditional client-server model. Even so, the ecosystem has responded with increasingly powerful tools—such as Supabase + ElectricSQL, and Replicache, that make it possible to implement local sync without having to rebuild your entire app from scratch. First Local isn’t just a technical improvement—it’s a paradigm shift. Instead of forcing the user to adapt to the limitations of the network, it’s the application that adapts to the user’s environment. As one quote from the Expo documentation perfectly puts it: “The availability of another computer (a server) should never prevent you from working.”

This approach will continue to gain traction. In the near future, we’re likely to see more and more frameworks and libraries adopting local-first capabilities by default. And that’s good news it means faster, more reliable apps that respect and empower their users. For developers, First Local is an opportunity to rethink how we build software putting the user and their context first. And for users, it translates into more human experiences: apps that respond instantly, work anytime, and give them back control over their data.

Thank you so much for making it this far and reading this article. Writing it has been a great learning experience for me, and I hope it has been helpful—or even inspiring—for you as well.

If you're interested in more topics on development, technology, software architecture, and real-world product-building experiences, feel free to visit keilerguardo.com, where I’ll be publishing more content like this.

I’d love to hear your thoughts, ideas, or experiences with the First Local approach in the comments.

Have a great day, and thank you for being part of this conversation about the future of software!

Top comments (0)