Lightning Fast E-Commerce: Remix your Shop with Shopify Hydrogen

Ready to take a thrilling ride into the world of headless e-commerce with Shopify Hydrogen? This cutting-edge solution, built on top of Remix, is the latest and greatest way to build high-performance online store. E-commerce is more important than ever, and providing a seamless customer experience is key. But building a platform that delivers can be daunting, even for experienced developers. With Hydrogen, you'll not only find it easier to build a top-of-the-line online store, but you'll also discover how much fun it can be! From creating collections and products to implementing a shopping cart, we'll show you how Hydrogen can take your developer experience to the next level.

This talk has been presented at React Summit US 2023, check out the latest edition of this React Conference.

Watch video on a separate page

FAQ

Shopify Hydrogen is a new framework designed to simplify the development of headless Shopify stores. It incorporates built-in best practices and is built on top of Remix, a full-stack React framework. Hydrogen enables a component-based architecture that leverages Remix for improved performance and provides seamless integration with Shopify APIs.

Shopify Hydrogen benefits e-commerce sites by offering a flexible and customizable front-end experience through an API-driven architecture. This separation of the front-end and back-end, also known as headless commerce, results in omnichannel selling capabilities, faster time to market, improved performance leading to better SEO, and enhanced personalization and customization.

Key features of Shopify Hydrogen include a component-based architecture that improves performance, seamless integration with Shopify APIs, and the use of Remix to ensure a great developer experience by working with web standards. It also supports scalable and fast website development.

To start a project with Shopify Hydrogen, you can use the Shopify CLI. By running the command 'NPM create shopify-hydrogen@latest', you can quickly create a full-featured e-commerce website. For a basic setup, the 'template hello world' command provides a barebones repository to explore and customize.

In Shopify Hydrogen, you can build a cart by first initializing a cart instance using the create cart handler in your server.js file. You then pass this cart instance to get load context to make it globally accessible. Adding products to the cart involves using the cart form component with specified merchandise IDs and quantities. To manage actions like add or remove products from the cart, you use corresponding actions in your cart route.

Shopify Hydrogen provides an SEO component that collects data defined in the handle export. This component can be included in the head of your root file, allowing you to customize the shop name and description for SEO purposes. You can also overwrite these settings in other routes to tailor the SEO data for specific pages based on product titles and descriptions.

Yes, Shopify Hydrogen can be integrated with other tools and frameworks. While it's built specifically for Shopify stores, the Hydrogen React library includes components, hooks, and utilities that can be used with any React framework or application, such as Next.js.

Alexandra Spalato
Alexandra Spalato
27 min
15 Nov, 2023

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Today's Talk is about Shopify Hydrogen and how it simplifies the development of headless Shopify stores. The Talk covers topics such as mixing Storyblok and CMS data, code and data manipulation in Hydrogen, creating products and collections, handling SEO, building a performance server-side cart, setting up and managing the cart, and displaying cart and raffle information.

1. Introduction to Shopify Hydrogen

Short description:

Hello, I'm Alessandra Sfalato, a developer relations engineer at Storyblok. Today, I will talk about how to remix your shop with Shopify Hydrogen to build a lightning-fast e-commerce. Headless commerce separates the front-end and back-end, offering advantages such as omnichannel selling, faster time to market, better performance, SEO, personalization, and customization. Shopify Hydrogen simplifies the development of headless Shopify stores, leveraging Remix for improved performance and seamless integration with Shopify APIs. We will explore creating a project, fetching and mutating data, building collections and products, handling SEO, and building a cart using Hydrogen.

Hello, I'm Alessandra Sfalato, I'm a developer relations engineer at Storyblok. I'm French, you can hear by my accent, and I live in Madrid.

So today my topic is how you can remix your shop with Shopify hydrogen in order to build a lightning fast e-commerce. So well, I have the public in front, I'm a public in front so I cannot ask you who is using already, I don't know about it, but I hope you will learn and like it with my talk.

So in the first part of the talk, we will cover the basics of e-commerce, it's important, and the second part we will introduce Shopify hydrogen and its features, and finally the big part of the talk, we will talk, we will explore the code of a custom storefront build together with Hydrogen.

So headless commerce means the separation of the front-end and the back-end, and this is achieved thanks to an API-driven architecture, which allows for a flexible and customizable front-end experience. When compared to monolithic, headless offers many advantages, omnichannel selling, faster time to market, better performance, which leads to better SEO, personalization and customization, and certainly much more. However, it may come with an increased development complexity.

So imagine an e-commerce platform that offers all the benefits of headless commerce while minimizing the development complexity. This is where Shopify Hydrogen comes in. So Shopify Hydrogen is a new framework designed to simplify the development of headless Shopify stores. It incorporates built-in best practice and it's built on top of Remix. So again, I cannot ask you who knows Remix, but for the one who doesn't know Remix, it's a full stack React frameworks, which is based on web standards and it creates a really great developer experience because you work with web standards, so it makes everything simpler. And also you can make really scalable and fast website. I didn't know it before learning Hydrogen and by learning Hydrogen, I fall in love with Remix and now it's really my go-to framework.

So it offers, well, Hydrogen, not Remix, a component-based architecture that leverages Remix for improved performance and it also provides a seamless integration with Shopify APIs. So now it's time to take a deep dive into the code of a Shopify Hydrogen project. So first we will create the project, then we will see how to fetch and mutate data in Hydrogen, how to build the collection and products, how to handle SEO and how to build a cart.

So first we use the Shopify CLI to create the project with NPM-created Shopify Hydrogen latest, and this will create for you in two minutes a full featured ecommerce website. For this session we will use the template hello world command which provides a barbone repo and so we can really explore what we are building but let's see what we obtain with this command in just two minutes.

So this is a website you get with that, so we are off. What happened, oh yes I have to launch the development so npm run dev. Okay, so now we should be good. Okay, we have mock data, so we have this home page, we have all the products, we have the single products with options, we can add them to the cart, we can apply discounts, we can check out, we can sign in, we can search. So we have really everything and we can see it in the code of the storefront here. We have all the possible routes, login, logout, recover, register, reset, addresses, orders, collections, products, search. So you can use that and customize it to make your shop or explore it to learn. But I have used the Hello World template to build this little nice website about surf. So this is the homepage, the homepage is built with Shopify and Storyblok, my favorite headless CMS. So we have here a banner that come from the CMS and here we have a product grid that comes from Shopify and here single products where the image is pulled from Shopify and these little text which is pulled from the CMS.

2. Mixing Storyblok and CMS Data

Short description:

We can mix and match Storyblok and CMS data to create storytelling. Clicking on the board link gives access to collection entries. In the performance board, collection details and products are available. Single product pages have a shop pay button for quick purchase. The cart functionality allows adding, removing, and checking out items. Personalization is implemented, showing a different homepage based on user behavior and navigation.

So we can mix and match Storyblok and the CMS data and make storytelling. I will show you after how this is built. And now if I click on the board link, I have access to my collection entries. So we have performance board and original board collection. So if I click on a collection here in the performance board I have access to the collection details with a banner here and all the products in this collection. And then I can go to my single product. The shop pay button is a buy now button and then I can add to cart and here I can see the items in my cart. And I can go to my cart. I can remove items from the cart and I can check out. And here everything is working. And if I go back to my website and to my homepage, I can see that my banner has changed. Now it's featuring performance board and is also displaying only performance board in this product grid. This is because I have implemented some personalization. So depending of the behavior of my user, and here I have navigated to the performance board, I will serve a different home page. And as I have navigated to the performance board, I assume that my user is interested in performance board. So I serve that, and here I go directly to the performance board.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling WordPress with Next.js
React Summit Remote Edition 2021React Summit Remote Edition 2021
9 min
Scaling WordPress with Next.js
Watch video: Scaling WordPress with Next.js
WordPress is still widely used, with over 800 million installs. The Jamstack is a modern approach to building static HTML websites that utilize JavaScript and APIs for dynamic content. Serving static HTML files is faster than server-based solutions like WordPress. Serving static files from storage or a CDN allows for infinite scalability. WordPress is a compelling option for nontechnical users due to its familiarity and thriving ecosystem.
Off with Their Heads: Rise of the Headless Components
React Summit 2023React Summit 2023
25 min
Off with Their Heads: Rise of the Headless Components
Watch video: Off with Their Heads: Rise of the Headless Components
Headless Components are efficient for app development, but there's a lot of work involved, especially for menus. The customizability wall is a problem with component libraries, but it can be solved through reverse engineering and design. Headless Components offer no markup or basic markup to be overwritten, providing flexibility in code and design quality. Radix and React ARIA are recommended stylus component libraries with different APIs. Kodaks' experience with headless components highlights the ability to mix and match easily and the potential for market gaps in the headless space. Radix is a popular choice for headless components due to its well-documented and user-friendly API. Headless components aid in testing, distribution of design systems, and accessibility. MUI is a self-consistent and rich library, while Radix focuses on accessibility and default accessibility. Kodaks integrates well with headless libraries and welcomes feedback through Discord.
Exploring the WordPress Graph with Next.js & WPGraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
23 min
Exploring the WordPress Graph with Next.js & WPGraphQL
WordPress is widely used, and it now supports a REST API for headless usage. Serving static HTML files allows for infinite scaling and surviving viral traffic. GraphQL can be used to interface with WordPress data, reducing complexity. WordPress can be coupled with plugins like Yoast and ACF, and WPGraphQL works seamlessly with these plugins. GraphQL allows for selecting only necessary data and has performance advantages over REST APIs.
API-first Development with Headless WordPress
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
API-first Development with Headless WordPress
This Talk discusses API-first development with headless WordPress, highlighting its benefits and the availability of resources. It explores the use of plugins and frameworks like WPGraphQL and the headless framework from WP Engine to create custom post types and make GraphQL calls. The Talk also covers building websites, querying and caching data, deploying apps with the Atlas platform, and improving user experience. It touches on authentication, efficiency, backend resources, and WooCommerce integration in headless WordPress, as well as WordPress accessibility and SEO optimization.
Contentful and headless
React Finland 2021React Finland 2021
19 min
Contentful and headless
How Contentful helps you to manage all the data in a headless e-commerce website.
Headless vs Traditional eCommerce Platforms: Introducing Commerce Layer
JSNation Live 2021JSNation Live 2021
8 min
Headless vs Traditional eCommerce Platforms: Introducing Commerce Layer
Commerce Layer is an Atlas Commerce platform that provides global shopping capabilities. It offers a range of endpoints for managing various aspects of e-commerce. Modular architecture, like the one used by Commerce Layer, offers benefits such as flexibility, scalability, security, omnichannel capabilities, and future-proofing.

Workshops on related topic

Deploying a decoupled restaurant review site to production with Strapi and Platform.sh
Node Congress 2022Node Congress 2022
134 min
Deploying a decoupled restaurant review site to production with Strapi and Platform.sh
WorkshopFree
Shedrack Akintayo
Chad Carlson
2 authors
Node.js has become an increasingly popular language to build and deploy backend APIs. In a world of legacy CMSs adopting decoupled implementations, plenty of frameworks have sprung up to classify themselves as "headless" CMSs, designed from the start to provide an easy way to personalize content models, administer permissions and authentication, and serve a content API quickly.
Strapi, one of the leaders in this space, has recently released their v4 version of the framework, and with Platform.sh it can be deployed alongside a number of frontends within the same project, giving a drastically simplified development experience working with decoupled sites. In this workshop, we'll deploy a Strapi demo application, which has been configured to serve a restaurant review site.
Piece piece you will add database services, tests, and frontends, all within the safety of isolated development environments. At the end, each user will have a functioning decoupled site, and some greater understanding of working with decoupled sites in production.