g14o
PackagesRatelimit@g14o/ratelimit

Deployment

Choose a rate limit store for your hosting environment.

Distributed rate limiting needs a shared store so every instance enforces the same counters. Pick a store that matches where your server runs. Wiring examples live on Setup.

Pick a store

EnvironmentStoreWhy
Local / single processmemoryStorePer-process counters — not shared across replicas
Serverless / edge (Vercel, Lambda, Workers)upstashStoreREST via @upstash/redis — no persistent TCP
Always-on Node (Express, Hono, Fastify, Nest, Docker/K8s)redisStoreTCP via node-redis / ioredis

The legacy redis: { url, token } option is Upstash REST only. Prefer store: upstashStore(...) for new projects.

Cost

Upstash bills per command — a good fit for low or spiky traffic. Self-hosted or always-on Redis is mostly fixed cost and often wins at sustained high load. See Upstash Redis pricing for current plans.

Multi-instance

memoryStore() does not share counters across replicas — fine for single-instance deployments, local dev, and tests. For production with multiple instances, use upstashStore or redisStore. See Setup for configuration.

On this page