# Saas design considerations

**URL:** <https://www.ruby-forum.com/t/saas-design-considerations/148737>\
**Category:** Rails\
**Created:** [September 16, 2008, 6:50pm UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737 "2008-09-16T18:50:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 16, 2008, 6:50pm UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/1 "2008-09-16T18:50:09Z")

</div>

Anybody here working in the saas application using ROR? I have few  
questions for you.

1. How do you manage the scalability? Do you use multi database  
connection or database clustering. Which one is best?
2. What application server you are using? How many mongrels in the  
backend?
3. How to make the configurable application. For example, workflow  
configuration differs for the tenants. How can we configure the workflow  
for the tenant?
4. How the security is implemented? I mean, how the subscription model  
is implemented? How ca we protect the datas of one tenant from other  
tenant?
5. How can we monitor the performance?

Any other suggestion in desigining the saas application?

Regards,  
John

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 16, 2008, 8:19pm UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/2 "2008-09-16T20:19:08Z")

</div>

This is, of course, shameless self promotion, but the SaaS Rails Kit  
that I  
created could definitely point you in the right direction with some  
working  
code: [SaaS Accounting Software](http://railskits.com/saas/) (n.b., it’s not free).

To generally answer your questions, though, it’s not that different from  
your typical Rails app. You can use a single database with appropriate  
query scoping to restrict tenants to only seeing their data.

–  
Benjamin C.  
[http://railskits.com/](http://railskits.com/) - Ready-made Rails code  
[http://catchthebest.com/](http://catchthebest.com/) - Team-powered recruiting  
[http://www.bencurtis.com/](http://www.bencurtis.com/) - Personal blog

On Tue, Sep 16, 2008 at 9:50 AM, John John  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 26, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/3 "2008-09-26T23:01:34Z")

</div>

Benjamin,

Not only do I think that what you are doing is indeed “shameless self  
promotion”, but I think that you are seriously misunderstanding the  
concept of SaaS and promoting bad information about RoR and SaaS on the  
web.

Did you read through the points John asked about above?

He is asking about:  
-Scalability  
-Multi-tenant database design  
-Configurability  
-Security

These points are expressed in more detail in the article at

> **[Microsoft Learn: Build skills that open doors in your career](https://learn.microsoft.com/en-us/)**
>
> Gain technical skills through documentation and training, earn certifications and connect with the community

but unfortunately there is little RoR specific information about them on  
the web.

From what you write on your website, the only thing you are providing is  
a billing system. Labeling that as “SaaS” is misleading in the extreme.

Victor

Benjamin C. wrote:

> This is, of course, shameless self promotion, but the SaaS Rails Kit  
> that I  
> created could definitely point you in the right direction with some  
> working  
> code: [SaaS Accounting Software](http://railskits.com/saas/) (n.b., it’s not free).
> 
> To generally answer your questions, though, it’s not that different from  
> your typical Rails app. You can use a single database with appropriate  
> query scoping to restrict tenants to only seeing their data.
> 
> –  
> Benjamin C.  
> [http://railskits.com/](http://railskits.com/) - Ready-made Rails code  
> [http://catchthebest.com/](http://catchthebest.com/) - Team-powered recruiting  
> [http://www.bencurtis.com/](http://www.bencurtis.com/) - Personal blog
> 
> On Tue, Sep 16, 2008 at 9:50 AM, John John  
> \<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 29, 2008, 6:41am UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/4 "2008-09-29T06:41:49Z")

</div>

I’m sorry if I misunderstood the purpose of your plugins then. I’ve come  
across your site several times before through Google searches (on RoR  
and SaaS) and from the descriptions, the focus seemed really on the  
billing aspect.

That being said, I don’t buy the “common sense” argument when designing  
SaaS with RoR – I do think there’s more than that when we move to more  
serious applications, with many users, especially (though not only) in  
an enterprise setting.

For small apps, true, common sense says things can be nice and easy. But  
go to thousands of users, hundreds of tables and simultaneous requests  
and you got a different set of needs.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 27, 2008, 4:00pm UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/5 "2008-09-27T16:00:26Z")

</div>

Yes, I did read through his points. Did you read my response, basically  
saying that a SaaS application is not much different from any other  
typical  
Rails application? Indeed, that is true, as I’ve experienced time and  
time  
again in building and deploying my own SaaS applications, and in seeing  
others deploy theirs.

The one point that he did ask about that is specific to SaaS  
applications is  
the database design behind multi-tenant applications, and this is the  
point  
that I chose to address. Again, it is true, that it is a simple matter  
of  
using Rails’ association scoping to achieve the desired result of having  
all  
customer data in one database but easily restricting the queries so as  
not  
to allow one customer to view another customer’s data. Futher, I  
mention  
the SaaS Rails Kit because it is relevant to the question. This product  
demonstrates rather clearly how to use Rails’ association scoping to  
achieve  
that outcome. While the SaaS Rails Kit does provide a billing system,  
it is  
not just a billing system, but an example of framework of how to build  
the  
type of application that was the subject of the original author’s  
inquiry.

–  
Benjamin C.  
[http://railskits.com/](http://railskits.com/) - Ready-made Rails code  
[http://catchthebest.com/](http://catchthebest.com/) - Team-powered recruiting  
[http://www.bencurtis.com/](http://www.bencurtis.com/) - Personal blog

On Fri, Sep 26, 2008 at 2:01 PM, Victor Al  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 29, 2008, 9:37am UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/6 "2008-09-29T09:37:29Z")

</div>

On 29 Sep 2008, at 05:41, Victor Al [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> SaaS with RoR – I do think there’s more than that when we move to  
> more  
> serious applications, with many users, especially (though not only) in  
> an enterprise setting.

My 2 cents is that SaaS is a buzzword. It’s not actually anything new  
as far as web apps are concerned (eg hotmail was SaaS 10 years ago).  
There aren’t much in the way of new problems.

Fred

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [October 21, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/7 "2008-10-21T12:15:47Z")

</div>

Thanks saljamil. Plz let me know your messenger id. We will have the  
detail discussion on this. My messenger id is removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 29, 2008, 8:46pm UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/8 "2008-09-29T20:46:31Z")

</div>

I used an organization\_id in most of the models to stripe data. I use  
a better\_nested\_set to have a hierarchy of organizations. If the user  
is assigned to an organization, they can do CRUD on that organization  
and its children. I used named scopes in the model to pass the user\_id  
from controller and get back data specific to that user (his org and  
children orgs). Send me an email if you need some code examples.  
In terms of scalability, I am thinking at some stage I will figure out  
a trigger point to have another saas instance once we get close to  
that threshold.

On Sep 29, 2:36 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [March 23, 2010, 10:13am UTC](https://www.ruby-forum.com/t/saas-design-considerations/148737/9 "2010-03-23T10:13:39Z")

</div>

hi saljamil

> and its children. I used named scopes in the model to pass the user\_id  
> from controller and get back data specific to that user (his org and  
> children orgs). Send me an email if you need some code examples.

```
   I would like to get some code examples. Please send your mailid. 

```

My id is to.tom.mak at [gmail.com](http://gmail.com)

Thanks  
Tom
