DEV Community

DEVANSHU PATIL
DEVANSHU PATIL

Posted on

Offline-First Doesn't Mean "No Internet"

Offline-First Doesn't Mean "No Internet"

One architectural decision I've found particularly interesting while building FinLedger is the idea of making the application offline-first.

At first, "offline-first" can sound like:

The app should work without the internet.

That's true, but it's not the complete idea.

The more important question is:

What should the application consider its source of truth when the network is unavailable?

For a personal finance application, I think this matters a lot.

The database should not depend on the network

If I record a transaction, I don't want the core operation to depend on an API being available.

A useful flow is:

User action
    ↓
Local database
    ↓
UI updates
Enter fullscreen mode Exit fullscreen mode


`

The network becomes an additional capability rather than a requirement for basic functionality.

This is one reason local persistence is so important in an offline-first architecture.

With FinLedger, the application is designed around local data and uses Android technologies such as Kotlin, Jetpack Compose, Room, and WorkManager.

Think about the source of truth

Imagine I add:

text
Expense: ₹500

The UI shouldn't need to wait for:

text
Internet

API

Server

Response

Database

UI

just to show the transaction.

Instead:

text
Expense created

Room database updated

Observable state changes

Compose UI updates

The user gets immediate feedback.

The application can then perform network-related work separately when necessary.

Offline-first changes how you design features

Consider exchange rates.

Unlike a locally created transaction, exchange rates are external data.

They may require a network request.

So the architecture can treat them differently:

text
Local transaction

Local database

Immediately available

versus:

text
Exchange rate

Fetch from API

Store locally

Use cached value when offline

Now the application can still provide useful functionality even when the network isn't currently available.

WorkManager fits naturally here

Some operations don't need to happen immediately.

For example, background work can be scheduled for tasks that should happen when the required conditions are available.

Conceptually:

text
Application

Schedule background work

WorkManager

Check constraints

Perform operation

This is different from blocking the user's current interaction until the network finishes.

The user can continue using the application while background work happens independently.

Offline-first also creates new problems

It's not automatically easier.

You now have to think about:

  • Stale data
  • Synchronization
  • Conflicts
  • Failed requests
  • Retries
  • Cached data
  • Data consistency
  • Background execution

For a fully local application, some of these problems disappear.

But once remote data or synchronization is introduced, they become architectural concerns.

That's why I don't think "offline-first" should be treated as just a feature.

It's a data architecture decision.

The important distinction

There is a big difference between:

text
Offline-capable

and:

text
Offline-first

An offline-capable application might say:

"If the internet disappears, we'll try to keep working."

An offline-first application starts from:

"The local experience should work independently, and network connectivity is something we can use when available."

That difference affects the architecture from the beginning.

What I'm learning

Building a real application has made me think less about individual technologies and more about the responsibilities between them.

Room isn't just a database library.

WorkManager isn't just a background-task API.

Jetpack Compose isn't just a UI toolkit.

Together, they can support an architecture where the application doesn't make the network a dependency for every user action.

For a finance application, that makes sense to me.

Your transaction history shouldn't become inaccessible simply because your connection disappeared.

A good offline-first architecture doesn't pretend the network doesn't exist.

It makes sure the application doesn't depend on it for everything.

android #kotlin #jetpackcompose #room #workmanager #architecture #mobiledevelopment #softwareengineering #buildinpublic

Top comments (0)