Why use Shopify Hydrogen?
First impressions of Hydrogen, Shopify's React framework for custom storefronts, written while it was still a developer preview.
Shopify has created a React framework called Hydrogen. It feels a lot like plain React, with Shopify's storefront APIs built in.
What stands out so far:
- Server rendering without the setup. You get a server-rendered React app without the configuration a React app normally needs for it.
- A custom frontend on Shopify's backend. You can build a far more customisable storefront and still keep Shopify as the backend, through its GraphQL API.
- Less time to set up. It is developer-friendly and gives more power to frontend developers.
- Commerce built in. There are many e-commerce hooks and components, which makes building a store fast.
- Pages as routes. It has a page structure for routing, like Nuxt.js, so you do not need a tool like React Router.
- Good for search and Web Vitals, which matters a lot for e-commerce.
It only works with Shopify, for now.
I am still exploring it. It is a developer preview, and I am also waiting for Oxygen, the hosting that goes with it. You can read more at hydrogen.shopify.dev, and there are good introductions from Shopify and from Fireship.
I think this is the start of more server-rendered React frameworks built for one domain. We can expect more of them for specific problems, the way this one is for Shopify. Next.js is very capable at server rendering, so a framework that pairs Next.js with an e-commerce backend seems likely too.
For a new storefront, Hydrogen looks like the better starting point. For an established e-commerce company it is a big step: with a Vue instance or Preact on an existing theme you can already get close to the same features. The Shopify team will keep adding to it, though, and I am planning to build a project on it to learn more.