← Blog

Building Offline-First Apps That Actually Work

·
PWASQLiteArchitecture

Most "offline-first" apps are really "online-first with a cache." They work fine in a coffee shop with spotty wifi, but break down in a workshop with no signal at all.

I built a workshop management PWA that needed to be fully functional offline -- not degraded, not read-only, but fully operational. Here's what I learned.

The Constraints

The app needed to handle:

  • Creating and editing work orders with no connectivity
  • Tracking cash movements and client balances
  • Importing legacy data from DBF files
  • Exporting the entire database as a single file for backup

The key constraint: the app had to feel the same whether online or offline. Users shouldn't need to think about connectivity.

Why SQLite, Not IndexedDB

IndexedDB is the "standard" for browser storage, but it has real problems for operational apps:

  • No SQL -- you're writing verbose cursor-based queries
  • Schema migrations are painful
  • No easy way to export the entire database
  • Performance degrades with large datasets

SQLite (via sql.js compiled to WASM) gave us:

  • Real SQL queries
  • Single-file export/backup (just download the .db file)
  • Mature migration tooling
  • Predictable performance at scale

The tradeoff: a ~1MB WASM bundle. For an internal tool, that's acceptable.

Data Sync Strategy

We kept it simple: no real-time sync. The app works standalone. When online, it can push data to the server, but it's not required.

This eliminated an entire class of complexity:

  • No conflict resolution
  • No merge strategies
  • No "last write wins" surprises

The user explicitly exports or syncs. The app never silently overwrites their data.

Lessons

  1. Offline-first is a UX decision, not a technical one. The architecture follows from "how should this feel?" not "which API should I use?"
  2. SQLite in the browser is underrated. For data-heavy apps, it's better than IndexedDB in almost every way.
  3. Skip real-time sync if you can. Explicit sync is simpler, more predictable, and easier to debug.
  4. Export everything. Users trust tools that let them take their data and leave.

If your team is tracking work on spreadsheets and losing data, let's talk about building something better.

Want to discuss this?

If this resonated with a problem you're facing, let's talk.