SAAS-oriented Raills app architecture
1
Not solved Solved
11 months ago

Hi all :)

I'm building a SAAS platform dedicated to TV production companies. I'm struggling to figure out how to architect the app, since companies have users, and companies must be created prior to users. An admin user can then invite other members of his company to join the app. Has any of you build a SAAS app (it's pretty much like Slack way of working) and have so resources he can share? I've read about multi-tenancy app but I'm not sure it's the right way to go

11 months ago

A nested form that creates both a company and the first admin user might be an option. In terms of architecture you should have a look at form object that help you keep your controller skinny and are easily unit testable. That's probably not the best or the only solution, but according to your requirement it should work ;)

11 months ago

We had the same problem on our Le Wagon project.

In terms of models/tables, you have two options.

  • 2 models: Company and User. Users belong to Companies (like Slack).
  • 3 models: Company, User and Membership (join table). This looks cleaner because users don’t have to create a new account (new name, password…) every time they join a new company. But you might want user accounts to be defined within the strict context of a company.

In terms of the user experience, you’ll have to carefully design multiple on-boarding scenarios: company creation, request to join company, invitation to join company… This is really the tedious part. Unfortunately, I haven't found a definitive guide/article about this. I agree it's something that would help enterprise SaaS developers a lot! Opportunity in disguise?

You’ll have to customize the Devise Registrations controller and/or redirects for the scenarios that include creating users and other records at the same time or in sequence. This gist can help.

11 months ago

Thanks for your answers guys :) I bumped into nested forms as well, which take part of the problem I had away, regarding the app structure, I think I'm going to go for a simple rails app for start, and not go for multi tenancy architecture.

Cancel
Submit your answer