Setup Upstash
- Sign up on Upstash
- Create a new Redis Database.
- Add the
UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKENinto your.env.localfile.
Rate limiting an API Route
TurboStack have an util function calledratelimit, resided at apps/web/lib/upstash/ratelimit.ts.