Skip to content
All posts

React Native · Expo · Supabase

Offline-first in React Native: notes from MoneyMate

Kamruzzaman Akash · · 2 min read

MoneyMate is a cross-platform expense tracker built with React Native and Expo, with cloud sync through Supabase and local storage on the device. The single most important feature isn't a chart. It's this: you can add an expense with no internet, and nothing is lost.

What "offline-first" actually means

Offline-capable apps work without a network as an edge case. Offline-first apps treat the device as the primary home of your data, and the server as a place to back it up and share it.

The difference shows up everywhere:

  • The UI reads from local data, so it's instant.
  • Writes go to local storage first, then sync when they can.
  • "Saving…" spinners mostly disappear, because the save already happened.

The core pattern

The approach I follow looks like this:

  1. Write locally, immediately. The expense appears in the list the moment you tap save.
  2. Record that it needs syncing. Each local change is marked as pending.
  3. Sync in the background. When the app is online, pending changes go up to the server and are marked as synced.
  4. Pull remote changes. Changes made on another device come down and merge into local data.

Each record carries its own ID created on the device, so it can exist before the server has ever seen it.

The hard part is conflicts

If you edit the same expense on two phones while both are offline, which edit wins? There's no universally right answer, only a choice you make on purpose. For personal finance data, a simple and predictable rule is better than a clever one, as long as the user never silently loses a record they created.

Small details that matter

  • Show sync state honestly. A small "not synced yet" marker builds more trust than pretending everything is in the cloud.
  • Make auth survive offline. Being logged out because the token couldn't refresh on a plane is a terrible experience.
  • Animate from local data. Charts and lists built with Reanimated feel fast because they never wait on the network.

Why I'd build this way again

Users don't think in terms of "online" and "offline". They just expect the app to remember what they told it. Designing around local data first is what makes that expectation true.