Experiences SDK
Experiences SDK is currently available in alpha. It is published to npm. APIs are unstable and subject to change.
What it does
The Experiences SDK renders Experience Orchestration content in your application, with your own components. You register your design system’s components, and the SDK fetches an experience from the Experience Delivery API (XDA) and renders it with them.
The following features are included:
- Fetch and resolve:
fetchExperiencefetches an experience and resolves it into serializable data, with design tokens resolved and yourresolveDatafunctions run. - Server or client rendering:
ServerExperienceRendererrenders on the server, including in React Server Components.ClientExperienceRendererrenders in the browser. - Bring your own components: Register your existing components by the IDs authored in Contentful. They receive content and design values as ordinary props.
- Draft content and live preview: Fetch unpublished changes, or show unsaved canvas edits as they happen.
- Framework adapters: React, Svelte, and Angular adapters, plus building blocks for other frameworks.
How it works
- Register your components in a configuration object, keyed by the component IDs authored in Contentful.
- Fetch the experience with
fetchExperience. It returns the resolved experience as plain data you can pass from the server to the client. - Render the experience with a renderer, which renders each node with your registered component and its merged props.
Packages
Install the adapter for your framework. It exports everything you need: the delivery client, the resolver, the renderers, the types, and the design utilities.
Next steps
- Get started to go from an empty Next.js project to a rendered experience.
- Register components, fetch experiences, and render experiences for each step in detail.
- Style components from design properties and design tokens.
- Errors and debugging for diagnostics and fallbacks.
- Set up live preview to show canvas changes on your website before saving.
- Other frameworks if your framework has no adapter.
- Repository: Source, examples, and issue tracker.