Design Voice Message System

Medium50 min
1 / 30
understanding8 min read

Problem framing and voice-note constraints

How Problem framing and voice-note constraints (understanding) informs Voice Message System architecture and interviewer depth.

Problem framing and voice-note constraints

Voice notes are asynchronous media messages: users press-and-hold to record, release to send, and recipients stream playback with waveform scrubbing. Unlike live VoIP, the system optimizes for bursty uploads, durable storage, and chat-timeline ordering—not sub-100ms duplex audio.

Voice-note specifics

  • Products like WhatsApp, Telegram, and iMessage treat voice notes as first-class chat messages with delivery receipts and forward semantics.
  • Interviewers probe whether you separate capture UX from upload reliability and whether playback can start before upload fully completes on the sender side.
  • Assume mobile-first clients with intermittent connectivity; offline queueing on device must not create duplicate server messages after reconnect.

Design choices for this slice

  1. Keep chat timeline writes strongly consistent per conversation partition.
  2. Store audio in object storage with content-hash dedupe for forwards.
  3. Emit upload.completed events for waveform/transcode workers with idempotent consumers.
  4. Expose playback only after authorization service binds recipient principal to manifest.
  5. Measure commit latency, time-to-playback-ready, CDN hit ratio, and worker queue age.

Java

javaOne Dark Pro
1public final class VoiceNoteComplete {
2 public String commit(String sessionId, String idempotencyKey, String checksum) {
3 if (sessionId == null || idempotencyKey == null || checksum == null) {
4 throw new IllegalArgumentException("required");
5 }
6 return sessionId + "::" + idempotencyKey + "::" + checksum;
7 }
8}

Python

pythonOne Dark Pro
1from dataclasses import dataclass
2
3@dataclass(frozen=True)
4class CompleteVoiceNote:
5 session_id: str
6 idempotency_key: str
7 checksum: str
8
9def commit_voice_note(cmd: CompleteVoiceNote) -> str:
10 if not cmd.session_id or not cmd.idempotency_key or not cmd.checksum:
11 raise ValueError("required")
12 return f"{cmd.session_id}::{cmd.idempotency_key}::{cmd.checksum}"

TypeScript

typescriptOne Dark Pro
1export interface CompleteVoiceNote {
2 sessionId: string;
3 idempotencyKey: string;
4 checksum: string;
5}
6
7export function commitVoiceNote(input: CompleteVoiceNote): string {
8 if (!input.sessionId || !input.idempotencyKey || !input.checksum) {
9 throw new Error("required");
10 }
11 return `${input.sessionId}::${input.idempotencyKey}::${input.checksum}`;
12}

Operational validation

  • Page when voice-note commit error rate exceeds 1% for 10 minutes.
  • Page when transcode/waveform queue age p95 exceeds 5 minutes.
  • Track playback time-to-first-byte p95 per country cluster.
  • Alert on duplicate message_id detection rate above baseline.

Interview delivery

In phase understanding, lead with invariants, show data flow, quantify scale, then close with one explicit trade-off and metric impact for voice messaging.

Why interviewers care

Voice Message System interviews reward crisp scope, explicit trade-offs, and failure stories—not generic microservice diagrams.

The failure that defines the design

The outage to narrate is the lost voice note from a flaky mobile upload. A user records a 30-second message on a subway, hits send, the connection drops mid-upload, and the recording is gone — the worst experience because the audio cannot be re-created. The fix is structural: record to a local file first (durable on-device), upload via resumable chunked transfer so a dropped connection resumes from the last byte rather than restarting, and only mark the message sent once the upload is confirmed. A voice-message system lives or dies on never losing a recording to a network blip, because unlike text, the user cannot just retype it.

Key Highlights

  • Voice-note control/data plane split
  • Idempotent commit and ordering keys
  • Measurable playback and worker SLOs
What interviewers want to hear
Quantify Opus sizing and peak commit rate before naming services.
Pro tip
Async waveform/transcript sidecars must not block timeline commit.

Section Rescue Kit

Buzzwords to use:

Content-Addressable BlobPlayback Manifest

Safe statements:

  • "For Problem framing and voice-note constraints, I separate metadata commits from byte transfer and defend with metrics."
  • "I never let enrichment workers block message commit for voice notes."
Design Voice Message System - System Design | WinJob | WinJob