As the weather heated up last week in Nashville and the city's eponymous hot chicken incinerated tongues left and right, something else was burning in the spotlight at DrupalCon Nashville: decoupled Drupal.
The Music City Center played host to the Drupal community and a coterie of developers, technologists, businesspeople, and community builders passionate about our flinty open-source content management system.
For me, the most significant outcome of the conference, which I've attended for almost a decade now, was the excitement — and lingering bewilderment — surrounding decoupled Drupal. Every session room concerning decoupled Drupal was standing room only, and the interest was palpable.
That meant it was a great time to announce the second edition of Decoupled Drupal Days, the premier conference on decoupled Drupal, to be held again in New York City between August 17–19, 2018.
This year, DrupalCon Nashville was also the venue for the inaugural Decoupled Summit, which attracted a diverse range of speakers, panelists, and attendees.
For this column, I popped into a few sessions and examined some of the most compelling content from DrupalCon that consistently attracted attendees like yours truly. As someone who has been tracking the decoupled Drupal phenomenon for several years now, it was exciting to witness the best practices and ideas taking shape in Nashville. In short, decoupled Drupal is no longer theoretical, and it's clear that it will be a force to be reckoned with in Drupal for many years to come.
Solving hard problems in decoupled Drupal
To kick things off after the Driesnote, Mateu Aguiló Bosch (Senior Developer at Lullabot and co-coordinator of the API-first Initiative) jumped head-first into tackling some of the thorniest issues in decoupled Drupal, namely performance, derived schemas, routing, editorial layouts, and authentication. Mateu proceeded to explore each topic in turn, offering a thoughtful analysis or robust solution at each juncture. In this section I'm focusing only on performance, routing, and editorial layouts.
Core REST typically requires multiple sequential requests to fetch related entities referred to by the retrieved entity in a single request. While JSON API mitigates this problem, sometimes there are cases where multiple requests are still required in sequence. Mateu highlighted the case of creating an article with many taxonomy terms, which requires creating the vocabulary (if it does not exist), the terms therein, the user that is the author, and the article itself. The Subrequests module alleviates this need by accepting JSON blueprints which contain placeholders that can be filled in later when each constituent request succeeds.
/recipes/sliced-bread can change to
/sliced-bread, but there is no way for the client to know. In response, Mateu presented the Decoupled Router module, which provides a redirect that Drupal can then resolve to issue the response from a path alias that was modified.
Finally, Mateu deftly explored the topic of editorial layouts in decoupled Drupal architectures, which can be a fraught issue with software architects and marketing professionals on opposite sides of the aisle. After agreeing that decoupled layout is potentially damaging due to the coupling of a front-end consumer to the back-end management of presentation (I've referred to this problem as pseudo-decoupling in the past), Mateu recommends a solution that provides configuration on a per-consumer basis. This means that individual consumers could retrieve the layout appropriate to them based on their own UUID, which would be provided in every request to identify the consumer issuing it.
On the other side of the spectrum, Steve Persch (Lead Developer Advocate at Pantheon) and Marc Drummond (Senior Front-end Developer at Lullabot) posed several questions about extensibility. In response to Steve's question, which added that it might be beneficial that React has fewer modes of extensibility than Drupal, Daniel noted that if the same flexibility found in Drupal is desired in React, we would need to introduce more than simply React to the Drupal ecosystem. From the front-end perspective, Marc asked whether modules would be able to pull in their own React components and register their own routes — a question that the initiative doesn't yet have an answer to but certainly will need in the future.
Tackling challenging topics in decoupled Drupal
Last but not least, I was able to catch the first half of a session dedicated to advanced topics in decoupled Drupal presented by my colleagues Jason Enter (Front-end Lead, Professional Services at Acquia) and Steve Worley (Technical Consultant, Professional Services at Acquia).
Jason and Steve got down to business quickly with a rapid-fire introduction to the motivations for decoupling Drupal before leaping headlong into API security. They highlighted the Simple OAuth module, available in the Drupal contributed ecosystem, which provides OAuth2 token-based authentication for decoupled Drupal architectures. In short, the most compelling reason to use OAuth2 in Drupal is that each consumer can be associated with a particular user role which allows the content to be scoped appropriately.
On the subject of orchestrating data exposed by Drupal-provisioned APIs, Steve and Jason offered up their experience using a GraphQL server as a proxy through which data can be forwarded and manipulated from disparate sources. After all, many business requirements force consumers to communicate with multiple APIs, such as a legacy API or external API. Using a GraphQL server to proxy this differently sourced data and issue requests in the client's stead to those other APIs can lead to performance improvements.
Planning for Decoupled Drupal Days 2018
Decoupled Drupal Days is scheduled for August 17–19, 2018 this year and will be held at the John Jay College of Criminal Justice in Midtown Manhattan. We're busy at work rebuilding the website, readying the call for papers, and preparing registration. In early May, we'll be opening up the first batch of tickets and session proposals.
All in all, DrupalCon Nashville seemed like an inflection point in the history of decoupled Drupal. I've long espoused the benefits (and inevitable drawbacks) of decoupled Drupal architectures, but it was thrilling to see so many engaging with these themes and revealing details about their own implementations, including where things went awry.
In the next installment of Experience Express, we're back in Drupal territory and spelunking deep into Drupal's core REST modules and powerful contributed modules like JSON API, GraphQL, and RELAXed Web Services. In addition, watch for another event roundup soon from Philadelphia, where I'm participating in Drupaldelphia. All aboard!