Shopify's Hydrogen Starter with Contentful

Hydrogen seamlessly fetches content from Shopify and other data sources, powering the customer experiences built with Contentful’s flexible content models.
Monitor with dollar sign and percentage tags with Hydrogen logo and gift bag
Hydrogen logo with a buy now title and editor mockup
What is Hydrogen
Hydrogen is Shopify’s React-based framework for building custom storefronts.
1
Prerequisites

2
Initialize your Hydrogen Project

Run the following command to create a new Hydrogen storefront:

The CLI will ask a few questions around how you’d like to configure the project. These are suggested answers if you are new to Hydrogen and want to get un and running quickly. If you are more familiar, feel free to change your responses to more appropriately meet your needs, though this guide does not cover the changes or additional answers you may need to provide as a result.

Once complete, Hydrogen will display the next steps.

3
Configuring and Running Hydrogen

Navigate to your project folder and start the development server:

4
Integrate Contentful

Create a new route file for Contentful integration:

Add the following code to fetch and display data from Contentful:

First, Update the CSP header to include Contentful's CDN, by adding (pay attention to the START/END comments in the following code block) the following code block:

Next, change the following line later in this file to use this new updatedHeader, before:

and after you've made the change:

5
Contentful Content

6
Next steps + additional reading

Choose your technology path with our language and framework agnostic CMS

Bundle of technologies that can be used with Contentful.
Partner with us
Contact us
Structured Content
add-circle arrow-right remove style-two-pin-marker subtract-circle remove