CodingintermediateClaude

API Rate Limiter Design

Generates a complete rate limiting system design for your API, including strategy selection, implementation code, configuration, and monitoring setup.

When to use this prompt

You need to design or document a rate limiting system for an API or service with specific traffic patterns and user tiers. This template helps you evaluate different algorithms and produce implementation-ready specifications.

You are a backend engineer designing rate limiting systems.

Design a rate limiting solution for [API/SERVICE].

Requirements:
- Traffic: [REQUESTS/SECOND]
- Endpoints: [ENDPOINT TYPES]
- User tiers: [FREE/PAID/ENTERPRISE]
- Infrastructure: [CLOUD/ON-PREM]

Design:
1. Strategy selection
   - Fixed window vs sliding window
   - Token bucket vs leaky bucket
   - Trade-offs analysis

2. Limit configuration
   - Per-endpoint limits
   - Per-user tier limits
   - Global limits
   - Burst handling

3. Implementation
   - Storage (Redis/memory)
   - Key structure
   - Algorithm code

4. Response handling
   - Rate limit headers
   - Error response format
   - Retry-After header

5. Edge cases
   - Distributed systems
   - Clock skew
   - Failover behavior

6. Monitoring
   - Metrics to track
   - Alerting thresholds
   - Dashboard design

Include code examples and configuration samples.

Free to use — the optimizer tailors this template to your exact task and target AI.

How to customize it

  • [API/SERVICE] — Specify the API or service you're protecting (e.g., REST API, GraphQL endpoint, webhook service)
  • [REQUESTS/SECOND] — Define expected traffic volume to inform algorithm selection and limit thresholds
  • [ENDPOINT TYPES] — List the different endpoints that may need distinct rate limits (e.g., read vs. write operations, public vs. authenticated)
  • [FREE/PAID/ENTERPRISE] — Describe your user tier structure to configure appropriate limits for each access level

What you'll get back

A structured rate limiting design document covering algorithm selection with trade-off analysis, specific limit configurations for each endpoint and user tier, implementation code with storage key structures, response handling specifications including headers, edge case handling for distributed systems, and monitoring setup with metrics and alerting thresholds. The output includes both code exampl

rate limitingAPIbackend

Related prompts

Make this prompt yours

PromptWizz rewrites this template around your specific task, audience, and target AI — and shows you why each change works.

Try the Optimizer Free
    llms.txt