Live data from Hacker News

Ask HN: How come there is no example code for B2B-SaaS apps?

news.ycombinator.com

41–50 of 94 posts

Re: Ask HN: How come there is no example code for B2B-SaaS apps?

#41
post #11

I've been working on something like this for Ruby on Rails in case anyone is interested. It has multitenancy, billing separate for each tenant, automatic query filtering for the current tenant, etc. https://jumpstartrails.com

I 2nd https://jumpstartrails.com . I purchased the "Unlimited Site License", and it is well worth it.

I wish there was something like this ready in Noode.js world (happy to pay)

Re: Ask HN: How come there is no example code for B2B-SaaS apps?

#42

http://abp.io/ is probably the best open source one I've seen. They also offer a paid product which is fairly comprehensive. I don't quite like their frontend stuff but the backend side of things is definitely what you're looking for. There are plenty of paid products in every language which are basically B2B SaaS templates. ABP, bullettrain, Laravel etc.

looks great, I wish there was something like this in the Node.js world

Re: Ask HN: How come there is no example code for B2B-SaaS apps?

#45

In my experience, a lot of projects start off with shared tenancy (using a tenant id discriminator in the database) and eventually migrate to completely separate schema for each tenant (i.e. a separate “installation” of a single-tenancy app for each tenant) to avoid security and architectural pitfalls. Once you’ve done that, you don’t have to worry about forgetting a `WHERE tenantId = foo` somewhere and leaking data.…

The approach I've used and seen the most often is enforcing the tenancy at the ORM level so someone can't forget a where.

And then providing enterprise service for large companies that want their own installation.

Re: Ask HN: How come there is no example code for B2B-SaaS apps?

#46

In my experience, a lot of projects start off with shared tenancy (using a tenant id discriminator in the database) and eventually migrate to completely separate schema for each tenant (i.e. a separate “installation” of a single-tenancy app for each tenant) to avoid security and architectural pitfalls. Once you’ve done that, you don’t have to worry about forgetting a `WHERE tenantId = foo` somewhere and leaking data.…

On the enterprise software I worked on (IWMS system) we did both. Customers got their own schema, but big customers would give each branch their own virtual tenant within that schema. We started out with only the multiple schemas approach and ended up retrofitting a bunch of multitenancy features.

Re: Ask HN: How come there is no example code for B2B-SaaS apps?

#47
post #35

In my experience, a lot of projects start off with shared tenancy (using a tenant id discriminator in the database) and eventually migrate to completely separate schema for each tenant (i.e. a separate “installation” of a single-tenancy app for each tenant) to avoid security and architectural pitfalls. Once you’ve done that, you don’t have to worry about forgetting a `WHERE tenantId = foo` somewhere and leaking data.…

WHERE tenantId = foo You only need to do that if you keep multiple tennants in one table. But who does this? Usually in a multi tennant application you have only one line which connects to the tennants DB and thats it. The rest of the code does not have to think about tennants.

> But who does this

Everyone below a certain scale. Or when it just makes more sense, like Proboards' free tier.

Re: Ask HN: How come there is no example code for B2B-SaaS apps?

#48
post #11

I've been working on something like this for Ruby on Rails in case anyone is interested. It has multitenancy, billing separate for each tenant, automatic query filtering for the current tenant, etc. https://jumpstartrails.com

For the unfamiliar, OP makes awesome Rails tutorial videos and is really knowledgeable on the subject.

Re: Ask HN: How come there is no example code for B2B-SaaS apps?

#49
There's little sample code because some parts of the problem are disproportionately harder than others.

For example, in saas, if you have a serious product then you'll soon find that some of your tenants want to use SSO. So you need not only the stuff you mentioned already but also admin screens for setting up e.g saml for individual tenants. Add that to your points and you don't need sample code, you need a whole product (we use keycloak, there are plenty of other options).

As to billing, that's a whole gigantic separate area and again something where you don't want sample code, you want a complete product (I have heard jbilling talked of favorably).

In short, the problem space is too big to be addressed with some sample code.

Post reply on HN