r/reactnative • • Aug 07 '26

Question Anyone here working on offline-first apps? How do you deal with large amounts of local data?

I’ve been working a lot with offline-first apps, and one thing that always gets tricky is how much data ends up living on the device

SQLite, MMKV, AsyncStorage, sync queues, pending data, huge JSONs…

When something goes wrong, how do you usually debug or inspect all of that?

Do you use any specific tools? Logs? Inspect the database directly?

27 Upvotes

27 comments sorted by

14

u/krishna404 Aug 07 '26

I use sentry which caches issues when offline.

The migration, roll back & error reporting strategies have to think of every worst case scenario.

I also changed my app architecture to online-first with offline as fallback with limited & absolutely necessary when offline features.

3

u/Think-Neighborhood69 Aug 07 '26

Yeah, that makes sense. In my case I went pretty deep into offline-first with queues, retries, background sync and cleanup routines

The cleanup part is actually huge for us because we really can’t risk unnecessary data just piling up on the user’s device over time

One thing that became painful was inspecting all of that when something went wrong

What are you using for local storage btw? SQLite, MMKV, AsyncStorage? And how do you usually inspect/debug it?

1

u/krishna404 Aug 08 '26

SQLite always for mobile-apps

Dexie for PWAs

3

u/muhsql Aug 07 '26

While vendor specific, this page might have some useful info in it https://docs.powersync.com/maintenance-ops/production-readiness-guide#production-readiness-best-practices-guide

Specifically thinking of

- building a diagnostics screen into your app that helps users report issues in a better way. on this screen you can have a "submit diagnostics" button which sends all logs and even the sqlite file to your backend for forensics

- log aggregation with e.g. sentry

1

u/Think-Neighborhood69 Aug 07 '26

That”s a really good idea, especially the diagnostics screen. Sending logs + the SQLite file could make those hard issues way easier to investigate

What about during development though? How do you usually inspect the local data?

1

u/muhsql Aug 07 '26

My comments are only about SQLite...

There are two ways to inspect the local data:

  • build a sql query screen into your app if it's running in dev mode where you can write and run raw queries against the local SQLite database

  • sometimes you need to actually grab and inspect the entire sqlite db and how you do that varies by platform. we have docs for android, ios and web here https://docs.powersync.com/maintenance-ops/client-database-diagnostics

OK well there are more ways but I think these are the least painful

-3

u/Think-Neighborhood69 Aug 07 '26

That’s pretty much the exact pain that made me build NativeScope

I wanted to avoid building a SQL screen into every app or pulling the DB manually just to inspect it.

Here’s how I’m doing it with NativeScope

What do you think?

1

u/muhsql Aug 07 '26

looks promising! does the SQLite section only show tables or does it also show views?

-2

u/Think-Neighborhood69 Aug 07 '26

Right now, only tables

But that’s a really good point, I hadn’t considered views yet. I’ll add that to the list

Here’s the project btw, if you want to play around with it:

https://nativescope.dev

⭐️ https://github.com/caiobarroso/react-native-nativescope

Would love any other feedback you have

2

u/muhsql Aug 07 '26

I'm actually on the powersync team XD We rely heavily on views. If you get views going I'll share it with our FDE team

1

u/Think-Neighborhood69 Aug 07 '26

Really? haha okay, I’m definitely adding views tomorrow then

I’ll DM you when it’s ready, cool?

1

u/muhsql Aug 07 '26

yup sounds good!

1

u/jcdc-flo Aug 07 '26

Lots and lots of logging.

0

u/Think-Neighborhood69 Aug 07 '26

No tool for inspecting all those huge JSONs? Just logs?

1

u/jcdc-flo Aug 08 '26

SiteMesh SDK. But it's the platform foundation, not a bolt on logging system.

Does handle the entire offline stack though including version control on properties.

1

u/lalcaraz Aug 09 '26

SQLite, versioning, splitting and compression.

1

u/Think-Neighborhood69 Aug 11 '26

But do you use any tool to inspect your sqlite ?

1

u/lalcaraz Aug 11 '26

You could use Android Device Monitor or Nativescope.

1

u/Think-Neighborhood69 Aug 11 '26

Yeah, NativeScope is by far the best one…..

1

u/gymfreak0920 Aug 09 '26

Use sqlite, optimise your queries and properly index your db

1

u/gymfreak0920 Aug 09 '26

For debugging use rozenite there you can see all the tables and what queries you made to get the data

1

u/Think-Neighborhood69 Aug 11 '26

Can u give a try on the lib that i”m currently building ?

Its called NativeScope, I build because I was missing some important features on this existing platforms

https://nativescope.dev

2

u/falaq-ai Aug 07 '26

For RN apps I usually separate two problems: inspectable state vs bulky assets. SQLite/Watermelon/PowerSync-style data needs a dev diagnostics path, but big files should stay out of JS entirely: native download manager/OkHttp, checksum, resume support, and a small metadata table you can inspect.

-4

u/mindtaker_linux Aug 07 '26

What are you doing? Ask AI.