← Back to blog
·10 min read

System Design Cheat Sheet: 20 Mermaid Diagram Templates for Common Questions

Copy-paste Mermaid templates for the 20 most common system-design interview questions — Twitter feed, URL shortener, Uber dispatch, rate limiter, and more.

system designmermaidtemplatescheat sheet

Every system-design interview asks for the same three artifacts: a high-level architecture diagram, a request-path sequence, and a data model. What changes is the problem statement wrapped around them. Below are 20 Mermaid templates for the most common problems — copy the diagram, edit the labels, and you have your starting point.

If you're running Interview Helpers the AI returns Mermaid inline as SVG so you can literally screenshot the diagram to the interviewer's whiteboard. Everything below is the same syntax.

Diagrams 1–10 (with copy-paste Mermaid)

1. Twitter / X feed

Fan-out on write, celebrity fan-out on read, timeline cache.

flowchart LR
  U[User] -->|POST tweet| G[API Gateway]
  G --> T[Tweet Service]
  T --> DB[(Tweet DB)]
  T --> Q[Fan-out Queue]
  Q --> F[Fan-out Worker]
  F --> RC[(Timeline Cache)]
  RC --> R[Read Service]
  R --> U

2. URL shortener (bit.ly)

Base62 encoding, hot-key cache, analytics on write.

flowchart LR
  U[User] --> R[Redirect Service]
  R -->|hot| C[(Cache)]
  R -->|miss| DB[(URL DB)]
  U --> W[Write Service]
  W --> B[Base62 Generator]
  W --> DB
  W --> A[Analytics Queue]

3. YouTube / Netflix

CDN, adaptive bitrate transcoding, metadata service, watch history.

flowchart LR
  U[Viewer] --> CDN[CDN Edge]
  CDN -->|miss| O[Origin]
  U --> M[Metadata Service]
  M --> DB[(Video DB)]
  U --> H[History Service]
  H --> HDB[(History DB)]
  UP[Uploader] --> T[Transcode Pipeline]
  T --> S[(Object Store)]
  S --> O

4. WhatsApp / Slack messaging

Presence, WebSocket long-lived, message queue, receipt fan-out.

flowchart LR
  A[User A] -->|WS| G[Gateway]
  G --> M[Message Service]
  M --> Q[Message Queue]
  Q --> D[Delivery Worker]
  D -->|WS| B[User B]
  M --> DB[(Message Store)]
  A --> P[Presence Service]
  B --> P

5. Uber / Lyft dispatch

Geo-index, matching engine, ETA service, event log.

flowchart LR
  R[Rider] --> G[API]
  G --> DS[Dispatch Service]
  DS --> GEO[(Geo Index)]
  DS --> M[Matching Engine]
  M -->|assign| D[Driver App]
  D --> GEO
  DS --> E[ETA Service]
  E --> R

6. Rate limiter (distributed)

Token bucket, Redis atomic increment, sliding window.

flowchart LR
  U[Client] --> G[API Gateway]
  G --> L[Rate Limiter]
  L -->|INCR key| R[(Redis)]
  L -->|allow| S[Service]
  L -->|deny| U

7. Distributed cache

Consistent hashing, replicas, TTL, cache-aside.

flowchart LR
  U[Client] --> CH[Consistent Hash]
  CH --> N1[(Node A)]
  CH --> N2[(Node B)]
  CH --> N3[(Node C)]
  N1 <-.replica.-> N2
  U -->|miss| DB[(Primary DB)]

8. Search autocomplete

Trie in memory, ranked suggestions, Kafka log for updates.

flowchart LR
  U[User] --> AC[Autocomplete Service]
  AC --> T[(Trie In-Memory)]
  AC --> RK[(Ranking Store)]
  UP[Upstream Signals] --> K[Kafka]
  K --> W[Update Worker]
  W --> T
  W --> RK

9. Notification service

Fan-out, per-channel workers, retry with backoff, dedupe.

flowchart LR
  S[Producer] --> G[Notify API]
  G --> Q[Notification Queue]
  Q --> D[Dispatcher]
  D --> PN[Push Worker]
  D --> EM[Email Worker]
  D --> SM[SMS Worker]
  PN --> DDB[(Dedupe Store)]

10. Payment processor

Idempotency key, ledger, webhook to acquirer, retries.

flowchart LR
  M[Merchant] --> G[Payment API]
  G -->|idempotency-key| IDEM[(Idempotency Store)]
  G --> L[Ledger]
  G --> A[Acquirer Adapter]
  A --> B[Bank Network]
  A --> W[Webhook Delivery]
  W --> M

Diagrams 11–20 (concept notes)

These follow the same pattern — feel free to sketch them out in Mermaid the same way.

11. Stock trading engine

Order book in memory, matching engine, sequenced FIFO input, deterministic replay from journal.

12. Distributed logging

Kafka ingestion, hot storage (Elastic), cold storage (S3 + Parquet), query gateway.

13. Ad-serving platform

Bidder pool, real-time auction (~100 ms budget), targeting service, impression logger.

14. E-commerce checkout

Cart service, inventory reserve, payment orchestrator, order saga, event outbox.

15. Recommendation feed

Candidate generation (embeddings), ranker service, personalization store, click feedback loop.

16. Live streaming (Twitch)

RTMP ingest, transcode ladder, HLS/DASH manifest, edge CDN, real-time chat over WebSocket.

17. File storage (Dropbox)

Block-level dedupe, metadata DB, versioned object store, delta sync client.

18. Distributed cron / scheduler

Leader-elected planner, sharded worker pool, at-least-once execution, dead-letter queue.

19. Distributed lock / semaphore

Redis Redlock, TTL fencing tokens, retry with jitter.

20. Feature flag system

Central config store, edge cache with pull-then-push, per-user targeting rules, kill switches.

The 4-diagram interview structure

  1. Flowchart — the components and edges. Do this first.
  2. Sequence diagram — the read path and the write path. Talk through eventual consistency here.
  3. ER model — tables and relationships. Discuss sharding key.
  4. Capacity envelope — QPS, storage per year, hot key risk. One paragraph is enough.

The interviewer's grade sheet has one row per artifact. Get all four out in the first 20 minutes and you're passing before you start optimizing.

Ready to have the AI render these directly in the overlay? Grab Interview Helpers and flip on System Design mode. Also see the deeper walkthrough at /for-system-design.

Try Interview Helpers free

The AI interview copilot built for tech rounds. 10 free messages, no credit card.