Design On-Device Search for End-to-End Encrypted Chat History

Last updated: November 29, 2026

Quick Overview

Design message search for an end-to-end encrypted messaging app like WhatsApp or Messenger, where the server cannot read messages, so search must work over history stored on the user's devices.

Meta
System Design
Software Engineer
Meta
November 29, 2026
Software Engineer
Technical Screen
System Design
Medium

0

0

0 solved


Design message search for an end-to-end encrypted messaging app like WhatsApp or Messenger, where the server cannot read messages, so search must work over history stored on the user's devices.

Default encryption moved search from the server to the client at Meta. This question checks whether the candidate adapts search fundamentals to a phone: local inverted index, storage and battery limits, multilingual tokenization, and consistency across devices.

What the Interviewer Expects
  • State why server-side search is impossible under E2EE
  • Build a local inverted index (for example SQLite full-text)
  • Index incrementally without hurting battery or startup
  • Handle tokenization for many languages and emoji
  • Address multi-device and restored history
Key Topics to Cover
Client-side indexing
Full-text search
Tokenization
Mobile constraints
Encrypted backups
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you search media captions and links?
  • What happens on a device with 200,000 messages restored from backup?
  • How do you rank results?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: search all messages on the device by keyword, filter by chat, type (links, photos, docs), and date; jump to message in context.

Non-functional: results under 200 ms on a mid-range...

High-Level Design

Messages are decrypted on arrival and stored in a local database. An index sits beside it: a full-text virtual table (SQLite FTS5 style) mapping tokens to message row IDs, plus columns for chat ID...


Submit Your Answer
Markdown supported