Integration Shape

- Put
FanfareProvider,ExperienceWidget, anduseExperienceJourneyin client-only code. - Use environment variables that are safe for the browser, such as
NEXT_PUBLIC_FANFARE_PUBLISHABLE_KEY. - Keep grants out of URLs and third-party telemetry.
- Let the server validate the handoff before protected checkout actions.
Next.js App Router
Create a small client provider.checkoutUrl instead of onGranted when simple browser navigation is enough.
Custom Client UI
For a custom SSR page, keep the server-rendered shell stable and branch onJourneyView only after the client component mounts.
Remix And Nuxt
The same boundary applies in other SSR frameworks:- Load product and routing data on the server.
- Mount Fanfare in browser-only code.
- Import
@fanfare-io/fanfare-sdk-react/stylesonce for React surfaces. - Use the core SDK or web components when React is not part of the client island.
Server Handoff
Your admission endpoint should accept the grant from your own page and prepare the next trusted step.Testing SSR Integrations
- Confirm the page renders without accessing browser-only APIs on the server.
- Confirm the client boundary hydrates and renders a public journey state.
- Test admitted handoff through your own API route.
- Repeat with a returning browser session.
- Keep assertions based on visible states and app-owned side effects.