CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/System Design Interview Classics

πŸ“ System Design Interview Classics Β· Flowchart

API Rate Limiter (Token Bucket)

How a token bucket rate limiter decides whether to let an API request through, using Redis so all servers share the same counts.

More System Design Interview Classics templates

Drawing diagram…

What this diagram shows

  • Each client key has its own bucket
  • Tokens refill at a steady rate up to a maximum
  • Rejected requests get HTTP 429 with a retry time

Prompt used

Flowchart of a token bucket rate limiter: a request arrives, the client key is identified (API key or IP), the bucket is read from Redis, tokens are refilled based on time passed up to the bucket size, and if at least one token is left one is taken and the request is forwarded; otherwise return HTTP 429 with a Retry-After header.

Mermaid code
flowchart TD
  A[Request arrives] --> B[Identify client by API key or IP]
  B --> C[Read bucket from Redis]
  C --> D[Refill tokens for time passed, up to maximum]
  D --> E{At least 1 token?}
  E -->|Yes| F[Take 1 token and save bucket]
  F --> G[Forward to service]
  E -->|No| H[Return HTTP 429 with Retry-After]
  G --> I[Add rate-limit headers to response]

Related templates

C4 ArchitectureProSystem Design Interview Classics

URL Shortener System Design

The classic interview design for a service like bit.ly: short code generation, fast redirects from a cache, and click analytics processed separately.

SequenceSystem Design Interview Classics

Chat App Message Delivery (WhatsApp-style)

How a one-to-one chat message is delivered in a WhatsApp-style system, with sent, delivered and read ticks, and push notifications when the receiver is offline.

Data FlowSystem Design Interview Classics

Social News Feed (Twitter-style)

How posts reach followers' feeds: fan-out on write for normal users, fan-out on read for celebrities, and a ranked feed built from a cache.

C4 ArchitectureProSystem Design Interview Classics

Ride Matching System (Uber-style)

The core of a ride-hailing app: drivers stream their locations, a geo index finds nearby drivers, and a matching service offers the trip to the best one.

DeploymentProSystem Design Interview Classics

Notification Service Design

A notification system that sends email, SMS and push messages at scale: one API, a queue per channel, user preferences, and retries.

Data FlowSystem Design Interview Classics

Search Autocomplete (Typeahead)

How search suggestions appear as you type: a prefix index built offline from past searches, served from memory, and refreshed regularly.