Now that the whole world has discovered decoupled CMS, the default and most common approach to Decoupled Drupal seems to be a completely independent static HTML+JS UI that uses Drupal only to get JSON data from it. While this is a start, it is throws baby out with the bathwater. It discards all the theming that is readily available from Drupal and leaves the developer with the full responsibility of painting the entire UI by templating HTML out of the JSON data on client. A better, faster (in run-time and developer time), and more efficient approach would be to:
- Let Drupal render most of the HTML on server-side. Make it fully cacheable.
- Store the "personalization" data in a third place, such as Firebase, DynamicDB, or self-hosted solution (such as Hasura+Postgres). Drupal can still serve JSON data (using REST, JSON:API, or GraphQL), but it should be same for all/most users, and hence cacheable.
Benefits, depending on your needs, could be many:
- Reuse most of the theming Drupal provides. Save development time (and money)
- Smaller and simpler client-side apps.
- Real-time features of an external personalization engine - such as live chat, live comments, breaking news alerts and push notifications.
In this talk we will review the problem and the proposed solution in more detail, including sample code & demo.
All source code is available here: https://bitbucket.org/spinspire/decouple-different/
The presentation video and several other supporting training videos are at https://youtube.com/spinspire