API is the API version segment ('v1'), not a
complete endpoint URL.
The constructor checks the project ID, whatever throwPageLoadFailures is
set to: it throws a WeaverseError with code MISSING_PROJECT_ID
when none resolves (?weaverseProjectId=, the projectId argument or
WEAVERSE_PROJECT_ID), INVALID_PROJECT_ID for a malformed projectId,
and ASYNC_PROJECT_ID for an async projectId function, which must be
awaited before you create the client.
Create the client once per request in the app context, from the request’s
Hydrogen 2026.10 Storefront API client. createRequestStorefront,
createCustomerAccount, AppSession and resolveRequestLocale are app
code (see the v6 migration guide); server.ts copies the returned object
onto React Router’s context, so loaders read context.weaverse.
Constructor
Parameters
Returns
WeaverseClient
Properties
Type:
WeaverseProjectConfigsStable project configuration shared by page requests.Type:
FetchProjectRequestBodyStable request body fields shared by page requests.Type:
WeaverseComponentComponents registered for page rendering and component loaders.Background execution hook supplied by the runtime.
Methods
execComponentLoader()
Parameters
Returns
WeaverseComponentData
fetchCustomPages()
path, lastModified, changeFrequency, priority, plus locale,
market and scope, which tell global, locale and market assignments
apart), for sitemap and route generation. Paginates automatically. Rejects with a WeaverseLoadError when any
page of results cannot be loaded, so a sitemap route can answer 5xx
instead of serving a partial or empty sitemap that search engines cache.
The list is not filtered by publication state, so an entry is not proof
that the page is published. Apply your own publication policy before you
add a route to a public sitemap.
Parameters
Returns
CustomPageEntry
fetchWithCache()
strategy, not the Fetch API
cache property.
Hydrogen’s cache is skipped in design mode, in revision preview, and for
requests to the Weaverse public API proxy
(https://api.weaverse.io/api/public/... by default). The proxy owns the
freshness of Weaverse data, so strategy applies to third-party URLs and
to a self-hosted WEAVERSE_HOST that serves the API itself.
Parameters
Fetch options including optional cache strategy
Returns
Promise<T>
Promise resolving to the fetched data
generateFallbackPage()
Parameters
Returns
WeaversePageData
WeaversePageData with single main component containing the message
loadPage()
loadPage() resolves to:
- A page when one is assigned to the route.
- A fallback page with
isFallback: truewhen the project loads but no page is assigned to the route. It is notnull. Answer it with a 404 on the live storefront, but keep it in design mode, where the merchant builds on it in Studio. nullwhen the Weaverse API answers 404 (for example, the project does not exist), and, by default, when the load fails (invalid per-callprojectId, network error, timeout, error status or error body). The failure is logged.- The fallback page, by default, when the API answers 200 with a body that
is not a page envelope (for example
{}). - A rejection with a WeaverseLoadError instead of
nullfor a failed load when the client setsthrowPageLoadFailures: true.
locale is forwarded unchanged; when omitted, the request uses the
client’s locale argument, or storefront.locale. strategy takes effect
only when the page request goes through Hydrogen’s cache: requests to the
default Weaverse public API proxy skip it.
Parameters
Optional page loading parameters
Returns
WeaverseLoaderData
Promise resolving to page data or null on error
loadThemeSettings()
weaverseTheme from the root loader so
withWeaverse can initialize the theme settings and translation
stores. Read setting values from response.theme.
Parameters
Returns
WeaverseThemeSettingsResponse
Promise resolving to theme settings response