TechNewsHeaven {{source.name}}




How we manage plans & features in our SaaS app
2019-03-24T00:44:22Z - Tim Nolet / Hacker News
How do you deal with what a user can do on their account in a SaaS app? In code:const features = ["CI_CD_TRIGGERS", "SOME_OTHER_FEATURE"]This set of features lives as an array field on each account record a user is linked with. We populate the features field with trial features. const hasSpecificAccess = function (request, reply, next) { if (accessRights.includes(access)) { next(null, true) } else { next(null, false) } } return hasSpecificAccess }Checking features...const hasFeature = function (feature) { const hasSpecificFeature = function (request, reply, next) { // match if the feature is enabled return features && features.includes(feature) ? next(null, true) : next(null, false) } return hasSpecificFeature }Plan based volume limitsChecking plan features is pretty neatly handled by a fairly generic way of asserting if a thing is either "on" or "off".

Your favorite news


Popular news




Recommended news