I am working on a SaaS product that I intend to have multiple plans for, I will have a limit of 50 of item A example and then a per user cust where I will have a base plan of 3 users.

I'm building this application primarily out of Node.js microservices. I was wondering where it makes sense to put in the controls for this type of limiting (the 50 items A not the per-user that seems simple enough).

Do I put it as its own service or is there a reasonable way to integrate it into say an API gateway or auth service?

Currently, the services I have that would be involved in item A are:

  • API gateway

  • Auth

  • Service A

I'd like to do it in a way that I could remove the limiting per item later on as I have plans to change my pricing plan structure as the product develops.

I'm open to almost anything, I have a few poorly thought out ideas like adding a middleware that checks the user model and if the user's company/payment/plan data says that it exceeds the limit then I would return an error.

  • Rate limiting of this kind is a business rule. Design accordingly. – Robert Harvey Jun 28 at 14:32
  • @RobertHarvey I get it is a business related thing but there has to be a technical implementation of some kind in my code. I know what the business plans are I need to figure out the technical/code solution for how to implement it all, hence the question on a software engineering forum. – joshk132 Jun 28 at 15:22
  • How do you do validation? Same thing. – Robert Harvey Jun 28 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.