- URL query parameter:
?weaverseProjectId=...(design mode, preview mode) - Function result (if function provided)
- Explicit string value (if string provided)
- Environment variable:
WEAVERSE_PROJECT_ID(Hydrogen env or process.env) - Empty string (triggers validation error in methods)
- Must return non-empty string
- Can access request via closure for routing decisions
- Evaluated once per WeaverseClient instance (request-scoped)
- Async functions must be awaited before passing to constructor
- Should handle edge cases (missing headers, invalid domains, etc.)
Properties
Hydrogen cache instance for content caching, such as the worker’s
caches.open('hydrogen-v1'). Cache keys include the project ID.Type:
WeaverseComponentReact components registered with Weaverse CMS.
Each component must have a schema defining its properties and settings.Customer Account API client, when the storefront has one. Weaverse only
passes it through to section loaders.
Fetch timeout in milliseconds for API requests.
Defaults to 10000ms (10 seconds) if not specified.
Useful for adjusting based on network conditions or deployment environment.
The market this request serves, as Weaverse identifies it. It selects the
Translation Manager overrides (
${language}-${country}, lowercased), the
locale sent with page requests and the requestInfo.i18n Studio reads,
so include pathPrefix. Pass it when the storefront’s locale.language is
a Shopify LanguageCode that differs from the market’s public language,
such as ZH_TW for a Traditional Chinese Hong Kong market.Project identifier for loading content from Weaverse CMS.Value Types:
- Static string: ‘project-123’ (existing usage)
- Synchronous function: () => determineProject(request)
async function, or one that returns a promise, makes the constructor
throw a WeaverseError with code ASYNC_PROJECT_ID, even though the
type lists () => Promise<string>: resolve the ID first and pass the
result, for example projectId: await resolveProjectId(request). When no
project ID resolves (?weaverseProjectId=, this argument or
WEAVERSE_PROJECT_ID), the constructor throws MISSING_PROJECT_ID; a
malformed value throws INVALID_PROJECT_ID. Both happen whatever
throwPageLoadFailures is set to.Backward Compatibility:- Optional parameter (defaults to environment variable)
- Existing code without projectId continues to work unchanged
Incoming HTTP request object from React Router loader.
Provides access to URL, headers, cookies for dynamic routing decisions.
Request-scoped Hydrogen Storefront API client. Section loaders reach it
as
weaverse.storefront; its locale selects the content locale unless
WeaverseClientArgs.locale is given.Theme schema defining global theme settings (colors, fonts, layouts).
Used to generate default theme configuration and validate theme data.
Reject
loadPage() with a WeaverseLoadError when the page cannot
be loaded, instead of resolving to null.With the default (false), an unavailable API, an invalid response and a
configuration failure all resolve to null, the same value a missing
project produces, so a route cannot tell an outage from a 404. Enable this
to answer failures with a retryable or configuration error response while
genuine absence keeps resolving to null or a fallback page.