GraphQL, React and Next.js for Drupal developers

Submitted by dryer on Fri, 10/06/2017 - 19:06

Drupal is a popular enterprise grade Content Management System (CMS) that has traditionally been built around the PHP server side programming language. In addition Drupal also adopted jQuery and Backbone JavaScript libraries relatively early. With Drupal 8 finally bringing Drupal up-to-par on heavyweight Object Oriented Programming methodologies, it is now a more worthy contender to systems built with enterprise grade tools written in Java and .NET.

Nevertheless the technology landscape on in web development is constantly changing, and as a monolithic system built to serve a wide audience Drupal is never on the bleeding edge. This is why Drupal developers need to wait and see what surfaces as a winning solution, even if it means using some antiquated approaches in the meanwhile. In the recent times the Drupal community has woken up to some technologies already widely in use by more innovative Open Source communities like JavaScript, Python and Golang.

Here are a few technologies that Drupal developers can try to catch up, before the bleeding edge deems them harmful legacy:

  • GraphQL is a protocol that allows for easy communications in server-client architectures. Since it's launch in 2015 the protocol has gained momentum and now going into 2018 GraphQL is gaining critical mass. With many mature client libraries like Apollo and Relay Modern on the market, there is no shortage of server implementations either. For Drupal there is already a module in development that allows developers to use Drupal with GraphQL.
  • React is a view library for JavaScript. This is now the most popular way of developing JavaScript applications. Using React developers can create declarative interfaces where they concentrate on what needs to happen instead how how, like when working with DOM manipulation with jQuery. React has been adopted by WordPress years ago, and now Drupal is trying to catch up with Acquia pushing for inclusion of React into Drupal when the two PHP CMS titans battle for marketshare.
  • Next.js is a JavaScript framework. As opposed to regular concepts of a framework Next does not run on the server or in the browser exclusively. It is a universal framework that runs the same exact JavaScript code on the server and the client. Notably Next.js uses React.js as it's view layer. It offers great performance an Search Engine Optimisation (SEO) capability, because the react code is rendered on the server using SSR (Server Side Rendering)

For Drupal developers this is great as you can choose to build on the same skillset as above to build decoupled sites and applications using familiar technologies, but you can also decouple yourself from a single CMS because React and Next are all universally applicable and can be used with any GraphQL capable CMS.