rohitdasu / projectmate

Supercharge your open-source contributions with projectmate.net; Discover open-source projects, connect with experienced maintainers, and collaborate with a community of passionate contributors. Join over 200+ registered users who are already making a difference
https://projectmate.net
MIT License
148 stars 107 forks source link

[FEATURE] Add Rate Limiting to APIs for Database-Backed Endpoints #417

Open rohitdasu opened 10 months ago

rohitdasu commented 10 months ago

Description

This issue aims to enhance the performance and security of our APIs by implementing rate limiting for endpoints that involve database operations. Rate limiting is crucial to prevent abuse, ensure fair usage, and protect our infrastructure from potential threats.

Let us discuss first which service is best for implementing rate limiting!

rohitdasu commented 10 months ago

Upstash is one of the good option here.

https://upstash.com/blog/nextjs-ratelimiting

manzil-infinity180 commented 10 months ago

Upstash is one of the good option here.

https://upstash.com/blog/nextjs-ratelimiting

is this issue or security feature resolve with npm package express-rate-limit???

const limiter = rateLimit({ max:100, windowMs: 60601000, message : 'Too many reqests from this IP,please try again in an hour' });

kairblarson commented 10 months ago

@manzil-infinity180 express-rate-limit limits all traffic but it seems like the Upstash limiter only limits endpoints that interact with redis

rohitdasu commented 10 months ago

@kairblarson it make sense

kairblarson commented 9 months ago

Ive been looking into it more and it seems like the upstash rate limiter leverages a redis cache so its not feasable unless we add redis. I then tried to use the express-rate-limit package but I dont think it works with nextjs however I did find a more traditional work around in this article here: https://kittygiraudel.com/2022/05/16/rate-limit-nextjs-api-routes/

I tried to implement it myself but could not figure out the exact typing

madjed-hue commented 9 months ago

hello @kairblarson, You can check the lru-cache package, Here is an example: https://nextjs-rate-limit.vercel.app/

kairblarson commented 9 months ago

@madjed-hue this looks promising, ill look into it thank you!

MrBlackGhostt commented 6 months ago

Hi @rohitdasu if the issue is not solve i want to contribute it

rohitdasu commented 6 months ago

Hi @rohitdasu if the issue is not solve i want to contribute it

Sure

MrBlackGhostt commented 6 months ago

@rohitdasu i don't see is this assign it to me

MrBlackGhostt commented 6 months ago

@rohitdasu can you assign this to me so I can work

rohitdasu commented 6 months ago

Assigned you @MrBlackGhostt

parasvekariya26 commented 5 months ago

Plz Assign issue me?

rohitdasu commented 5 months ago

Plz Assign issue me?

assigned you. let us know if you need anything :)

rohitdasu commented 3 months ago

@parasvekariya26 are you still working on this? please let us know