Remote Components
Share client components from one app and render them inside another app's React tree.
Render a client component from a remote app inside your own React tree. It runs on the host's React, reads the host's context and takes any props, including functions and children.
Runnable example: examples/components-remote (shared context: examples/cart-context).
Next.js hosts server-render a remote component when its build is signed or pinned, and the browser hydrates it. Any other build, and every SPA host, renders it in the browser only. See Integrity.
Islands or remote components?
An island renders on the remote's server, and hydrates in the host page as its own React root. A remote component is client code that runs inside the host's React tree.
| Islands | Remote components | |
|---|---|---|
| React | The remote's own | The host's |
| Host React context | Does not cross in | Readable through shared modules |
| Props | Plain JSON | Anything a client component takes |
| Server rendering | Always, on the remote | On the host, for verified builds only |
| Remote code in the host process | Never | For verified builds |
| Remote build | Any server for the protocol | Vite or Rspack/webpack, Module Federation 2.0 |
Use islands when the remote must stay isolated or owns its data fetching. Use remote components for interactive pieces that must feel like part of the host.
Set up remote components
Build the remote
Expose client components with Vite or Rspack or webpack.
Sign the build
Set NF_COMPONENTS_SIGNING_KEY in the remote's build (Generate a signing key).
Configure the host
Add the remote to defineFederation and bind each component with createRemoteComponent (Host configuration).
Good to know: A Next.js app cannot be the remote. See Sharing from a Next.js app. Server rendering needs Node.js 20.16 or newer.
Next steps
Build a remote with Vite
Expose components with nextFederationComponents.
Build a remote with Rspack or webpack
Describe any Module Federation 2.0 build with nf-describe.
Host configuration
Trust policy, createRemoteComponent and descriptors per router.
Reference
Build output, runtime behaviour, limits and CSP.