Skip to main content

Revisiting GatsbyJS and Drupal Commerce

Published on

The Drupal community has taken to GatsbyJS, the React framework that lets you easily build static (and more) websites (or applications.) And, honestly, this makes a lot of sense. Drupal is a great content management system and it even has ways to create microsites within one installation (thanks to techniques like the Domain module.)

My first experience with GatsbyJS was in preparing a demonstration of decoupled Drupal Commerce for Decoupled Days 2018. I had copied the Umami demo someone had written and got it working with Drupal Commerce. In fact, it is still up and running here: https://gatsbyjs.demo.centarro.io/product/drupal-commerce-hoodie. The code is also available on GitHub. Back then I had to fork the Drupal source plugin to make things work. The JSON:API module was still a contributed module, and some spec implementation improvements had broken the plugin.

Since that time, my work at Centarro has been doubling down on the API-First capabilities of Drupal Commerce and the developer experience of JSON:API (Supporting cross-bundle entity collections in JSON:APIQuerying Drupal Search API indexes using JSON:API.)

The community has also grown in its usage of GatsbyJS. I'm hoping to get back into the arena and see what can be done with GatsbyJS and Drupal Commerce for a decoupled storefront.

This past week I had a discussion with Shane Thomas about Drupal Commerce and GatsbyJS. I used this opportunity to review the documentation for GatsbyJS themes. Themes are composable, which means they can provide components and templates used in your GatsbyJS site. Perhaps this allows a prebuilt product template and add to cart component that "just works" with the Drupal Commerce data model 🤔? Time will tell.

Lee Rowlands pinged me while he was at Drupal South and I was spending Thanksgiving at my parent's house. He asked about some of our recent API initiatives work for Drupal Commerce and how he may lend a hand. I didn't have much for an answer, as we're in discovery / make a mess mode. There is a Gatsby-ECommerce plugin that works with Moltin, an API-First eCommerce SaaS. He's experimenting plugging Drupal Commerce into that plugin. 🥳I hope to sync with him and see how that's going.

I'll be reading up on the following blogs as well to bring myself up to speed on Drupal + GatsbyJS