User RBAC and billing with microservices | Node.js

by Josh Kirby   Last Updated June 07, 2019 23:05 PM

I am working on a SaaS product that utilizes a microservice architecture and I am starting now to think more about my user system and payments. I plan to have 4 levels of plans (free and 3 paid).

My question comes in how do I design a user and payment system that can handle the different plan levels but also different account permissions that can be set by my customers. By that I mean there will be a company admin who then creates accounts for their employees who have roles assigned to them.

Was that since I already have an API gateway that I would do some processing there since as part of the API gateway I get the user's information and I send it along with the request to my backend services.

I have not seen much online for people talking about how to handle this kind of thing. I can only find stuff about passport.js (I'm using Node.js) and mostly just basic setups with no billing nor anything like that.

I was thinking that a separate billing system would make the most sense but then I have to tie the multiple databases together or have another service that runs with access to my user DB.

I am a bit lost on how to do this as I have never designed a system like this before and since it is a personal project, not a work project one, I have no one that I can ask so hoping this is the right stack exchange place.

My payment processor is going to be Stripe since I have worked with them before and quite like their docs and ease of use. So no worries about trying to create the wheel again.

Related Questions

Updated July 11, 2018 16:05 PM

Updated October 09, 2016 09:02 AM

Updated June 28, 2019 15:05 PM

Updated February 01, 2017 14:02 PM