DEV Community

Azizul Haque Ananto
Azizul Haque Ananto

Posted on

Cap-em: Another rate limiter? 😅 Limit access to resources in any configuration

The main concept is to track the usage of your resources, and lmit access to them.

Say you have a resource email you want to limit your users to change the email twice per day. Then you come up with some stats and want to limit users to change it once per hour and 5 times in a month. May be you can come up with more crazy configs.

Cap-em can do these out of the box. This can be deployed as a microservice and it will track and let you know the status with two very simple API's - /limit/check and /add/usage. All you need to do is make the above configuration like this - email,3600:1,86400:2,2592000:5. Put it in the config.txt file and follow the steps here to run the microservice.

You have to use a relational DB for the service to track.

Please visit the project here -

Discussion (0)