Design Snapchat

Production-grade Snapchat architecture with ephemeral snaps, chat, stories, streaks, Discover-style feeds, media processing, realtime delivery, abuse prevention, and global resilience.

Functional requirements

  • Users can send photo/video snaps and chat messages to friends.
  • Users can open snaps, and the system tracks opened, expired, and screenshot-related metadata.
  • Users can configure a snap as view-once, replay-limited, or saved-in-chat depending on product rules.
  • Users can post stories that expire automatically after a fixed window.
  • Users can save snaps to personal Memories without breaking default ephemeral delivery semantics.
  • Users can receive real-time chat updates and offline push notifications.
  • The system should support Snapchat-specific engagement features like streaks.
  • The platform should support Discover-style publisher content and cached feed delivery.
  • The system should support media processing, safety checks, and access-controlled media delivery.
  • The platform should support friend graph semantics including privacy lists, blocking, and audience restrictions.
  • Users can send, accept, reject, or block friend requests.
  • Story creators can inspect story viewers, and the system tracks unique vs repeat story views.
  • The system should support AR lenses/filter metadata and device-targeted lens delivery.
  • The platform should support analytics and ranking signals for discovery, creator insights, and product tuning.

Non-functional requirements

  • The system should support millions of daily active users with bursty write traffic during peak social events.
  • Real-time message delivery should target sub-300ms end-to-end latency for online recipients under normal load.
  • The system should provide strong privacy guarantees around ephemeral content expiry and controlled access.
  • The architecture should isolate chat, stories, discover, and moderation workloads so one domain does not collapse the others.
  • The platform should remain available during regional failures with documented RPO/RTO goals.
  • The system should provide auditability, abuse controls, and safe operational rollout/rollback behavior.
  • The platform should scale reads and media delivery independently from write-heavy messaging paths.
  • The system should provide observability for both technical SLOs and product KPIs such as opens, streak retention, and story completion rates.
  • The design should support eventual partitioning by user, conversation, publisher, or geography as single-cluster limits are reached.

How the design evolves

Stage 1: Ephemeral snaps + chat lifecycle

Start with the learner-friendly core: sending a snap, opening it once, replaying when allowed, saving in chat when permitted, and expiring metadata safely.

What was missing: Media storage, realtime delivery, and explicit snap lifecycle rules like replay, screenshot flags, and saved-in-chat behavior.

Why that's risky: Without explicit lifecycle policy, product semantics become inconsistent across devices and clients.

What gets added: API edge, snap/chat metadata service, lifecycle-policy service, inbox cache, and a TTL-aware metadata store with replay and screenshot metadata.

Trade-offs: Lifecycle rules add state complexity and more edge cases around replay race conditions.

Stage 2: Friend requests, graph, Memories, and camera upload pipeline

Introduce friend-request workflows, privacy-aware social graph checks, and a separate long-lived store for Memories while moving media off the core API.

What was missing: Friend-request workflows, custom audiences, and a separate persistence path for user-saved Memories.

Why that's risky: Mixing ephemeral snaps and long-lived saved snaps in one store weakens privacy guarantees and complicates retention logic.

What gets added: Social graph API, friend graph store, upload session service, object storage, Memories store, media metadata store, CDN delivery, and media processing queue.

Trade-offs: Friend graph consistency, separate retention models, and signed URL flows add platform complexity.

Stage 3: Realtime chat delivery + engagement events

Separate the request path from realtime delivery and engagement consumers like streaks and notifications.

What was missing: A durable event backbone for sending, opening, notifications, and engagement updates.

Why that's risky: Direct realtime-only delivery loses messages, creates duplicate notifications, and couples product logic too tightly to connection state.

What gets added: Messaging API, realtime gateways, chat event stream, delivery workers, inbox store, push notifications, and streak counters.

Trade-offs: Ordering, dedupe, and engagement counters add more event-driven complexity.

Stage 4: Stories, Discover, ranking, and creator analytics

Move from messaging into a full media platform with fanout, ranking, publisher catalogs, engagement signals, and creator insights.

What was missing: Story viewer semantics like unique views vs repeat views, creator viewer lists, and replay-aware story analytics.

Why that's risky: Without a dedicated viewer/read model, creator insights become expensive and story view counts become inconsistent.

What gets added: Stories/Discover API, story fanout queue, ranking service, feed workers, story/discover cache, story store, viewer store, discover catalog, engagement stream, creator analytics, and sponsored-slot service.

Trade-offs: Fanout-on-write increases storage cost; ranking and sponsored-slot logic add latency and product complexity.

Stage 5: Safety, moderation, and AR lens pipeline

Add the heavy production systems behind a modern media app: abuse detection, moderation, and lens metadata processing.

What was missing: Abuse prevention, policy enforcement, experimentation controls, and media-intelligence workflows at production scale.

Why that's risky: Spam, fraud, unsafe media, and expensive AR/media processing can overwhelm trust, operations, and infrastructure long before raw scale limits are reached.

What gets added: Secure edge controls, risk store, policy engine, scan queue, safety workers, abuse detection workers, lens workers, moderation store, lens metadata store, feature flags, and review console.

Trade-offs: Moderation cost, false positives, and heavy compute for image/video understanding.

Stage 6: Global scale, observability, and disaster recovery

Finish with the architect-level view: regional isolation, observability, safe failover, and clear operational control planes.

What was missing: Regional isolation, operational visibility, analytics pipelines, and explicit rollout/failover controls.

Why that's risky: A single-region or poorly observed system fails catastrophically during outages, celebrity traffic spikes, bad experiments, or deploy regressions.

What gets added: Global traffic routing, three regional platforms, global event backbone, service discovery/config, replicas, warehouse, ML/batch jobs, observability, backups, and rollout control.

Trade-offs: Significant operational complexity, higher cost, and consistency challenges under failover.

Frequently asked questions

How do you guarantee media expires?

Use storage lifecycle policies + periodic sweepers; enforce access tokens with expiry; delete metadata+blobs on schedule.

How do you model view-once, replay-once, and saved-in-chat behavior without hardcoding rules in clients?

Keep a server-side snap lifecycle policy that evaluates message type, chat settings, open state, replay counters, and save permissions. Clients render based on policy decisions, but the source of truth stays on the server.

Why should Memories be stored separately from normal snap blobs?

Memories have different retention, backup, access, and privacy guarantees than ephemeral delivery blobs. Separating them prevents accidental deletion coupling and makes encryption, restore, and legal retention behavior easier to reason about.

How do you represent friend requests, blocks, and custom audiences cleanly?

Model them as different edge types or stateful relationships in the social graph. This lets the same graph support request flows, access control for private stories, and delivery eligibility checks without duplicating logic across services.

How do you track story viewers when users may watch the same story multiple times?

Keep both a unique-view model and a repeat-view event stream. Use the viewer store to track first-seen order and creator-visible viewer lists, while analytics pipelines separately aggregate repeat views, completion rate, and dwell time.

Why separate chat delivery from stories instead of one unified feed service?

Chat needs low-latency person-to-person delivery and receipt tracking, while stories are high-read fanout content with different caching, ranking, and expiry patterns. Splitting them keeps data models and scaling strategies clean.

How do you avoid duplicate notifications or duplicate chat delivery on reconnect?

Use conversation-scoped sequence numbers, idempotent client acknowledgements, and durable inbox state so reconnecting clients can request only the delta since their last confirmed cursor.

How would you model streaks without making every message write expensive?

Keep chat delivery separate from streak accounting. Emit lightweight message-open or send events, update streak counters asynchronously in a fast counter store, and periodically reconcile counters into durable storage.

Why is Discover modeled separately from stories?

Discover behaves more like a publisher feed with ranking, editorial controls, regional availability, and content shelves. Stories are mostly friend-graph fanout with expiry. They share some infrastructure, but not the same product logic.

Why model the friend graph separately instead of storing it in the chat database?

Friendship edges, blocks, best-friend signals, private story audiences, and recommendation inputs evolve independently from chat delivery. A dedicated friend graph service/store keeps access checks, social features, and privacy logic reusable across chat, stories, and Discover.

How do you keep story fanout manageable for celebrities with millions of followers?

Use hybrid fanout. Precompute trays for normal users, but for high-fanout publishers use fanout-on-read or partial materialization with cached shelf fragments. Track publisher fanout cost and dynamically choose the strategy.

How do you safely run experiments or feature rollouts on a global social app?

Use feature flags with cohort targeting, region-scoped rollouts, kill switches, and observability tied to both technical SLOs and product metrics. New lenses, ranking models, or UI changes should be gradual and reversible.

How do you design a global event backbone without making every consumer depend on one giant topic?

Partition the event backbone by domain and key: chat by conversation, stories by publisher/user, engagement by content/user, and abuse signals by account/device. This keeps replay targeted, consumers isolated, and hot partitions manageable.

PRISM
System Design Interview
Round 1 of 4 · Architecture Design · 60:00 remaining
PRISM logo
AI Interview
Interview Prep
Interview Challenges
Design Your Own System NEW
System Architectures
Interactive Roadmap System Design Guides
Notifications
  • No new notifications
Feedback
Signed in
Phase
Design Your Own System
Phase 01: Thinking in Systems
Upcoming

Components

User
CDN
Load Balancer
Server
Cache
Database
Blob Storage
Search Index
Queue
Worker
Rate Limiter
Service
API Gateway
Reverse Proxy
WebSocket Server
Third-party API

Inspector

Notes
Use clear names so your design intent is easy to understand.
Good
Name by business meaning
"Order API", "Restaurant Service"
Avoid
Generic names = zero signal
"Server 1", "API", "Queue"
A short description for each component makes feedback much better.
100%
Start by identifying:
  • Users & entry points
  • APIs & services
  • Databases & storage
  • Traffic flow & scale

Round 1 of 4 Architecture Design

Run a simulation to see results.

Time Remaining
60:00
System Design Interview

What are the core functional requirements?
What are the key non-functional constraints?

Questions

Start Evaluation to unlock questions.

Components Added
No components listed
Click "+ Add" to document components introduced in this stage.
Design Decisions

Click Simulate to run your design and see results here.

Internal notes — not shown to learners.

EVALUATE MODE

Test yourself like it's the real thing.

A structured 4-module evaluation that mirrors how top companies assess system design candidates.

Architecture Design
Draw your system on the canvas. Define components, connections, and data flow.
FR & NFR Requirements
Answer functional and non-functional requirement questions about your design.
MCQ Round
Multiple choice questions testing your depth on the chosen system.
Tradeoff Analysis
Justify your design decisions and defend your architectural tradeoffs.
AI Report Generated
A R S
Used by engineers preparing for FAANG & top-tier companies
Choose a Problem
No problem selected
  • 30 min
  • 45 min
  • 60 min
Round 2 of 4
MCQ Round
Answer multiple-choice questions based on your design.

Exit Interview?

You're in the middle of an interview session. Leaving now will end your current attempt.

Your progress will be saved.

Open a saved design

Select a design to load into the canvas.

My Evaluations

Your past evaluation sessions

Here’s a simple request flow that follows the expected layer order.

External User
→
Edge CDN → API Gateway → Load Balancer
→
Compute App Servers / Services
→
DataAccess Cache
→
Storage Database / Search Index
→
Async Queue → Worker

Tip: keep arrows moving forward through layers (Edge → Compute → Storage). Avoid sending storage back to compute.

Evaluation Instructions

Read the rules carefully before starting. The test auto-submits on refresh.

Before you start

  • Build your architecture on the canvas. The timer starts when you click Start Evaluation.
  • Don't forget to answer Functional Requirement and Non Functional Requirements.
  • When satisfied with your design, click Next to lock it and view the questions.
  • Please answer final step questions to complete the evaluation.

Dos

  • Do read each question carefully before answering.
  • Do include required components to maximize component coverage.
  • Do save a copy of your design if you want to keep it before submission.

Don'ts

  • Don't refresh or close the tab during an active evaluation — this will auto-submit your answers.
  • Don't switch app modes or open another tab while the evaluation is running.
  • Don't attempt to edit the design after clicking Next; the workspace will be locked.

All the best!!

Confirm

Input

Notice

Evaluation Report:

Evaluation Complete

Generating Your Report

Hang tight — our AI is evaluating your design…

Did you know?

Loading…

Share feedback

Tell us what worked well and what we can improve.

Let's personalize this

Answer a couple of quick questions so we can tailor your journey and missions.

You can change this anytime from your Profile.

Your personalized missions are ready

We tailored these first steps based on your answers.

    PRISM Welcome Gift

    This is a personal welcome gift from PRISM.

    Congratulations.

    You explored PRISM.

    You earned Apprentice.

    As a welcome gift, unlock Full PRISM Access for the configured trial duration.

    This starts Trial. Trial timer begins only after you activate this gift.

    Welcome to PRISM

    We've prepared a personalized Apprentice Journey based on your goals and experience.

    This journey introduces you to the capabilities of PRISM that are most relevant to you.

    Complete all 8 missions to earn your Apprentice title. 8 MISSIONS

    PRISM Surprise Offer

    Complete your Apprentice Journey to unlock a special gift from PRISM.

    • No payment required
    • No credit card required
    • Just complete the journey
    MISSION CONTROL
    0 / 8 missions complete
    NEXT UP Continue your missions
    View full roadmap →
    Mission Complete 0 / 8 Completed Next: Keep going
    SYSTEM BRIEF

    ⬤ System Constraints

    What the system must do — every item is a user-facing behaviour your architecture must support.

      ↑ Engineering Constraints

      These are the failure modes you must design against — latency SLAs, durability targets, traffic ceilings.

        ⇆ Architecture Constraints

        ◈ Core Concepts to Master

        Your Journey
        PHASE – –
        0 / 0 0%
        0
        Mock Interview Checklist

        Pick a topic to start

        Explore concept overviews, real-system examples, key tradeoffs, and interview talking points for each roadmap section.

        Topic-Wise Progress
        Experience Points 0 XP
        Read subtopics & solve challenges to earn XP
        Theory Read +0 XP
        Solved +0 XP
        Streak Bonus +0 XP
        Theory Read 0%
        — Mastered — Solved
        Weekly Streak 0 day streak
        Mon
        Tue
        Wed
        Thu
        Fri
        Sat
        Sun
        Keep going — log in daily to build your streak!
        0 0%
        Skill Profile
        Recommended Next
        🎯 Your Focus

        You haven't explored enough yet.

        Focus on
        → Understanding System Design
        → Estimating Scale
        Next Action
        Continue → Next: –
        Mock Interview Checklist
        Architecture DNA
        Engineering Profile
        Phase Mastered

        You've conquered this phase. These are the skills you now own:

          +500 XP

          Engineering Profile

          Company Interview Paths

          Progress Summary