Skip to main content
This guide adds Weaverse to an existing Shopify Hydrogen storefront on Hydrogen 2026.10 with @weaverse/hydrogen 6. Once it’s in, merchants build pages visually in Weaverse Studio, edit theme settings, and use the sections you register.
Pick the guide that matches your project. Check package.json (or run npm ls @shopify/hydrogen):A 2026.10 project has a server.ts that composes the request lifecycle with handleShopifyRoutes(), and queries Shopify with storefront.graphql(). If yours still calls createHydrogenContext() or storefront.query(), it is classic Hydrogen.
Every sample on this page is trimmed from Pilot, Weaverse’s reference theme on Hydrogen 2026.10.3. // ... marks omitted code. When a sample and Pilot disagree, Pilot main wins.

Prerequisites

  • A Hydrogen 2026.10 storefront that runs locally (@shopify/hydrogen ^2026.10.3, React Router 7.18 or later 7.x, Vite 8).
  • Node.js ^22.18.0 || ^24.11.0, the range Pilot’s engines field allows.
  • A Weaverse account and a Weaverse project for the storefront.
  • @shopify/cli 4.4.0 or later as a dev dependency if you deploy to Oxygen (Step 10).

Step 1: Install the SDK

@weaverse/hydrogen 6.5.1 has @shopify/hydrogen >=2026.10.3, react and react-dom >=19, and react-router ^7 || ^8 as peer dependencies (React, React DOM and React Router became peers in 6.4.0; @shopify/hydrogen and react-router are optional from 6.5.1, but a Hydrogen theme installs both), and depends on exactly @weaverse/react 6.5.1 (which pins @weaverse/core 6.5.1) and @weaverse/schema 0.20.1. You don’t need to install those yourself: a theme imports everything through the @weaverse/hydrogen entries. Remove @weaverse/react and @weaverse/core from your package.json if it lists them; if you really need one directly, pin it to the exact version your @weaverse/hydrogen depends on. Two copies of @weaverse/react have separate React contexts, and components stop finding their data. @weaverse/next is deprecated and no longer a dependency; remove it. Hydrogen themes import everything from one entry point:
The bare @weaverse/hydrogen entry holds schemas, data helpers and types without React or a router; you don’t need it in a Hydrogen theme.

Step 2: Configure Environment Variables

Add your project ID to .env:
The Project ID is in your Weaverse project settings. On Oxygen, add the same variables to the storefront’s environment. Hydrogen 2026.10 no longer ships HydrogenEnv, so env.d.ts lists every variable your theme reads. Extend the SDK’s WeaverseEnv, which declares the Weaverse variables:

Step 3: Add the Weaverse Files

Create app/weaverse/. It holds the theme schema, the component registry, the global styles and the content renderer.

Theme Schema (app/weaverse/schema.server.ts)

The theme’s metadata, the global settings shown under Theme > Customize in Studio, and the i18n configuration:
DEFAULT_LOCALE and SUPPORTED_LOCALES are your market list (Pilot’s lives in app/utils/locale.ts). Pilot also sets translation: true and staticContent in i18n to turn on the Translation Manager, and keeps one file per settings group under app/weaverse/settings/.

Component Registry (app/weaverse/components.ts)

Every component Studio can place, each a module that exports a default component and a schema (and optionally a loader):
See Creating Components to write them.

Global Styles (app/weaverse/style.tsx)

Turns theme settings into CSS variables:

Content Renderer (app/weaverse/index.tsx)

WeaverseContent renders the page a route loaded. validateWeaverseData turns a missing page into a 404, except in Studio’s design mode, where the editor needs the fallback page to start from:

Step 4: Create the WeaverseClient in the App Context

Hydrogen 2026.10 has no createHydrogenContext(). Your app builds the per-request values itself, usually in app/.server/context.ts, and server.ts puts them on React Router’s context. Add a WeaverseClient built from the request’s Storefront client:
createRequestStorefront, resolveRequestLocale and AppSession are app code: Pilot’s live in app/.server/storefront.ts and app/.server/session.ts, and Step 4 of the v6 migration guide walks through them. If your project already creates its Storefront client with createStorefrontClient(), pass that client; WeaverseClient only needs it per request. WeaverseClient arguments:

The locale Option

Weaverse uses the request’s market for the locale it sends with page requests, the Translation Manager overrides it loads (keyed by ${language}-${country}, lowercased), and the requestInfo.i18n Studio reads. Without locale, it takes all three from storefront.locale. Pass locale when the Storefront client’s locale.language is a Shopify LanguageCode that differs from the market’s public language. A Traditional Chinese Hong Kong market sends ZH_TW to Shopify; given to Weaverse, it asks for zh_tw-hk translations, which match nothing and silently fall back to the theme defaults. The value is a WeaverseI18n (language, country, and optional pathPrefix, label and other market fields); include pathPrefix, which Weaverse passes to Studio. Pilot passes resolveRequestLocale(request), the request’s entry from its market list. weaverse.storefront stays the request’s own client, so Shopify keeps receiving ZH_TW. If storefront.locale already carries the public language and the pathPrefix, leave locale out.

Step 5: Wire the Request Lifecycle in server.ts

In Hydrogen 2026.10, server.ts owns the request: it builds the context, lets Hydrogen’s handlers answer the routes they own, renders the app with React Router, and finishes the response. Weaverse only needs the context it puts on React Router to include weaverse. If your server.ts already copies the app context onto RouterContextProvider, adding weaverse to createAppContext() is enough. Pilot’s server.ts, trimmed:
  • Object.assign(new RouterContextProvider(), appContext) keeps React Router’s context instance and adds your values to it. Don’t spread it into a plain object.
  • handleShopifyRoutes decides synchronously: it returns a Promise<Response> for a path one of its handlers owns, and null otherwise.
  • routeTemplates comes from defineShopifyRouteTemplates() (app/utils/route-templates.ts in Pilot, which still calls it by its deprecated alias createShopifyRouteTemplates). Both it and applyResponseHeaders() fail silently when missing.
  • Pilot’s full server.ts adds its own cart, predictive search and Customer Account handlers, market-aware redirects and an HTTPS fix for tunnels. See Step 3 of the v6 migration guide.

Step 6: Cache Explicitly

Hydrogen 2026.10 has no default cache: a storefront.graphql() call without cache hits the Storefront API on every request. Pilot keeps its strategies in app/utils/cache.ts:
Pass one on every query, in routes and in section loaders alike:
graphql() returns { data, errors } and doesn’t throw on GraphQL errors; Pilot’s unwrapStorefront() (app/utils/storefront.ts) throws instead, so a failed query reaches the route’s error boundary. See Data Fetching for query patterns. By default Weaverse reads pages and theme settings from its public API proxy (https://api.weaverse.io), which caches them at the edge and owns their freshness. WeaverseClient sends those requests straight to the proxy, without the cache you gave it, so a strategy on loadPage() or loadThemeSettings() has no effect on them. Studio’s design mode and revision preview also skip the local cache. The cache you gave WeaverseClient is used for everything else that goes through weaverse.fetchWithCache(): third-party APIs in section loaders (weaverse.fetchWithCache(url, { ...init, strategy }), which replaces v5’s weaverse.withCache), and Weaverse reads when a self-hosted WEAVERSE_HOST serves the API itself. There a response is fresh for 60 seconds, then served stale for up to a day while it revalidates, unless you pass a strategy such as CACHE_LONG. Pilot also sets Cache-Control per route with export const headers = routeHeaders from the same file, and keeps loaders free of per-shopper data so Oxygen can cache whole documents.

Step 7: Own the Content Security Policy

Hydrogen 2026.10.3 and later export createContentSecurityPolicy({ shop, directives, nonce }); @weaverse/hydrogen 6.3.0 and later export getWeaverseStudioCspDirectives(request), which returns the sources Weaverse Studio needs on Studio requests and {} for everyone else. Hydrogen 2026.10 has no NonceProvider or useNonce, so drop them along with any copied app/utils/csp.ts. Keep your theme’s sources in app/weaverse/csp.ts and append Studio’s to them:
Build the header in app/entry.server.tsx. Pilot passes nonce: false so Oxygen’s full-page cache can store the HTML:
context.env is typed because RouterContextProvider extends AppContext (Step 2). entry.client.tsx needs no CSP code, and the root route renders <Scripts />, <ScrollRestoration /> and <ShopifyScripts> without a nonce. See Content Security Policy for each source and for rolling out an enforced policy.

Step 8: Wrap the Root Layout and Load Theme Settings

Weaverse wraps the component that renders the HTML document, which is the Layout export. The root loader must return the theme settings as weaverseTheme: withWeaverse and useThemeSettings() read them from the root route’s data.
  • Wrap Layout, not the default App export. Wrapping App leaves the Weaverse providers below the document, so theme settings and Studio’s design mode don’t initialize.
  • withWeaverse takes no component list; WeaverseContent renders the registered components.
  • Pilot’s root loader passes the theme through localizedThemePayload() and neutralThemeWhenUnavailable() before returning it, and answers no-store when the settings failed to load (app/.server/root.ts and app/weaverse/load-failure.ts). Start with the plain call and add those when you need them.

Step 9: Load Weaverse Pages in Your Routes

Hydrogen 2026.10 has no hydrogenRoutes(); app/routes.ts exports the route array directly. Add a catch-all so pages created in Studio resolve at any handle:
Pilot also wraps these routes in layout routes that answer 404 for unsupported market prefixes; see Markets in the v6 migration guide. In each route Weaverse should drive, load the page with context.weaverse.loadPage() and render <WeaverseContent />. The homepage, from Pilot:
A product page loads the Weaverse page next to the product, in parallel:
Pilot’s product route also wraps <WeaverseContent /> in Hydrogen’s ProductProvider, so every section shares one variant selection; see Step 9 of the v6 migration guide. WeaverseContent renders the page you loaded with the components from components.ts.

Step 10: Run, Connect and Deploy

  1. Start the dev server: npm run dev. Pilot’s script is vite dev --port 3456; use the URL your terminal prints.
  2. Open Weaverse Studio: go to your project at studio.weaverse.io.
  3. Set the Preview URL to your local dev server.
Your storefront now loads in the Weaverse editor. Check that sections render, theme settings apply, and the browser console shows no CSP violations. To deploy to Oxygen, build, then point Shopify CLI at the build output:
Pilot keeps the second command as its deploy script, with buildDirectory: "dist" in react-router.config.ts. The flags need @shopify/cli 4.4.0 or later. See Deploy to Oxygen.

Next Steps

Create Custom Components

Build React components that merchants can edit in Weaverse.

Data Fetching

Query Shopify from section loaders with gql() and an explicit cache.

WeaverseClient Reference

Every argument and method of the server-side client.

v6 Migration Guide

Move a classic Hydrogen storefront to Hydrogen 2026.10 and Weaverse 6.
Last modified on November 26, 2026