Content as a Service


Relativity logo

I think everyone that has anything to do with Drupal has heard the terms decoupled, progressively decoupled, headless etc. But in the traditional sense, Drupal offers many free themes for you to download and basically "plug in" to your site. There are also many themes that you can buy, then plug in. Recently, with all the available javascript frameworks out there, more and more customization, interaction and animations have come into front end Drupal. But as a modular, highly customize-able, flexible framework, Drupal doesn't have to have a front end at all. It can be used as a log in based content repository builder. That content can then be made available for consumption by external applications such as mobile apps, custom javascript applications and yes, even other Drupal sites. So decoupling, or headless simply means, removing the front end from Drupal. I prefer to call this concept Content as a Service, or CaaS. Or as Drupal itself puts it, "API First".

Relativity has always been a "data first" mindset when building a site with a piece of data being related to other pieces of data. But if there is no front end in the Drupal site, how do we offer this data and its related data up for consumption?

  1. We allow Drupal itself to decide what goes out in the data structure that others consume relying on the consumer to create complex queries to construct their intended data flow.
  2. We customize these endpoints with data and its related data, but offer "pre-related" data snapshots.

If you lean towards the first option where Drupal outputs data to automated endpoints, you're in luck! The JSON:API module does that with zero configuration. Basically, just install the module and you're done! There is a helper module available named JSON:API Extras which allows for some added configuration.

If option 2 above looks attractive, Drupal Views as a REST endpoint might fit.

One additional possibility for option 2 (and my favorite by far) is GraphQL.

I'll write more on these options with pros and cons as time allows, but the main point here is that Drupal offers many possibilities if you're looking to go headless or progressively decoupled.