Thunder Release: GraphQL API

Thunder goes headless! The latest release of our distribution comes with one of the coolest features we've had in a long time: Thunder now has an official API for headless and decoupled approaches. The API uses a custom GraphQL schema based on the GraphQL module version 4.

In November 2020 we held a productive workshop with some of our Certified Thunder Integrators (CTIs). We discussed various approaches, ideas and experiences with headless systems. As a result, we took a closer look at three approaches: the JSON:API supported by Drupal Core, the GraphQL solution already used by Burda (contrib module version 3) and the new version of the GraphQL contrib module (version 4, currently beta).

After careful consideration, we decided to use GraphQL 4. Although we generally prefer to work with core solutions, we chose a different way this time. In short: GraphQL 4 is easy to use, frontend developers are not forced to understand the deeper Drupal logic. Field names can be adjusted manually and, usually, one query is enough to get a result. You can read about this in detail in our documentation: thunder.github.io/developer-guide/headless/motivation.html

With the new API, we introduce three main interfaces which cover all main data types used in Thunder:

  1. the Page interface for all Drupal entities that have a URL, e.g. nodes, terms, users
  2. the Media interface for all media entities
  3. the Paragraph interface for all paragraph entities

Our aim is to minimize references and keep data structures as flat as possible, especially if the references are very Drupal specific. Drupal specific field prefixes are not used as they make no sense for the frontend. See an example of how these basic ideas are implemented in our documentation: thunder.github.io/developer-guide/headless.html#basic-ideas

In our new documentation, we tried to answer all important questions about the new headless API. We are looking forward to your comments, questions and suggestions!

The Headless API is currently in an experimental state and can be tested. We are very excited to hear your feedback and experiences while testing. Message us on one of our Slack channels (Thunder CMS or Thunder @ Drupal) or email [email protected]thunder.org.

Another feature of the new release is the index sitemap. Thunder now provides a single higher-level sitemap that points to all the existing sitemaps. Creating individual sitemaps for different content types can make work easier for SEO managers, for example when searching for specific errors. The creation of such sitemaps is already possible, but the higher-level sitemap that brings all the threads together was missing.