KatInterview

Design a Clickstream Analytics Pipeline for a Mobile App

System DesignModel answer
MediumModel answerSystem Designsystem-designstreamingkafka

Last updated

Design a pipeline that ingests client events such as installs and clicks, powers near-real-time dashboards, and keeps raw data for batch analysis, with explicit correctness trade-offs.

Design a Clickstream Analytics Pipeline

A consumer app has a very large user base. Clients emit behavioral events such as app installs, impressions, and button clicks. The product team wants to see how the app is doing as it happens, and the data science team wants to dig into history later.

Design the system end to end.

What the system must do

  1. Live dashboards. Show metrics that refresh within seconds, for example installs per minute and click-through rate.
  2. Raw event retention. Keep every raw event so that large offline jobs (daily or weekly rollups, deeper analysis, backfills) can run on it.
  3. Metric scoping. The exact metric list is not fixed. Say which questions you would ask to pin it down, then assume a mix of counters and ratios, sliced by dimensions such as platform, app version, and country.

Quality expectations

  • Very high write throughput from many clients.
  • Seconds-level freshness on dashboards.
  • Storage and compute that scale horizontally.
  • Aggregates that are reasonably correct. Be explicit about delivery guarantees (at-least-once vs exactly-once) and about events that arrive late.

Out of scope

Infrastructure health monitoring (host uptime, service latency) is not required. You may mention it briefly.

What to cover

Walk through the architecture, the main components, the data flow, your storage choices, and how the real-time metrics path differs from the offline analytics path. State your scale assumptions with numbers.

Hints

Hint 1

Start by clarifying metrics, dimensions, freshness targets, and rough scale (users, events per user per day) before drawing components.

Hint 2

Put a durable log between ingestion and everything else so the live aggregation path and the raw archival path can consume independently and replay.

Hint 3

Ratios such as CTR cannot be summed across rows, so think about what you store in the aggregate tables. Also decide which timestamp you window on and what happens to late or duplicated events.