Mobile Systems Design, Offline Sync & API Integration: 15 Core Questions
System design interviews for mobile developers focus heavily on synchronization algorithms, API contract validation, and data queue buffering. Scaling mobile architectures requires understanding how to design local storage hierarchies, recover from connection drops gracefully, and route deep link states. This guide explores 15 systems design questions.
Questions Quick Links
Q1. How do you design a real-time data synchronization system for mobile apps?
Answer:
Avoid constant database polling which drains device batteries. Implement an event-driven sync system using **WebSockets** or **Server-Sent Events (SSE)**. The server broadcasts lightweight "sync notifications" containing transaction IDs, and the mobile client fetches details on-demand.
Q2. How do you design an offline-first storage and synchronization queue?
Answer:
When offline, write all write transactions to a local SQLite **Outbox Queue table** instead of directly executing networking calls. Spawn a background worker that monitors connection changes. When connectivity is restored, execute the queue sequentially, handling conflicts using version timestamp checks.
Q3. What is Optimistic UI updating and how do you design it?
Answer:
Optimistic UI updates render target states immediately before receiving server confirmation (e.g. marking a post liked instantly). If the server transaction fails, revert the state in the database and animate a UI rollback.
Q4. How do you handle network request failures resiliantly?
Answer:
Use **Exponential Backoff** with **Jitter**. Increase delays between request retries exponentially (e.g., 1s, 2s, 4s, 8s) and inject random milliseconds (Jitter) to prevent overwhelming backend microservices.
Q5. Design an image caching pipeline for high-performance scrolling.
Answer:
Implement a three-tiered image cache:
- L1 Memory Cache: In-memory dictionary (using LRU caching) for rapid widget layout access.
- L2 Disk Cache: Decoded images stored on device storage for persistent retrieval.
- L3 Network Fetch: Download source files when L1/L2 caches are empty, caching the bytes immediately.
Q6. How do you design pagination for instant messaging chat lists?
Answer:
Avoid offset-based pagination (`LIMIT/OFFSET`) which fails when new messages arrive. Use **Cursor-based Pagination** using message timestamps or IDs (e.g., `where timestamp < cursor`).
Q7. Why should mobile applications use the BFF (Backend for Frontend) pattern?
Answer:
Direct calls to multiple backend microservices require multiple HTTP handshakes, draining battery and data. A BFF gateway aggregates microservice calls into single network requests, compressing payloads before sending.
Q8. How do you design licensing checks that survive offline usage?
Answer:
Issue a cryptographically signed JWT token on login containing permission claims and expiration dates. Store the token securely in Keychain/Keystore. The app validates the signature locally to verify offline access.
Q9. How does mobile video streaming handle media buffering?
Answer:
Use HTTP Live Streaming (HLS) or DASH. The player downloads video segments as separate `.ts` or `.m4s` files, adjusting streaming quality dynamically based on network speeds.
Q10. Design an analytics event tracking queue.
Answer:
Writing analytics events to the server in real-time ruins battery performance. Store tracking parameters locally in an SQLite table. Flush events to backend servers in batches periodically (e.g., every 30 events or 5 minutes).
Q11. Design a crash reporting system that captures app failures instantly.
Answer:
Register an uncaught exception handler in the native thread context. When a crash occurs, intercept the error, freeze threads temporarily to write stack traces to disk, and upload files on the next app startup.
Q12. How do APNs and FCM route notifications to background apps?
Answer:
APNs/FCM send payloads directly to iOS and Android OS background listeners. The system wakes up the application container, runs the handler background code block, and suspends execution again.
Q13. How do you manage database migrations without erasing local data?
Answer:
Store a database version integer. When a schema changes, write migration scripts to add/alter tables sequentially, preventing data loss.
Q14. How do gRPC and Protocol Buffers ensure api safety?
Answer:
Protocol Buffers use compile-time schema contracts (`.proto` files) to generate data models for both client and server, preventing runtime parsing crashes.
Q15. Design a deep linking router that resolves nested page locations.
Answer:
Define a deep linking coordinator. When a link is intercepted, normalize the URL paths. Traverse and update the view navigation stacks dynamically to present target screens, handling user back actions gracefully.