Next.js Quickstart
There are two ways to start:- Start from Forward, the Weaverse Next.js starter theme. Everything below is already wired.
- Add Weaverse to an existing Next.js app, step by step.
Option A: Start from Forward
Forward is an open-source Next.js storefront on@weaverse/hydrogen/next. It uses Bun as package manager and Node.js 22.18 or later.
1
Create the project
.env with your project ID, and installs dependencies with Bun. If Bun is missing, it offers to install it (npm install -g bun); in a non-interactive run it stops with install instructions instead. Pass --no-install to skip installing.2
Add your Shopify keys
Hydrogen Sales Channel (Paid Shopify Plan)Create a storefront in the Hydrogen app and choose Set up CI/CD or manual deployments later.Back up Keep Forward always runs against a real Shopify store, and refuses to start without a complete Shopify environment.
my-storefront/.env somewhere private. From the my-storefront folder, link to the storefront you created, then pull its variables. Don’t use -f or --force.WEAVERSE_PROJECT_ID in .env. Fill in any secrets the pull leaves empty. If PUBLIC_STOREFRONT_API_TOKEN is missing or empty, add a public Storefront API token for the same store. You can get one from the Headless channel.The pull sets SHOP_ID and PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID. To use Customer Account, set all four account variables listed in .env.example. Otherwise, clear the two pulled values and leave the whole group empty.Headless Sales ChannelIn my-storefront/.env, set your store and its Storefront API keys from the Headless channel:.env.example documents every key, including the optional Customer Account ones. Never commit .env.If you’re already in my-storefront, skip cd my-storefront in the next step.3
Run it
http://localhost:3333.4
Open it in Studio
Open
https://studio.weaverse.io/projects/YOUR_PROJECT_ID and set the preview URL to http://localhost:3333.Option B: Add Weaverse to an existing Next.js app
This path assumes an App Router app that already reads from your Shopify store, typically through the Hydrogen SDK (npx @shopify/hydrogen@latest setup). Forward is a complete example of that setup.
1. Install
@weaverse/hydrogen 6.2.0 and later; this guide uses 6.5.0 (for isFallback). Import client and shared code from @weaverse/hydrogen/next and server-only code from @weaverse/hydrogen/next/server. From 6.3.0, @weaverse/hydrogen needs @shopify/hydrogen 2026.10.3 or later as a peer dependency, and from 6.4.0 also react, react-dom (19 or later) and react-router; install any your app doesn’t have yet.
2. Environment variables
3. Register components
A component is a schema plus a React component. Schemas are written exactly as for@weaverse/hydrogen; see Component schema and Input settings.
'use client' module. Section loaders run on the server, so they live in a server-only registry that carries the same schemas:
loader to a server entry to fetch data; see Data fetching.
Declare the theme schema once. It holds your theme settings, and later your markets and routes:
4. Create the server client helper
On React Router,@weaverse/hydrogen injects context.weaverse into every loader. In Next, your app creates the server client per request. A small helper plays that role:
5. Mount the root providers
Mount the Studio script connector and the root theme provider once, in the root layout:@weaverse/hydrogen/next components are Client Components that Server Components can render directly, and its server-safe exports (createSchema, generateDataFromSchema, the SEO helpers) work in server code. WeaverseRoot is a client module for a different reason: it imports the theme schema on the client, because a schema can hold functions that cannot cross from server to client. publicEnv is passed explicitly because a layout receives no search params; see Known limitations.
6. Render a page
WeaverseNextRenderer is a Client Component. Wrap it in one client boundary that rebuilds the request context from the payload, so Studio knows which route it is looking at:
7. Add the revalidation route
Studio posts here when a merchant changes a resource picker, to re-run only that section’s loader:8. Open it in Studio
Run your app, openhttps://studio.weaverse.io/projects/YOUR_PROJECT_ID, and set the preview URL to your dev server.
Next steps
Rendering pages
Product, collection, custom pages, metadata and sitemap.
Data fetching
Section loaders and caching.
Studio integration
How Studio connects and what it needs.
Deploy to Vercel
Ship your storefront.