Ask HN: Help me with the architecture of my SAAS web application.
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 & manage their business websites through our service either through subdomain or their own domain. e.g., customersite.oursite.com
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 -
1) Should I put all customer's data in single database or should I use one separate database per customer?
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?
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.
Any advice, books, articles, resourced will be nice.
(
7 comments
| 5 points
| on HN
)
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.
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.
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.