Shopify Hydrogen

On this page 7

Shopify Hydrogen is Shopify’s open-source React framework for headless storefronts, a toolkit for building a fully custom shopping front end that reads products, carts and customers from Shopify through the Storefront API. Among store platforms in E-commerce, it is the official route for merchants who want to keep Shopify as the commerce back end while replacing the theme layer with their own application code.

Hydrogen sits between a standard Shopify theme written in Liquid and a completely independent stack. It supplies routing, data loading, caching and commerce components out of the box, and it is designed to run on Oxygen, Shopify’s own edge hosting service, although it can be deployed elsewhere with some extra configuration.

How Shopify Hydrogen builds a headless storefront

A Hydrogen storefront is a server-rendered React application that fetches commerce data on each request and returns HTML to the browser. In current releases it is built on React Router 7, the successor to the Remix framework on which Hydrogen 2 was originally based, so every page is a route with its own loader for data and action for form submissions.

Data comes from the GraphQL Storefront API, which exposes products, collections, metafields, menus, search and the cart. Customer login, order history and addresses come from the Customer Account API, which uses an OAuth-based sign-in hosted by Shopify. Checkout normally stays on Shopify Checkout, so payment processing, taxes and fraud checks remain on the platform.

The table below lists the main building blocks a Hydrogen project combines.

ComponentRoleTypical use
Storefront API clientQueries commerce data over GraphQLProduct pages, collections, search
Cart handlerCreates and updates carts on the serverAdd to cart, discount codes, notes
Customer Account API clientHandles login and account dataOrder history, saved addresses
Hydrogen React componentsRender commerce UI piecesImages, prices, Shop Pay button
Caching utilitiesControl subrequest cachingFast repeat loads of catalog data
Shopify CLIScaffolds, runs and deploys the appLocal development and releases
Core components of a Hydrogen project

Oxygen hosting, caching and performance

Oxygen is Shopify’s global edge hosting for Hydrogen, running storefront code in a worker-based JavaScript runtime close to shoppers. It is included with most paid Shopify plans at no extra hosting fee, and it provides preview environments per branch, environment variables and deployment through the CLI or a connected Git repository.

Performance depends heavily on subrequest caching. Hydrogen lets developers attach a cache strategy to each Storefront API query, so stable catalog data can be served from cache while personalized data such as carts is always fetched fresh. The stale-while-revalidate pattern returns a cached response instantly and refreshes it in the background.

The following table summarizes the built-in cache strategies and where each one fits.

StrategyBehaviorSuitable data
CacheShortCaches for about one second, then revalidatesInventory and price-sensitive queries
CacheLongCaches for about one hour plus revalidationMenus, policies, static collections
CacheNoneBypasses the cache entirelyCarts, customer data, checkout links
CacheCustomUses developer-defined cache headersSpecial cases with known update cycles
Hydrogen cache strategies

Developers run the same runtime locally through MiniOxygen, which reduces surprises between development and production. Projects can also target other hosts that support the Web Fetch API, but they then lose built-in Oxygen features such as automatic environment linking and Shopify-managed scaling.

Hydrogen compared with themes and other headless options

Choosing Hydrogen is mainly a decision about how much front-end control a merchant needs and how much engineering effort it can sustain. A Liquid theme is edited in the Shopify admin and inherits most apps automatically, whereas Hydrogen offers complete design freedom at the cost of maintaining a software project.

The comparison below places Hydrogen next to the most common alternatives for a Shopify store.

OptionFront-end controlEngineering effortApp compatibility
Liquid themeModerate, within theme limitsLow to moderateBroad, most apps install directly
Shopify HydrogenFull control of React codeHigh, needs developersPartial, apps need API support
Next.js with Storefront APIFull control of React codeHigh, more custom plumbingPartial, same API limits
Other composable stackFull control, any frameworkVery highDepends on each service
Front-end options for a Shopify store

Hydrogen is one implementation of headless commerce and often a component of composable commerce, where content, search and commerce come from separate services. Its main advantage over a generic framework is first-party integration: Shopify maintains the API clients, analytics hooks and hosting, and it releases Hydrogen versions in step with the quarterly Storefront API versions.

When Hydrogen is the right choice

Hydrogen pays off when a brand needs experiences that themes cannot deliver and has a team able to own a React codebase. Typical triggers include content-heavy storytelling, unusual navigation, multiple markets with distinct experiences, or the need to merge Shopify data with an external headless CMS on the same page.

The decision table below matches common situations with a recommended approach.

SituationRecommended approachReason
Small catalog, no in-house developersLiquid themeLowest cost and broad app support
Brand-led site with heavy editorial contentHydrogen with a CMSFree layout and content modeling
Many apps for reviews, bundles, loyaltyTheme or careful auditSome apps lack headless support
Large Shopify Plus merchant with a web teamHydrogen on OxygenControl plus managed hosting
Existing React design systemHydrogenReuses components and skills
Deciding between Hydrogen and a theme

Limitations and common mistakes

The most frequent problem is underestimating ongoing maintenance. A Hydrogen storefront is a living application that needs dependency upgrades, API version migrations and framework changes, such as the move from Remix to React Router 7, which required code updates in existing projects.

  • App ecosystem gaps: many Shopify apps inject scripts into Liquid themes and do not work headlessly without their own APIs or SDKs.
  • Merchant editing: marketers lose the theme editor unless the team adds a CMS or uses metaobjects for content.
  • Caching errors: caching personalized queries can leak cart or price data between visitors, so private data must use CacheNone.
  • Analytics and consent: tracking must be wired through Hydrogen analytics and the Customer Privacy API to respect consent rules.
  • SEO responsibilities: meta tags, structured data, sitemaps and redirects become the developer’s task rather than the theme’s.

Teams that treat Hydrogen as a long-term product rather than a one-off build usually avoid these issues. A realistic budget includes a developer who follows Shopify release notes and schedules quarterly upgrade work.

The short version

Shopify Hydrogen lets a company keep Shopify as the engine of its online store while building the shop window completely by itself. Shopify still stores the products, takes the payments and runs the checkout.

Think of a theme as renting a furnished apartment that you can repaint, and Hydrogen as designing the interior from scratch. You get exactly the rooms you want, but you also need builders to keep everything in good repair.

Where it makes a difference

An outdoor apparel brand with about 1,200 products and strong editorial content found that its theme could not combine gear guides, trip stories and shoppable products on one page without slow, heavy apps. Its four-person web team already maintained a React design system for the brand’s mobile app.

The team built a Hydrogen storefront, pulled stories from a headless CMS and products from the Storefront API, and deployed on Oxygen with CacheLong for navigation and CacheNone for carts. Checkout stayed on Shopify. After launch, guide pages loaded noticeably faster on mobile connections, and the team scheduled a quarterly upgrade sprint to keep pace with API versions, which became the main ongoing cost of the decision.