What is the most maintainable and efficient way to architect a web application who's purpose is to host and generate websites which can be customized to a certain degree?

There are a lot of these style of applications in the wild that generate all kinds of sites, from sites that host World of Warcraft guilds to other sites that do wedding site hosting. My question is, what is the basic architecture that these sites operate on?

I imagine there are two ways of thinking about this. A central set of code that all sites on the host run against, and it acts differently based on which site was visited. In this manner, when the base code is updated all sites are updated simultaneously.

Or, the code for an individual site exists in a silo, and is simply replicated to a new directory each time a site is created. When an update needs to be applied, the code is pushed out to each site silo.

In my case, I am working in PHP with the CodeIgniter framework, however the answer need not be limited to this case. Which method (if any) creates a more maintainable and efficient architecture to manage this style of web application?

  • sounds like share-point functionality. But for PHP, you may want to look at Joomla templates and modules.
    – Yusubov
    Jul 5, 2012 at 4:30

2 Answers 2


In late 90s, I've worked on a couple of projects like this, and I used two different way to do it. Your defined them yourself pretty well.

First way is having everything dynamic and coming from the database. This is how most CMS are working right now, and I think it's the most effective way if you plan to host everything. I won't describe it here as it is pretty well defined everywhere.

The second way is having a real website generator. The components are the following:

  • Configuration: what features does the site owner needs? Does he needs a photo gallery or maybe a guestbook? (sorry I'm talking with the language of the late 90s here :)). What is defined here is used to assemble the available components of the generated website.
  • Individual data: it includes things like company description, logo, email or even domain names.

Based on that, the generator assemble the components (in my case it was source code such as ASP or PHP pages and a linked database) and the output would be a ready to be uploaded website.

The creation process could be 100% automated and the output downloaded at the end of the process. Update process would be no different that any downloadable application source code that is available, such as Wordpress. Finally, since the output is not compiled, the customer was able to customize everything.

In addition to this fairly simple way to generate websites, I recommend you to include a plugin system, just like Wordpress, that would allow your customer to create their own components.


There is a third option that is a hybrid of the two you expose.

The sites are generated dynamically from the database and the result is stored in a cache for a defined period of time. You can view this architecture in two ways:

  • Dynamic system with a cache.
  • Static system that its runs to regenerate the website in a defined period of time.

The funny thing its that its the same thing, You have the scalability of a static system and the flexibility of a dynamic system, a think that this is the way the majority of this sites are build. Very similar to CQRS architectural pattern.

Not the answer you're looking for? Browse other questions tagged or ask your own question.