Web application architecture (subdomain vs. sub directory)
I'm in the customer discovery phase for a Health IT web application concept I have. My programmer is new to web apps, but not to programming and is set up with LAM(PHP). Maybe we're a little old school, but it's proven. We're still debating weather to use a framework or to go with Rasmus's "no framework framework" approach.
Language/Framework decisions aside... my main question is about subdomain (customerx.appname.com vs subdirectory (appname.com/customerx/) models for instances of individual customers' accounts.
It seems most people are opting for the former, but I see flickr use the latter. The guys at Particletree (i.e., Wufoo) wrote a blog post about it (http://particletree.com/notebook/subdomains-development-sucks/) years ago to which they still attest.
They say the subdirectory model is much easier and faster to develop and deploy. We are developing locally on our macs and using hosted CVS.
I'm really lost on this issue as all my searches turn up stuff on SEO/SEM. Is one approach easier that the other? What about security and scalability considerations? I would very much appreciate your opinions as to the pros and cons of each approach.
As an aside, does anyone have some advice about rapid PHP deployment, i.e., pushing new features to production daily in micro iterations vs the typical milestone approach? Are there any good tools for this? What about hosts?
Thanks all,
Tim
17 comments
[ 2.7 ms ] story [ 44.0 ms ] threada) point a single account's DNS to an entire server (or cluster) without forcing all traffic to a specific machine or proxy
b) offering custom domain names to customers is simply a matter of adding a DNS alias
c) don't have customer URLs "polluting" your app's URL namespace
At least IMHO, could be wrong though. :)
edit: abcs
* URI components have a wider scope of acceptable characters than domains, plus uri escaping e.g. spaces with a %20
* subdomains can be traffic shaped / cluster managed using IP addresses (until you run out if IPs)
* URI components can be traffic shaped using internal IPs via your web server
* In my experience it's easier to mod-rewrite and pass $1 than a DNS and parse a hostname
I remember lots of people going with subdomains that have since switched to URI components, particularly http://news.bbc.co.uk/ now goes to http://www.bbc.co.uk/news/ I would say that it is easier to categorize as one drills down. It is a shame that domains ended up backwards or else it would make more sense - http://uk.co.bbc/news
So my personal preference is for URI components
Very good point. Went with DigiCert for a wildcard a few years ago and it was in the $400-range compared to ~$100 for a standard cert.
Are you saying it's more work for a localized app (coolapp.com/customer1/) to interact with services.coolapp.com than with coolapp.com/customer1/services. And does the latter imply that there would be massive redundancy or can one go about routing queries to avoid that?
You've certainly taught me a thing or two. I never knew Javascript had such limitations across (sub) domains. There's an old article on it here: http://radio.javaranch.com/pascarello/2005/12/30/11359624608...
http://john.doe.example.com/
http://john.doe.example.net/
http://example.net/john.doe/
Here in the UK we also have the .co.uk as a possibility too.
Is there an argument to be made in favor of either approach as regards security?
I was thinking of a URI component structure that would use each customer's office address/credentials (gathered at sign up) e.g., coolapp.com/john/doe/MD/Newton/MA/02158/