Fortunately, this November, the publication of my new book, "Decoupled Drupal in Practice," marks the first comprehensive guide to decoupled Drupal, its architectures, and its implementation on the market today. With a foreword by Acquia CTO and co-founder Dries Buytaert, "Decoupled Drupal in Practice" is now available for preorder on Amazon and on Apress and is a must-have for any Drupal practitioner's bookshelf.
“Decoupled Drupal in Practice” covers all of the distinct strands of decoupled Drupal from the standpoint of both marketers and developers, with a description of the history and background of decoupled Drupal architectures. It includes a full description of foundational Drupal web services like core REST, JSON API, and GraphQL; an analysis of available authentication methods; and tutorial-focused approaches to building consumer applications in React, React Native, Angular, Vue, and Ember.
For engineering executives and marketing professionals who are seeking more insight into whether decoupled Drupal is right for them, I have excerpted two chapters from the book below that delve into the risks and rewards of decoupling Drupal. To gain more insight into decoupled Drupal, how it came to be, and whether it is right for you, please order your copy today.
Advantages of Decoupled Drupal
While there are many advantages of decoupling Drupal in your own implementation, there are a few that are particularly valuable to marketing teams, to developers, and to businesses: namely content syndication ("write once, publish everywhere"), an architectural separation of concerns (structured data as distinct from presentation), and pipelined development. Employing Drupal as a web service provider is particularly true if you have a team that specializes in JavaScript or in other front-end technologies besides Drupal.
Progressively decoupled Drupal has its own benefits, which are outlined throughout this chapter. These include pipelined development but also the ability to maintain a monolithic architecture without multiple points of failure, as well as mixed experiences in which differentiated levels of interactivity can be provided for the benefit of the user.
Content syndication
"Write once, publish everywhere" is rapidly becoming a popular tenet in marketing and publishing in the omnichannel landscape. Increasingly, content providers and publishers are seeking to take advantage of diverse mediums to deliver their content to a growing array of experiences. In these scenarios, Drupal is the hub for a constellation of experiences, all ingesting content from a single source of truth, whether that hub is a full Drupal site (with optional progressive decoupling) or a fully decoupled Drupal repository.
It is important to emphasize here that Drupal does not need to be fully decoupled for content syndication to succeed when it comes to building experience ecosystems. Many Drupal sites that are monolithic and end-to-end also expose data for consumption by other applications. Indeed, this is how Drupal project lead Dries Buytaert recommends that architects use Drupal in a decoupled way: as a public-facing Drupal site which acts also as a central data source for consumer applications. This maintains Drupal's end-to-end contiguity and also retains Drupal's front-end benefits on the Drupal website itself.
Separation of Concerns
Web development has long contended with the issues surrounding the separation of concerns between structured data and its presentation layer. Whereas structured content and its delivery constitute the structural skeleton of Drupal, templates and their logic make up the presentation of Drupal content. Even in monolithic Drupal, one can easily draw a distinction between the layers which make up key back-end features of Drupal (e.g. the database itself, the database abstraction layer) and its front-end functions (e.g. the Twig theme layer).
Although in monolithic and progressively decoupled Drupal, this separation of concerns is implicit and largely invisible to the user, in fully decoupled Drupal it becomes an explicit split between structured content, handled by Drupal, and its presentation, handled by consumer applications. As such, by exposing data to the front end in JSON or in XML, presentation and aesthetics become the domain of the consumer applications that create their own experiences using Drupal content, separately from the default Drupal front end.
The aforementioned RESTful Panels module challenges this paradigm in the fully decoupled context, but the injection of presentational logic from Drupal alongside structured content challenges the separation of concerns that fully decoupled Drupal touts in the first place.
User-Centered User Experiences
The benefit of improved user experiences is perhaps the most polemical of the advantages that decoupled Drupal confers, because good user experience results from effective design and development, not necessarily from architectural decisions. Nonetheless, decoupled Drupal does confer the advantage of an improved user experience from the fact that experiences better catered to users' needs can be crafted by undertaking a decoupled Drupal architecture.
The question of user experience in this case is closely intertwined with the issues surrounding the front-end developer experience (see next section). For instance, an interactive application requiring frequent re-renderings of content may not be as effective in Drupal as in a JavaScript framework better oriented to the task. Nevertheless, for consumer applications built for mobile audiences, the user experience must be well-suited to the task, and Drupal's responsive design may not be sufficient to provide a user-centered experience.
In progressively decoupled Drupal, a JavaScript framework is employed to enhance the existing user experience provided by Drupal, whether that means to replace as much of it as possible or to add interactivity to a section of a single page. In this way, a more user-centered experience can be applied selectively to an existing Drupal front end in an incremental fashion.
Front-End Developer Experience
For many front-end developers, especially those well-versed in JavaScript, the Twig-driven front end of Drupal may be complex and distinct from the paradigms they have worked with in the past. Some teams are made up of primarily JavaScript developers for whom modern front-end development requires ample use of NPM and other JavaScript development tools. In addition, Twig and Drupal's AJAX framework are ill-suited for highly interactive applications that may be requested by business stakeholders.
Decoupling Drupal, whether fully or progressively, offers developer teams the ability to apply specialized knowledge in a differentiated fashion to desired functionality. For instance, the use of a JavaScript framework that a developer team is intimately familiar with can accelerate development on a progressively decoupled project. By the same token, a fully decoupled Drupal implementation with a JavaScript consumer opens access to a JavaScript framework's features.
This is particularly true given the immense advancement that JavaScript as a language has seen in recent years and its favorable positioning for use in interactive client-side settings. New features in ES6, the current version of JavaScript seeing widening browser support, such as arrow functions, destructured assignment, the spread operator, and classes, among others, offer a much more pleasant experience for developers than ever before.
Pipelined Development
In pipelined development, teams with different skill sets can work in parallel on different components of the implementation without impeding each other's work or compromising the integrity of the project. Decoupled Drupal also opens the door to a pipelined development process in which a front-end team can build applications against a dummy web service API used solely for testing but not actually completed, while a back-end team can construct the back end which exposes that API and the underlying processes yielding it.
Fully decoupled and progressively decoupled Drupal architectures both allow teams to produce work at their own respective velocities. For instance, whereas an Ember developer would be proficient with Handlebars, they may not understand the systems that provision web service APIs in Drupal, at which point a Drupal developer can contribute. In this fashion, a front-end developer is no longer hamstrung by the complexities of Drupal's theme layer and can control markup and rendering, while Drupal developers can focus on their expertise on the back end and craft a robust RESTful API.
Conclusion
In this chapter, we examined some of the rewards incurred when decoupling Drupal, whether in the fully decoupled or progressively decoupled way. These include content syndication, where an omnichannel landscape helps realize the dream of "write once, publish everywhere," and a separation of concerns, where structured content is distinct from its presentation.
In addition, both developers and users benefit from experiences that are fine-tuned to their requirements, whether it is greater interactivity, a particular device, or a set of technologies. Finally, perhaps the most relevant for both fully decoupled and progressively decoupled approaches is the promise of pipelined development, where developers of different specializations can work in parallel on distinct components.