/Practice

Interview room reels

Interview room1 / 11
1 / 9

Question

We’re building an app for 200,000 field technicians who inspect pipelines. They work underground for hours with no signal, capture 30 to 60 photos and short videos per job, and fill long forms. Supervisors must see results within minutes of a technician getting signal. Design the mobile and backend architecture.

2 / 9

In plain words

An app that pipeline technicians carry to inspection sites. They open a job, walk the site, answer a long checklist, take photos and short videos as evidence, and submit. Supervisors in the office watch jobs arrive on a web dashboard and send back corrections. Think of a courier’s paper notebook. At every stop he writes everything down, and the office copies the notebook whenever he passes a phone booth. The notebook is the truth; the phone booth is a bonus.

3 / 9

Ask before you design

“How long can a device stay offline?” Up to two weeks at remote sites. “Is a job edited by more than one person?” A technician owns the inspection; supervisors can change job details and instructions. “Which platforms, and what does the team know?” Android and iOS. The team is strong in React Native and Kotlin. “How big is the media?” Photos 3 to 5 MB, videos up to 500 MB.

4 / 9

Size it

Active technicians per day: 120k (60% of 200k). Jobs per day: 240k (2 jobs each). Media ingress: ≈ 48 TB/day (50 files × 4 MB × 240k jobs). Sync requests: ≈ 42 req/s avg, ~400 peak (120k × 30 syncs ÷ 86,400, ×10 for peaks). Change log growth: ≈ 25 GB/day (240k jobs × ~100 changes × 1 KB).

5 / 9

Design in words

The phone holds the truth for the technician’s work. Records sync through a small API; media goes straight to object storage; supervisors read the same change stream the phones write into. SQLite on device. The source of truth for screens. Jobs, form answers, an outbox of pending operations and a table of upload parts. Encrypted with SQLCipher because the phone can be lost. Sync engine. Native code (Kotlin and Swift, or one KMP module) so it runs without the JS runtime. Pushes the outbox with op_ids, then pulls changes after its cursor.

6 / 9

Decision they will probe

UI framework: React Native, native sync core over Fully native apps. Team skills and speed; the parts that must run in background are native anyway. Conflict policy: Field-level merge over Last-write-wins. Supervisor and technician edit the same job; whole-record overwrite would lose work.

7 / 9

A follow-up to expect

“A technician uploads the same photo twice. What happens?” The hash matches an existing object, so /files/init returns exists: true and the app skips the upload. The record just references the same media.

8 / 9

Front end

The technician app is the hardest part of this system to get right. It must be fast with gloves on, readable in sunlight, and honest about what has and has not reached the office. The team uses React Native for screens, with native modules for everything that runs in the background. Screens: React Native (New Architecture, Fabric), FlashList, render state, collect input, never call the network. View state: Zustand stores + WatermelonDB observables, derive what each screen shows from the database. Form engine: JSON-schema checklist + react-hook-form, conditional questions, validation, per-field autosave.

9 / 9

What makes it principal-level

A principal answer also sizes the system first, separates records from bytes, chooses merge rules per field, covers evidence integrity and the long-offline edge case, and explains why the sync core is native even in a React Native app.

Offline-first inspection app with huge uploads
#mobile#interview
Interview room2 / 11
1 / 9

Question

Design the messaging feature for a service marketplace: customers and providers chat one-to-one and in small groups of up to 50. Messages must arrive in order, show sent, delivered and read states, work offline, and support photos. Expect 5 million daily users.

2 / 9

In plain words

Chat inside a services marketplace: customers and providers message each other one-to-one or in small groups, share photos, and see when messages are sent, delivered and read. Think of WhatsApp built into the booking app. Like a post office that numbers every letter in a conversation. Anyone holding letters 1 to 40 who receives letter 43 knows exactly which two to ask for.

3 / 9

Ask before you design

“Group size limits?” 1:1 and groups up to 50. No broadcast channels. “End-to-end encryption?” Not in v1; encrypted in transit and at rest. “Multiple devices per user?” Yes, phone and tablet; history must match on both. “How long is history kept?” Forever for 1:1, two years for groups.

4 / 9

Size it

Daily users: 5M. Messages per day: ≈ 100M (20 each). Average write rate: ≈ 1,150 msg/s (100M ÷ 86,400). Peak write rate: ≈ 10k msg/s (×8–10 at evening peaks). Concurrent sockets: ≈ 1M (20% of daily users online at peak). Storage: ≈ 50 GB/day text (100M × ~500 bytes with metadata).

5 / 9

Design in words

Clients hold a persistent socket to a gateway layer. A chat service orders and stores messages per conversation, and a fan-out step delivers to online devices or falls back to push. WebSocket gateways. Thin, stateful only for connections. A registry in Redis maps user and device to the gateway holding its socket, so any service can route a delivery. Chat service. Assigns each message a per-conversation sequence number, dedupes on the client message ID, and appends to the store. This step decides the order.

6 / 9

Decision they will probe

Transport: WebSocket over Long polling or MQTT. Bidirectional, widely supported, and gateways scale horizontally with a connection registry. Fan-out: On write over On read. Groups cap at 50, so writing to each recipient’s inbox is cheap and makes unread counts trivial.

7 / 9

A follow-up to expect

“How do you show ‘typing…’?” Ephemeral events over the socket only, never stored, throttled to one every few seconds.

8 / 9

Front end

The chat client is a small real-time system of its own: a connection manager, a local message store, an outbox for sends and a UI that never jumps or flickers as messages change state. UI: Jetpack Compose / SwiftUI, lists, composer, receipts. ViewModels: StateFlow / @Observable, map database queries to UI state. Connection manager: OkHttp WebSocket / URLSessionWebSocketTask, connect, heartbeat, reconnect with jitter, route events.

9 / 9

What makes it principal-level

A principal answer sizes sockets and write rate, makes sends idempotent, orders by server sequence, treats socket delivery as an optimisation over cursor sync, and explains how the design changes for large channels and encryption.

Real-time chat with offline delivery
#mobile#interview
Interview room3 / 11
1 / 9

Question

Design the home feed for a social shopping app: an endless scroll of posts with photos and short videos. It must open instantly, scroll at 60 fps on mid-range Android phones, and feel fresh. 20 million daily users.

2 / 9

In plain words

The home screen of a social shopping app: an endless scroll of posts from brands and people you follow plus recommendations, with photos and short videos. It is the first thing users see and the place they spend most time. Like a newspaper vendor who keeps yesterday’s paper on the counter so you can start reading immediately, while today’s edition is being fetched from the van.

3 / 9

Ask before you design

“Ranked or chronological?” Ranked, from people and brands the user follows plus recommendations. “What share of posts are video?” About 30%, mostly under 30 seconds. “Minimum device?” Android with 3 GB RAM, iPhone 11 and newer. “Do accounts with millions of followers exist?” Yes, a few thousand brands.

4 / 9

Size it

Feed opens per day: ≈ 100M (20M users × 5 sessions). Feed page requests: ≈ 3,500/s avg (100M × 3 pages ÷ 86,400). Image egress: ≈ 2 PB/month (mostly CDN cache hits). Cold start budget: < 1.5 s to first post (cached page shown first).

5 / 9

Design in words

The app renders a cached page instantly, then refreshes from a feed service that merges precomputed timelines with recommendations. Media comes from a CDN in sizes chosen for the device. Local cache. The app stores the last few pages of posts, so it opens on yesterday’s feed in under a second while the fresh page loads. Image loader. Requests the exact width the screen needs from the CDN, decodes off the main thread, and keeps memory and disk caches with size limits.

6 / 9

Decision they will probe

Timeline build: Hybrid fan-out over Pure push or pure pull. Balances cheap reads with bounded write amplification from huge accounts. Image sizing: Fixed width buckets over Exact pixel sizes. A handful of sizes keeps CDN hit rates high.

7 / 9

A follow-up to expect

“How do you measure ‘opens instantly’?” Time to first post rendered, from process start, as p50 and p90 by device class, in production telemetry.

8 / 9

Front end

For a feed, front-end engineering is the product. The client owns perceived speed, scroll smoothness, media memory and data use, and it produces the event stream that ranking depends on. UI: Compose LazyColumn / SwiftUI List or UICollectionView / FlashList, render items with stable keys and content types. Paging: Paging 3 RemoteMediator / custom cursor pager, load from DB, fetch next page, write to DB. Images: Coil / Nuke or Kingfisher / expo-image, sized requests, memory + disk cache, downsampling.

9 / 9

What makes it principal-level

A principal answer sets performance budgets, explains hybrid fan-out with numbers, designs media for the device and network, and keeps the feed working when ranking fails.

Infinite feed with images and video
#mobile#interview
Checkout and payments that never double-charge
Healthcare appointment booking without double-booking
Mobile platform for 150 engineers: builds, releases, flags
An AI assistant inside a mobile app
On-device AI versus cloud: a hybrid design
Retrieval-augmented answers over company documents
Serving an open LLM on your own GPU fleet
Shipping LLM features safely: evals, guardrails, monitoring