Skip to main content

@weaverse/next API Reference

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

@weaverse/next

Components and providers

Hooks

Studio and runtime

Loaders and revalidation

SEO

Both are also exported from @weaverse/next/server. See Rendering pages.

Translation

See Markets & translations.

Schema

The root entry re-exports all of @weaverse/schema, including createSchema, the input and schema types, IMAGES_PLACEHOLDERS and the validators. generateDataFromSchema(schema) extracts the default settings of a component or theme schema.

Types

@weaverse/next/server

Types: WeaverseNextServerClient, WeaverseNextServerClientConfig, WeaverseNextServerLoadPageInput, WeaverseNextThemeSettingsOptions, WeaverseNextThemeSettingsResponse, WeaverseNextConfigs, WeaverseNextBaseConfigs, WeaverseNextFetchOptions, WeaverseNextProjectId, WeaverseNextRevalidateHandler, WeaverseNextRevalidateHandlerConfig, WeaverseNextRevalidateRequestBody, WeaverseNextRevalidateRouteContext, plus the shared types above.

Server client config

Server client members

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.