Introduction to Node.js and Drupal API Connection

Node.js and Drupal’s API-first architecture work great together to provide a seamless connection between back-end and front-end development.

Acquia has extended the value of Acquia Cloud with the announcement of Application Services for Node.js. Now development teams have a fully decoupled-ready platform to extend their Drupal applications across digital channels with lightweight JavaScript frontend design.

Decoupled applications are increasing in popularity as brand experiences continue to move beyond the traditional website. As channels grow, so does the need to manage content. By adding Node.js support to Acquia Cloud, teams can now leverage the power of Drupal 8 and its API-first architecture to extend applications to new channels without the need to fully replatform.

A decoupled-ready platform enables teams to extend content to things like digital signage, kiosks, mobile … really, the sky’s the limit. This application architecture is nothing new; Acquia CTO and Founder Dries Buytaert has been writing about this for at least two years. And we’ve been working with clients, such as Princess Cruises and Powdr, to build decoupled experiences and applications for their customers.

Why is decoupled Drupal becoming so popular? We see a number of benefits both from our customers’ perspective as well as from our partners. The primary use case for decoupled relates to when our customers need a single source of truth for content that supports multiple applications.

Drupal’s API-first architecture makes this work very well with some real benefits for developers.

First, if you have a relational content model, Drupal provides a robust CMS to serve as a repository for your applications. Content authoring and management occurs in Drupal and can be served to one or many applications. The API-first architecture of Drupal 8 provides a robust repository for serving this use case.

Second, if your development team is working in a differentiated development methodology where frontend and backend development teams are working simultaneously, this architecture model makes it easy for teams to map the content model to the API. For the nontechnical, this means teams can divide and conquer to deliver applications faster.

Why Node.js and Drupal are a great match

To meet our customers’ needs, Acquia took the step of adding the Node.js application service to our cloud because the runtime enables faster rendering and better SEO performance.

But, there is a lot more to the marriage of these technologies that benefits developers. For example, rather than simply adding the container, Acquia fully integrated Node.js with Drupal allowing teams to focus on building great apps.

For teams, a combination of community-based projects and Acquia’s platform enable projects to start faster.

There are a multiple available distributions well suited to decoupled applications including: Contenta and Acquia-sponsored distributions headless Lightening and Reservoir. If none of those meet your needs, Drupal 8's API-first design leaves the ability to create your own, custom distribution.

When designing your user experience, Node.js offers ample choices among front-end frameworks, such as Ember, Angular, and React. Acquia’s implementation of Node.js in our platform allows teams to determine what JavaScript framework is best suited to their needs

Why do teams want to decouple with Node.js? In super simple, non-technical terms, JavaScript is the cookbook, Node.js is the chef. The presence of the runtime in your architecture enables apps to render faster and take advantage of tools like websockets that can be used for SEO optimization.

As a development language, JavaScript continues to grow in popularity, evidenced by more than 177 million downloads of Node.js in 2016 alone.

Node.js is an open source server framework designed to build scalable network applications. It can run on various platforms from Linux to Mac OS X and uses JavaScript on the server and it was created for efficiency. Node.js eliminates the waiting, and simply continues with the next request. Node.js runs single-threaded, non-blocking, asynchronous programming, which is very memory efficient

  • Node.js can generate dynamic page content
  • Node.js can create, open, read, write, delete, and close files on the server
  • Node.js can collect form data
  • Node.js can add, delete, modify data in your database

So what does this look like? Content, like an article for example, that lives within your CMS have a type, but also need to show up on mobile. To do this, that content is maintained in the back end in one place, and then maintained with JavaScript on the front-end. The reason for using JavaScript is that it’s designed for better usability.

JavaScript is huge, which means more talent out there to create engaging digital experiences and really cool decoupled applications. Supporting JavaScript frameworks and Node.js just makes your platform better.

Featured Resources

View More Resources