how do I rate limit on nextjs api routes on app router?
hey, currently using Route Handlers and I'm stuck on adding a rate limiter to my routes. How can I do so?
Routing: Route Handlers | Next.js
Create custom request handlers for a given route using the Web's Request and Response APIs.
5 Replies
Take a look at this:
https://nextjs-rate-limit.vercel.app/
https://github.com/vercel/next.js/tree/canary/examples/api-routes-rate-limit
should work on app router too
GitHub
next.js/examples/api-routes-rate-limit at canary · vercel/next.js
The React Framework. Contribute to vercel/next.js development by creating an account on GitHub.
yeah I tried that but I believe both pages router and app router use different request and response apis
Teo uses Upstash ratelimiter
https://youtu.be/YkOSUVzOAA4?t=5889
Theo - t3․gg
YouTube
T3 Stack Tutorial - FROM 0 TO PROD FOR $0 (Next.js, tRPC, TypeScrip...
I've never worked this hard on a video before. I really hope y'all can benefit from this 🙏
GITHUB REPO https://github.com/t3dotgg/chirp
DEPLOYED APP https://xn--uo8h.t3.gg/
GET A JACKET IF YOU'RE COOL LIKE THAT https://shop.t3.gg/
ALL MY VIDEOS ARE POSTED EARLY ON PATREON https://www.patreon.com/t3dotgg
Everything else (Twitch, Twitter, Discor...
ty, will take a look later!
should still work imo