Skip to main content

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.
Both need a Weaverse project. Create one from the Weaverse app in your Shopify admin (see the React Router quickstart for the first two steps) and copy its Project ID.

Option A: Start from Forward

Forward is an open-source Next.js storefront on @weaverse/next. It uses Bun as package manager and Node.js 22.18 or later.
1

Clone the theme

2

Configure the environment

Copy .env.example to .env and fill in your store and project:
Forward always runs against a real Shopify store, and refuses to start without a complete Shopify environment. .env.example documents every key, including the optional Customer Account ones.
3

Run it

Open 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.
Scaffolding Forward with npx @weaverse/cli create is coming. Until then, clone the repository.

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

2. Environment variables

Only public values belong in publicEnv; it reaches the browser. Keep a private Storefront token on the server.

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.
Every registered component must spread the props the runtime passes (data-wv-id, data-wv-type, id, className) onto its outermost DOM element. A component that does not still renders, but Studio cannot outline, select or reorder it.
Next splits the registry in two. The renderer is a Client Component, so the components it renders live in a 'use client' module. Section loaders run on the server, so they live in a server-only registry that carries the same schemas:
The server registry imports the schema file, never the component, so the server graph never pulls in a Client Component. Add a 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:
Every field of requestContext matters to Studio. pageType and handle tell Studio which page it is editing, i18n is read when Studio binds its runtime, and url must be the real origin, not localhost.

5. Mount the root providers

Mount the Studio script connector and the root theme provider once, in the root layout:
Import @weaverse/next components (WeaverseNextRootProvider, WeaverseNextStudioConnect, WeaverseNextProvider, WeaverseNextRenderer) only from your own 'use client' modules. The published bundle carries no 'use client' directive, so rendering them directly in a Server Component such as app/layout.tsx fails.
The theme schema is imported in the client module rather than passed from the layout, 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:
Then load and render the page in a route:

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, open https://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.