

Ask HN: Help me with the architecture of my SAAS web application. - anujkk

I'm about to begin the development of my first ever SAAS web application. I already have 20+ customers of a niche business segment willing to pay for it. Our application will let customers create &#38; manage their business websites through our service either through subdomain or their own domain. e.g., customersite.oursite.com<p>I am comfortable with both python and php. I have developed web apps before but have never dealt with SAAS. What are the things I need to watch out for? Any known pitfalls? I also have some questions regarding architecture of SAAS apps -<p>1) Should I put all customer's data in single database or should I use one separate database per customer?<p>2) I want customers(and 3rd party developers) to be able to develop their own themes much like Wordpress. How should I architect my app to do that?<p>3) Should I go with Python/Flask or Python/Django or PHP/&#60;Some framework&#62;? I'm comfortable with all three but I don't know which one is better for SAAS app.<p>Any advice, books, articles, resourced will be nice.
======
sdrinf
> Should I put all customer's data in single database or should I use one
> separate database per customer?

Do a financial forecasting: given your pricing, how many people do you need to
subscribe to break even? Can you enlist enough people for the same vision to
be able to maintain your business from SAAS alone?

If yes, keep the whole thing in a single database (reduces maintenance); if
the number seems daunting, you might want to consider also selling
customization via consulting.

For providing customization, it's generally a good idea to have each client's
database seperated from the other, so that individual changes impact only a
single client.

> 2) I want customers(and 3rd party developers) to be able to develop their
> own themes much like Wordpress. How should I architect my app to do that?

One way how you might achieve that is keeping the code - design HTML strictly
separated. At the simplest level, you can do string substitution (eg:
<%content%> in the design HTML gets filled up with the content from the
database); a templating engine might be useful for complex cases.

> 3) Should I go with Python/Flask or Python/Django or PHP/<Some framework>?
> I'm comfortable with all three but I don't know which one is better for SAAS
> app.

Go with the combo you have the most understanding of. You will invariably come
across edge cases, that aren't covered by these, so you will need to know how
you can drop into the framework, and fit it to your needs.

------
luckystrike
I built my SaaS application using Rails & decided to have a separate
PostgreSQL schema for each customer's data. It seemed a neater option to me
rather than putting account_id kind of field in all of the tables. Also,
having a full fledged database for each customer was an overkill for my
application.

You can refer these resources:

Architecture Strategies for Catching the Long Tail -
<http://msdn.microsoft.com/en-us/library/aa479069.aspx>

Multi-Tenant Data Architecture - <http://msdn.microsoft.com/en-
us/library/aa479086.aspx>

p.s. I am also based near Delhi. Feel free to connect with me if you would
like to discuss anything in detail.

------
davyjones
OK. I am developing something similar and here is what I do:

1\. For db, it really depends on the level of security and you app
architecture. I am planning on different dbs for each paying customer.

2\. Use a template engine like Jinja(Python) or Mustache(support for a slew of
languages).

3\. Python/Flask is good. I looked at both Flask and Bottle but I decided to
go with something else that fits my needs. If you want PHP frameworks, there
is FuelPHP, Kohana, CodeIgniter, etc.

~~~
anujkk
Which framework you have decided to go with and why?

~~~
davyjones
luajit within nginx. I use many third party modules and decided to go along
with it.

------
dilithiumH3
Biggest suggestion anyone can give you: Don't prematurely optimize. Period.
Python/Django is a good starting point given the good community support. Start
with a standard project structure, so that asking technical questions can be
answered by anyone out there.

------
smartwater
Your questions make me think you should start with a much smaller project.

