> ## Documentation Index
> Fetch the complete documentation index at: https://weaverse.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Weaverse component configuration uses `settings`. `inspector` is deprecated; never generate it.
> Weaverse Hydrogen themes use React Router v7: import from `react-router`, never `react-router-dom` or `@remix-run/*`.
> Before using any code sample, read `@weaverse/hydrogen` in the project's `package.json`: 6.x and 5.x import from different entries and use different type names, so code for one does not build on the other.
> `@weaverse/hydrogen` 6 (Shopify Hydrogen 2026.10 and later, the version these docs show) imports from `@weaverse/hydrogen/react-router` and uses `Weaverse*` types such as `WeaverseComponentProps`, `WeaverseComponentLoaderArgs` and `WeaverseComponentSchema`; the root `@weaverse/hydrogen` entry only exports `createSchema()`, data helpers and types.
> `@weaverse/hydrogen` 5.x (Hydrogen 2026.4 and earlier) imports everything from `@weaverse/hydrogen` and uses `HydrogenComponentProps`, `ComponentLoaderArgs` and `HydrogenComponentSchema`. On a 5.x project, convert samples to these names. Upgrade to 6 only when asked (`npx @weaverse/cli@latest migrate v6`, plus the Hydrogen 2026.10 upgrade). Do not mix major versions.
> Next.js themes use `@weaverse/hydrogen` 6.2.0 or later: import client and shared code from `@weaverse/hydrogen/next` and server-only code from `@weaverse/hydrogen/next/server`. `@weaverse/next` is deprecated; never install or import it.
> For live project data (pages, theme settings, translations), use the Weaverse MCP server: https://weaverse.io/docs/developer-tools/weaverse-mcp

# @weaverse/hydrogen/next API Reference

> Every export of @weaverse/hydrogen/next and @weaverse/hydrogen/next/server.

# @weaverse/hydrogen/next API Reference

The Next.js adapter ships in `@weaverse/hydrogen` (install `@weaverse/hydrogen`) and has two entry points:

| Import | Use in | Purpose |
| - | - | - |
| `@weaverse/hydrogen/next` | Server and Client Components | Registry types, providers, renderer, hooks, Studio connection, translation, schema helpers |
| `@weaverse/hydrogen/next/server` | Server only | The Weaverse API client and the revalidation route handler |

Server code lives under `@weaverse/hydrogen/next/server` so a Client Component can import the root entry without pulling server-only fetch code into the browser bundle.

The root entry is safe in Server Components: its components, hooks and runtime are Client Components (render them, don't call them on the server), and its schema helpers run as ordinary server functions.

> [!NOTE]
>
> `@weaverse/next` is deprecated. Its root and `/server` entries exported more than `@weaverse/hydrogen/next` does: the page, root and commerce data hooks, the lower-level Studio runtime, loader and revalidation helpers, the `ThemeText*` aliases, and the server config and page URL helpers. Only the exports listed on this page are available.

## `@weaverse/hydrogen/next`

### Components and providers

| Export | Description |
| - | - |
| `createWeaverseNextClient(config)` | Client-side runtime state: registers render components and carries the request, page and theme context. |
| `WeaverseNextProvider` | Provides a client created with `createWeaverseNextClient` to the renderer. Adopts the root theme store when one is mounted above it. |
| `WeaverseNextRenderer` | Renders a Weaverse page tree and binds the Studio runtime. |
| `WeaverseNextRootProvider` | Mount once in `app/layout.tsx`. Owns the theme settings store and translation store for the whole app. Props: `initialThemeSettings`, `themeSchema`, `publicEnv`, `staticContent`, `merchantOverrides`, `t`. |

### Hooks

| Export | Description |
| - | - |
| `useThemeSettings()` | Live theme settings; re-renders on Studio edits. See [useThemeSettings](https://weaverse.io/docs/nextjs/api/use-theme-settings.md). |
| `useWeaverse()` | The Weaverse runtime. See [useWeaverse](https://weaverse.io/docs/nextjs/api/use-weaverse.md). |
| `useItemInstance()` | The current item instance. See [useItemInstance](https://weaverse.io/docs/nextjs/api/use-item-instance.md). |
| `useParentInstance()` | The parent item instance. See [useParentInstance](https://weaverse.io/docs/nextjs/api/use-parent-instance.md). |
| `useChildInstances()` | The child item instances. See [useChildInstances](https://weaverse.io/docs/nextjs/api/use-child-instances.md). |
| `useStudioSelection()` | The current Studio selection, for example `selectedThemeGroup`. |
| `isBrowser`, `isIframe` | Environment checks. |

### Studio

| Export | Description |
| - | - |
| `WeaverseNextStudioConnect` | Loads the Studio bridge script in design and preview contexts; does nothing in published mode. Mount once in the root layout. |
| `buildWeaverseNextRequestInfo()` | Builds the request info Studio reads. |

### Translation

| Export | Description |
| - | - |
| `useTranslation()` | Returns `t(key, variables?)` for theme copy, resolving external `t`, then Studio's live edits, then the market's overrides, then `staticContent`, then the key. |
| `TranslationProvider` | Provides translation sources below the root. |
| `TranslationStore` | The live design-mode translation store. |
| `createTranslate()`, `getNestedKey()`, `interpolate()` | The translation helpers behind `t`. |

See [Markets & translations](https://weaverse.io/docs/nextjs/markets-translations.md).

### SEO

| Export | Description |
| - | - |
| `getWeaverseNextSeoMetadata(data)` | Maps a page's Weaverse SEO to a Next `Metadata` object. |
| `formatWeaverseNextSeoMetadata(seo)` | Formats a raw SEO object into Next `Metadata`. |

Both are also exported from `@weaverse/hydrogen/next/server`. See [Rendering pages](https://weaverse.io/docs/nextjs/rendering-pages.md#seo-metadata).

### Schema and errors

| Export | Description |
| - | - |
| `createSchema()` | Defines a component schema. |
| `IMAGES_PLACEHOLDERS` | Placeholder images for schema defaults. |
| `generateDataFromSchema(schema)` | Extracts the default settings of a component or theme schema. |
| `WeaverseError`, `WeaverseLoadError` | Error classes thrown by the SDK. |

### Types

| Type | Description |
| - | - |
| `WeaverseNextComponent` | A registry entry: `default` (component), `schema`, optional `loader`. |
| `WeaverseNextComponentProps`, `WeaverseNextComponentData`, `WeaverseNextComponentLoaderArgs` | Component props, item data and loader arguments. |
| `WeaverseNextLoaderData` | What `loadPage()` returns and `WeaverseNextRenderer` renders. |
| `WeaverseNextRequestContext`, `WeaverseNextRequestInfo` | Route identity: URL, pathname, search params, page type, handle, i18n, design flags. |
| `WeaverseNextThemeSchema`, `WeaverseNextThemeSchemaGroup`, `WeaverseNextThemeSchemaInput`, `WeaverseNextI18n` | Theme schema, a settings group, and a market. |
| `WeaverseNextCommerceContext`, `WeaverseNextStorefront` | The commerce context passed to the server client. |
| `WeaverseNextClient`, `WeaverseNextClientConfig` | The client returned by `createWeaverseNextClient` and its config. |
| `WeaverseNextLoadPageInput`, `WeaverseNextPageData`, `WeaverseNextPageAssignment` | Page loading input and page data. |
| `WeaverseNextProviderProps`, `WeaverseNextRendererProps`, `WeaverseNextRootProviderProps`, `WeaverseNextStudioConnectProps` | Component props. |
| `TranslationProviderProps`, `TranslationValue`, `TranslateFunction`, `CreateTranslateSources` | Translation types. |
| `WeaverseNextSeoInput`, `WeaverseNextSeoMetadata`, `WeaverseNextSeoPageContainer`, `NextOpenGraph`, `NextTwitter` | SEO helper input and output types. |
| `StudioSelection` | What `useStudioSelection()` returns. |
| `BasicInput`, `InspectorGroup`, `PageType`, `SchemaType` | Schema types. |
| `WeaverseProduct`, `WeaverseCollection`, `WeaverseBlog`, `WeaverseMetaObject` | Resource picker values. |

## `@weaverse/hydrogen/next/server`

| Export | Description |
| - | - |
| `createWeaverseNextServerClient(config)` | The request-scoped Weaverse API client. Create it per request; see below. |
| `createWeaverseNextRevalidateHandler({ getClient })` | Creates the `POST` handler for per-item revalidation. `getClient(request, requestContext)` receives the validated route context. See [Studio integration](https://weaverse.io/docs/nextjs/studio.md#per-item-revalidation). |
| `getWeaverseNextSeoMetadata()`, `formatWeaverseNextSeoMetadata()` | SEO helpers, as above. |

Types: `WeaverseNextServerClient`, `WeaverseNextServerClientConfig`, `WeaverseNextServerLoadPageInput`, `WeaverseNextThemeSettingsOptions`, `WeaverseNextThemeSettingsResponse`, `WeaverseNextConfigs`, `WeaverseNextBaseConfigs`, `WeaverseNextCacheConfig`, `WeaverseNextFetchOptions`, `WeaverseNextCustomPageEntry`, `WeaverseNextFetchCustomPagesOptions`, `WeaverseNextProjectId`, `WeaverseNextRevalidateHandler`, `WeaverseNextRevalidateHandlerConfig`, the SEO types (`WeaverseNextSeoInput`, `WeaverseNextSeoMetadata`, `WeaverseNextSeoPageContainer`, `NextOpenGraph`, `NextTwitter`), plus the shared types above.

### Server client config

| Option | Description |
| - | - |
| `components` | Required. The server registry: schemas and loaders. |
| `projectId` | Project id, or a function returning it. Falls back to `WEAVERSE_PROJECT_ID`. |
| `weaverseHost` | Studio host. Falls back to `WEAVERSE_HOST`, then `https://studio.weaverse.io`. |
| `env` | Environment object the SDK reads its keys from. |
| `requestContext` | The route identity of this request. |
| `themeSchema` | Your theme schema, for theme settings defaults and Studio. |
| `commerce` | Commerce context passed to loaders (for example a Storefront client). |
| `cache` | `{ revalidate, tags }` for published reads. |
| `fetch`, `fetchTimeoutMs` | Custom fetch and timeout. |

### Server client members

| Member | Description |
| - | - |
| `loadPage({ type, handle? })` | Fetches the page, runs component loaders, and returns `WeaverseNextLoaderData`. |
| `loadThemeSettings()` | Fetches theme settings merged over schema defaults. Returns `theme`, `schema`, `staticContent`, `publicEnv` in design mode, and `merchantOverrides` when the theme declares `i18n` and the request carries a language and country. |
| `fetchCustomPages(options?)` | Lists published custom pages for a sitemap, paginating automatically. |
| `fetchWithCache(url, options?)` | Next-aware fetch: `no-store` in design and revision preview, `next: { revalidate, tags }` in published mode. |
| `projectId`, `resolveProjectId()` | The project id; `resolveProjectId()` resolves it asynchronously (query, function, string, env). |
| `components` | The server registry. |
| `commerce`, `storefront` | The commerce context; `storefront` is an alias for Pilot-style loaders. |
| `requestContext` | URL, headers, search params, i18n and design/preview flags. |
| `configs` | The resolved configuration. |

### Config resolution

* **Project id**: `?weaverseProjectId=` → `projectId` function → `projectId` string → `WEAVERSE_PROJECT_ID`.
* **Studio host**: trusted `?weaverseHost=` (`https://*.weaverse.io`, `https://*.weaverse.dev`) → `WEAVERSE_HOST` → `https://studio.weaverse.io`.
* **API base**: trusted request host → `WEAVERSE_PUBLIC_API_BASE` → non-production `WEAVERSE_HOST` → `https://api.weaverse.io`.
* **Public env**: `PUBLIC_STORE_DOMAIN`, `PUBLIC_STOREFRONT_API_TOKEN`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.