---
title: "How We Built Hydrogen: A React Framework for Building Custom Storefronts"
description: "Hydrogen, Shopify's React framework for custom storefronts, was built on React Server Components, React 18 streaming SSR and Vite, chosen over static JAMStack approaches because commerce pages are inherently dynamic."
url: "https://swe.quest/articles/how-we-built-hydrogen-a-react-framework-for-building-custom-storefronts-0de0baea8226959f"
canonical: "https://shopify.engineering/how-we-built-hydrogen"
source: "Shopify Engineering"
published: "2022-06-22"
difficulty: "medium"
kind: "Case study"
reading_minutes: 13
tags: ["react","frontend","web-performance","graphql","ecommerce"]
---

# How We Built Hydrogen: A React Framework for Building Custom Storefronts

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2022-06-22, 13 min read, Case study. Original: [https://shopify.engineering/how-we-built-hydrogen](https://shopify.engineering/how-we-built-hydrogen)

## Summary

Hydrogen, Shopify's React framework for custom storefronts, was built on React Server Components, React 18 streaming SSR and Vite, chosen over static JAMStack approaches because commerce pages are inherently dynamic. Component-level data fetching replaced route loaders, and a preload cache hoists nested queries so they run in parallel instead of in network waterfalls. Removing bloated exported GraphQL fragments and adding a logger for unused query fields cut some demo store route load times in half. Rigid "magical" context-based components were dropped in favor of leaner primitives, and the team describes its early reverse-engineered RSC implementation and collaboration with the React, Vite, Vercel and Cloudflare teams.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Web performance](https://swe.quest/tags/web-performance.md) (Web & mobile)
- [GraphQL](https://swe.quest/tags/graphql.md) (Backend & APIs)
- [E-commerce](https://swe.quest/tags/ecommerce.md) (Domains)

## Prerequisites

- React components and hooks ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- server-side rendering
- GraphQL queries ([easy posts on GraphQL](https://swe.quest/tags/graphql.md?difficulty=easy))

## Keywords

Hydrogen, React Server Components, Vite, Shopify Storefront API, Tailwind CSS, Oxygen, React 18

## Related posts

- [Building Blocks of High Performance Hydrogen-powered Storefronts](https://swe.quest/articles/building-blocks-of-high-performance-hydrogen-powered-storefronts-c8500e9da77cf962.md): Shopify Engineering · 2021-11-08 · Easy · 7 min read · React, Web performance, Frontend, E-commerce, Caching
  Hydrogen, Shopify's React-based storefront framework, targets the tension between fast loading and personalized, dynamic commerce by combining React 18 streaming SSR with Suspense, React Server Components, cache-aware data fetching, and per-page edge caching.
- [Rapid Development with Hydrogen: Building a Product Page](https://swe.quest/articles/rapid-development-with-hydrogen-building-a-product-page-02ffb62bb6c7bb95.md): Shopify Engineering · 2022-02-02 · Medium · 5 min read · React, E-commerce, Frontend
  Hydrogen, Shopify's React-based storefront framework, can produce a working product display page quickly by composing its built-in commerce components and hooks.
- [Best-in-Class Developer Experience with Vite and Hydrogen](https://swe.quest/articles/best-in-class-developer-experience-with-vite-and-hydrogen-71158a029a23fe79.md): Shopify Engineering · 2022-03-31 · Easy · 8 min read · Build systems, Frontend, React, JavaScript, Developer productivity
  Shopify's Hydrogen storefront framework is built on Vite. Vite serves user code as native ES Modules and pre-bundles and caches only third-party dependencies, which speeds up dev-server startup and hot module replacement compared with bundle-based tools like Webpack.
- [React Server Components Best Practices You Can Use with Hydrogen](https://swe.quest/articles/react-server-components-best-practices-you-can-use-with-hydrogen-0db12dbc50e3b28e.md): Shopify Engineering · 2022-02-04 · Medium · 7 min read · React, Frontend, Web performance, E-commerce
  When building React Server Components applications, start every new component as a shared component, extract only the genuinely client-side pieces (interactivity, useState/useReducer, useEffect, browser APIs, RSC-incompatible libraries) into small .client components, and convert the rest to .server components whenever the code never needs to or should not run on the client.
- [A Gentle Introduction to Islands](https://swe.quest/articles/a-gentle-introduction-to-islands-51c545953d15b8b9.md): Deno · 2023-04-26 · Medium · 10 min read · Frontend, Web performance, JavaScript, TypeScript
  Islands architecture renders pages as static HTML and hydrates only isolated interactive Preact components, avoiding the whole-page, top-down hydration that ships framework JS even for static content.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
