Search code examples
ruby-on-railsrubysaas

Ruby on rails SaaS application where to begin, what tools to use


I'm at the point in my application where I would like to integrate a saas solution into my application using ruby on rails. So far everything has been good except I am unsure where to begin.

My Idea:

I would create a subscription.rb and plan.rb model. A user would belong to subscription and subscription would have many users. Next subscriptions would have many plans and plans would belong to subscription. I would then add role for each plan to limit a user from certain parts of the application maybe using cancan. After setting everything up I would integrate stripe into my application to handle the payment side of things.

The above is how I am thinking of setting this up. It may truly be the wrong concept but that is why I wrote it so you could get an understanding of what I am thinking. I know I could use third party services like recurly, chargify, etc but I am opening my eyes to see if this can be done using a similar a approach.

  1. What technologies have you used or prefer to use when creating a saas application?

  2. Is my approach wrong? If so what is a better way to approach this?

  3. Any tips or advice for creating a saas application such as technologies, ruby on rails tools etc.


Solution

  • Take a look at the open source example application for a Rails Membership/Subscription/SaaS Site from the RailsApps project. It comes with a tutorial that explains the implementation in great detail. Here's the libraries it uses:

    • Devise for authentication
    • CanCan for authorization
    • Stripe for recurring billing
    • Twitter Bootstrap for front-end CSS

    Using Stripe for billing makes implementation easy and reduces security risks as Stripe handles all the automated recurring billing.

    The RailsApps example puts CanCan together with Rolify and uses roles that correspond with subscription plans to manage user access. It shows how to simplify the architecture so there's no need for the complexity of a subscription.rb or plan.rb model (though you could refactor that if you wanted to).