The main concept is to track the usage of your resources, and lmit access to them.
Say you have a resource
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 -
/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 - https://github.com/Ananto30/cap-em