27 August 2019

Super fast and secure sites with Drupal and Gatsby

Developers
Drupal
React

Wouldn’t it be nice to have a website that is very fast, very easy to update, a pleasure to develop, and very secure? A new breed of projects that combine the latest CMS technology with a static site generator makes it possible, with a few caveats, of course.

One of the most interesting innovations in the field of Content Management Systems in recent years has revolved around the idea of decoupling: separating the content management part of the system from the content displaying part of a website. This is a major shift in how dynamic sites and content-based applications are built that introduces a series of advantages and new challenges.

Another trend that is getting increasingly popular is the idea of static sites, where all of the site’s pages and assets are prebuilt and already there, no database is involved in serving the content and the user can enjoy faster response times, no downtimes, way fewer security headaches and a user interface that follows the latest best practices in frontend development.

Smooth content creation

Many available examples and starters to build static sites give you a simple portfolio or blog, where the content is actually added to the codebase, alongside the structure of the site. This process can work for small sites managed by highly technical teams (for example, a developer’s blog or documentation of an open-source project) but it becomes very impractical for the more common scenario where content editors are involved. 

Content editors are used to systems that make their lives simpler: WYSIWYG editors, revisions, workflows, content translations, taxonomies, etc. These are areas where Drupal represents a robust and battle-tested solution. And, thanks to the many recent developments geared towards making Drupal a solid API-based CMS, it can offer all of those, plus serving the content to a variety of channels. One of these channels can be a Static Site Generator.

A static site generator is a system able to ingest and process content coming from a variety of sources (a CMS being one of them) and generating a set of static assets (a fancy way of saying “a folder with files, scripts and images”) that represents a snapshot, a bit like a “polaroid” of your site. This can be hosted easily and cheaply on a simple web server. 

Our static site generator of choice is the increasingly popular Gatsby: it’s based on React and our frontend developers love working with it, along with the rest of the web.

Drupal can talk with Gatsby using the drupal source plugin. Also, we recommend installing the build hooks drupal module that we maintain to allow content editors to trigger a build of the site (“update the polaroid snapshot”) when they feel that the content is ready to go live.

Drupal + Gatsby, fit for all?

So, should your organisation switch to this way of building and maintaining websites for all your needs? The answer is that… it depends on the project.

Technology is progressing quite fast in this space and these recommendations might change in the near future, but for now, we think that this can be a good fit for your project if:

  • The content you are managing is not real-time critical
  • Users don’t need to sign in to your CMS, or you are ok using external services for comments and feedback features
  • You don’t have a huge content library

If you want to learn more about how to use Drupal and Gatsby together, this is a good starting point: Using Gatsby with Drupal. Or contact us and we will be happy to recommend the best solution for your case.

Ota yhteyttä