Decoupling Drupal using static site generation

  • Posted on: 24 March 2016
  • By: Darko

Progressive De-coupling using Static Site Generation  + RESTful web services or GraphQL

This architecture is suitable for sites where the End Users are anonymous and the content does not change that often, say, once an hour.

The site generator generates a static HTML site using pre-defined generator templates, data from Drupal repository and Drupal rendered entities, such as rendered node or menu trees.  The dynamic aspects of the site are exposed as REST services and the user interacts with back end Drupal using JS / AJAX. The Drupal site runs securely on a different machine / port, perhaps on the internal company network. Content editors can still access the site using the standard Drupal interface, benefiting from Drupal features, like edit node, find content etc...

Advantages of an HTML generated site

  • Security

  • Stability (if the Drupal site goes down the html site still runs, just without services like search or subscribe, which can be gracefully degraded with JS)

  • Scalability / performance

  • Running costs (much cheaper to host and manage)

  • Easy to devise DDOS attacks strategy, as it is easy to move the site to a different host.

  • It is easier to plug in different data sources, such as another CMS or database.


  • Functionalities that are not static will need to be rebuilt using JavaScript and REST services or GraphQL (i.e extra development efforts)

  • Development effort needed to allow existing site to be generated as HTML site.

  • Some additional DevOps effort needed to set up site generator software and configure the above described architecture.

Static site generator tools


Drupal generator module

Popular site generator tools


RESTful service could be used for interactive / de-coupled part of the site. When the GraphQL Drupal module is ready it can be used instead.