High-value capability

Rate Limiting

Protect your API from abuse and ensure fair usage with request rate controls.

1-2 daysTypical timeline
$200 - $800Typical range
4Approaches compared

SCOPE DECISION

Does this belong
in the first release?

A capability is only essential when the product promise depends on it. Use these signals to keep the decision tied to user value.

INCLUDE WHEN

The product needs it now

  • 01
    Public-facing API
  • 02
    User authentication endpoints
  • 03
    Expensive operations (AI, email)
  • 04
    Resource usage limits needed
LEAVE OUT WHEN

The release works without it

  • 01
    Internal tools only
  • 02
    Very early MVP with trusted users

IMPLEMENTATION OPTIONS

Choose the approach
that fits the product.

The right technology depends on ownership, scale, integration depth, and how much operational responsibility the team wants to carry.

Upstash Rate LimitServerless Redis-based rate limiting

Strengths
  • Easy setup
  • Serverless
  • Good free tier
Tradeoffs
  • Vendor dependency
  • Costs at scale

express-rate-limitSimple rate limiting middleware

Strengths
  • Simple
  • No external deps
  • Customizable
Tradeoffs
  • Single server only
  • Memory-based

Redis + CustomBuild rate limiting with Redis

Strengths
  • Full control
  • Distributed
  • Flexible algorithms
Tradeoffs
  • More code
  • Requires Redis

CloudflareEdge-based rate limiting

Strengths
  • No code changes
  • Global
  • DDoS protection
Tradeoffs
  • Less granular
  • Cloudflare dependency

DELIVERY SEQUENCE

A practical path
through the work.

  • 01Identify endpoints needing rate limits
  • 02Define rate limit rules (requests per window)
  • 03Choose rate limiting algorithm (sliding window, token bucket)
  • 04Implement rate limiting middleware
  • 05Add rate limit headers to responses
  • 06Handle rate limit exceeded gracefully
  • 07Set up monitoring and alerting
  • 08Document limits for API consumers

WATCH FOR

Common implementation mistakes.

  • 01
    No rate limiting on auth endpoints (brute force risk)
  • 02
    Same limits for all endpoints
  • 03
    Not communicating limits via headers
  • 04
    Rate limiting by IP only (shared IPs)
  • 05
    Too strict limits frustrating users
  • 06
    Not exempting internal services

QUESTIONS

Before you commit the scope.

What rate limits should I set?+

Start generous: 100 req/min for general API, 5-10/min for auth, lower for expensive operations. Monitor and adjust based on actual usage.

How do I rate limit authenticated vs. anonymous users?+

Different limits by user tier. Anonymous: strict IP-based. Authenticated: per-user, more generous. Premium: even higher or unlimited.

Sliding window vs. fixed window?+

Sliding window is fairer but more complex. Fixed window is simpler but allows bursts at window boundaries. Most MVPs are fine with fixed.

RELATED DECISIONS

Continue mapping the release.

DISCUSS YOUR APP

Turn this decision
into working software.

Bring the product context and current scope. We will choose the approach after the release is clear.

Discuss your app