DevPrep

All topics › Software architecture

How do you design an offline-first architecture?

Senior PRO

The point

Offline-first: the app always works with the local database as the source of truth, and the network is merely a way to synchronize. The UI reads from SwiftData/Core Data/SQLite (GRDB) and never waits for the server; a write first lands in local storage, then in a queue for sending. The user sees no difference between "online" and "offline" except a sync indicator.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store