Cache and rate limits
A fixed-window rate limiter and cache on Redis, or in process memory.
Choose with --cache redis (default) or --cache memory. On a React + Vite frontend with an API, the Hono and FastAPI APIs implement both options: see A frontend and its API.
Redis is optional. Set REDIS_URL to a TCP connection URL:
REDIS_URL=rediss://default:<password>@<host>:6379Use rediss:// for TLS connections such as Upstash and redis:// for an unencrypted connection on a trusted network. The app uses the standard Redis protocol and requires a Node.js runtime with outbound TCP access.
Without REDIS_URL, the rate limiter and cache use process memory. Memory limits apply per server process, so configure Redis when you run several instances or serverless functions. Never commit a real Redis URL or password.
Rate limits count each client by its address. From Starter v0.27.0, CLIENT_IP_HEADER or TRUSTED_PROXY_HOPS tells the server where to find it for your host; pnpm clubedge deploy sets the one for its platform. See Client addresses. Before, client addresses came from x-forwarded-for, so deploy behind a proxy that sets it.
A frontend and its API
With the Hono API (Starter v0.25.0 or newer) and the FastAPI API (Starter v0.26.0 or newer), the rate limits and cache are the API's, so REDIS_URL belongs in apps/api/.env.local and on the API's service. A limit answers 429 with Retry-After. When Redis is unreachable, requests go through and the failure is reported. FastAPI uses the same key prefixes as the TypeScript apps, so both can share a Redis database.
How is this guide?