Under the hood reels
What it is
In data-heavy mobile and web apps, the front end is not a thin skin. It owns the source of truth the user sees, the state machine of every screen, perceived performance, offline behaviour, real-time updates, streaming AI output and accessibility. Principal-level answers describe these layers as precisely as the backend.
One screen, end to end
Take the job detail screen in the inspection app. When it opens, the ViewModel subscribes to a database query for the job, its answers and its media. The first frame renders from SQLite in about 50 ms, before any network activity. The technician changes an answer. The ViewModel sends an intent to the repository, which writes the answer and an outbox row in one transaction. The query emits again, the reducer produces a new immutable state with that field marked pending, and Compose recomposes only that row.
Inside it
Unidirectional data flow. Views send intents; a ViewModel or store reduces intents and data changes into one immutable state object; views render it. This is MVI on Android, the same shape with @Observable models or TCA on iOS, and a Zustand or Redux store in React. Observe, don’t fetch. Screens subscribe to database queries. Network results go into the database, which updates the screen. That gives offline support, instant reopening and one source of truth. Effects. One-off events such as navigation, toasts and haptics are separate from state, so rotating the device or recomposing does not repeat them.
A user action through the layers
The view never waits for the network; the user sees their change in the same frame. The same observation path delivers local edits, sync results and real-time updates, so you test one code path.
Tools to know
State management: MVI/UDF · TCA · Zustand · Redux Toolkit · TanStack Query. UDF everywhere; TanStack Query for server state on the web; a store for cross-screen UI state. Local reactive data: Room · GRDB · SwiftData · WatermelonDB · op-sqlite. Whatever gives observable queries on SQLite on your platform. Lists: LazyColumn · UICollectionView · FlashList · virtualised tables. Stable keys, content types, fixed or estimated sizes.
Interview question
“How do you structure a screen in an offline-first app?” Unidirectional data flow: the view sends intents; the ViewModel writes through a repository and observes database queries; a reducer produces immutable state with explicit loading, empty, error, offline and per-row sync states; effects are separate.
What it is
The sync engine is a small runtime inside the app with one job: move local changes to the server and server changes into the local database. It has no UI and no business logic beyond merging. It must be safe to start, stop and kill at any line, because the OS will do all three.
A real-life run
Priya, a field technician, edits twelve inspection jobs in a basement with no signal. Every save writes the job row and an outbox entry in one SQLite transaction, so the app feels instant. Meanwhile two supervisors change instructions on two of those same jobs from the office. At 4:12 pm she walks outside. The phone regains a network, WorkManager’s network constraint is met, and the scheduler calls run(reason = network_back, budget = 8 minutes). The coordinator takes the single-flight lock and reads the cursor c_88411 from disk.
Inside it
Coordinator. Entry point. Takes a single-flight lock so two triggers never run two syncs, computes a deadline from the budget, runs push then pull, and maps exceptions to a result the scheduler understands: success, retry after N seconds, needs login, or disabled. Push stage. Reads the next batch of outbox rows that are ready (not waiting for a retry time), serialises them with op_ids and base versions, and handles each per-operation result inside one transaction. Pull stage. Loops over pages from the stored cursor until the server says has_more is false or the deadline arrives. A 410 Gone response switches it to the rebuild path.
Run loop
Every arrow that changes local state ends in a transaction, so the run can be killed between any two arrows without losing or duplicating data. Push always runs before pull, so the server’s answer already reflects this device’s edits. The result tells the scheduler what to do next, which keeps retry policy in one place.
Tools to know
Local database: Room · GRDB · SQLDelight · WatermelonDB · op-sqlite. Room or GRDB natively; SQLDelight for KMP; WatermelonDB for RN with its sync protocol. Wire format: JSON + gzip · Protobuf (Wire, swift-protobuf). Start with JSON; switch hot endpoints to Protobuf when payloads or parse time hurt on low-end phones. Transport: HTTPS request/response · WebSocket hint channel · gRPC. HTTPS for push and pull; a socket only to say ‘cursor moved’ while the app is open.
Interview question
“Why is the engine single-flight?” Two concurrent runs could push the same outbox rows twice and apply pages out of order. A lock plus idempotent server writes keeps one logical sync at a time.
What it is
The transfer manager moves large files between the phone and object storage. It hashes, splits, uploads and downloads files in parts that each succeed or fail on their own, records progress after every part, and keeps going across network switches, app kills and reboots.
A real-life run
Arjun records a 412 MB walkthrough video of a pump room and taps Submit. The transfer manager copies the file into app storage while computing its SHA-256, so it reads the file once. It asks the server with POST /files/init; the hash is new, so the server starts a multipart upload and returns 52 presigned part URLs of 8 MB each, valid for 15 minutes. Four parts upload at a time. After each one, the ETag goes into the transfer_part table. At part 20 the phone moves from Wi-Fi to 4G: three in-flight parts fail, retry after a short jittered delay and succeed. At part 31 the URLs have expired, the server returns 403, and the manager asks for fresh URLs for parts 31 to 52 only.
Inside it
Public API. enqueue(uri, owner, priority) returns a transfer ID immediately; observe(id) streams progress from the database; cancel(id) marks it cancelled so nothing restarts it. Preparer. Copies the file into app storage, because content URIs and photo-library references can disappear, and computes SHA-256 in the same pass. Optional transcoding happens here, before any bytes leave the phone. Part planner. Chooses part size from file size and network: at least 5 MB (the S3 minimum for all but the last part), usually 8–16 MB, and large enough to stay under 10,000 parts.
Run loop
The app computes the hash once, during the copy, and reuses it for deduplication and final verification. Each part commits independently, so any interruption costs only the parts in flight. Expired URLs are a normal event, refreshed in bulk, never a failure.
Tools to know
Upload protocol: S3 multipart with presigned URLs · GCS resumable uploads · Azure block blobs · tus. Use your cloud’s native protocol; tus when you need a vendor-neutral, open resumable protocol. Integrity: SHA-256 of the whole file · per-part checksums (S3 supports CRC32C, SHA-256 and others). Whole-file hash for dedupe and evidence; per-part checksums to catch corruption in transit. Concurrency: 1 · 2–4 · adaptive. Two on cellular, four on Wi-Fi; drop to one when the battery is low.
Interview question
“Why copy the file before uploading?” Picker and gallery URIs can be revoked or the user can edit the photo. A private copy with a recorded hash is the only stable source for a transfer that may take hours.