Welcome to next-federation
Runtime UI federation for Next.js. A remote app provides UI that your host app renders at runtime.
Embed UI that another team builds and deploys on its own into your Next.js app, without rebuilding the host.
A remote app provides UI that your host renders at runtime. Embed server-rendered islands, or load client components through Module Federation 2.0 into your host's React tree. The library calls only public Next.js APIs.
Get started
Pick the host you are building.
Next.js App Router
Embed islands with RemoteIsland in Server Components.
Next.js Pages Router
Use getIslandProps and RemoteIsland in pages.
Client-side React (SPA)
A Vite app with no server.
Build a remote
Writing an island remote
A Vite app that serves server-rendered islands.
Remote components
Client components that run in the host's React tree.
Sharing components from a Next.js app
Add an island build next to an existing Next.js app.
Main features
Identity
Private islands, signing keys and key rotation.
Server Actions in islands
'use server' functions that run on the remote.
Caching
Islands with static pages, ISR and cacheComponents.
Content Security Policy
The directives a host needs for remote origins.
Migrating from nextjs-mf
A concept map from @module-federation/nextjs-mf.
Deployment
Serving remotes, compression and CORS.
Reference
Architecture
How islands and remote components work.
Limits
What islands and remote components cannot do, and what they cost.
Island protocol v1
The wire contract between a host and a remote.
Error codes
Every NF-001 and up code, with how to fix it.
Live demo
Three hosts and two remotes to try.
Examples
Runnable remotes and hosts, and a larger multi-remote setup.
For contributors
- CONTRIBUTING.md: setup and the pull request process.
- AGENTS.md: repo map, commands and the rules every change keeps.
- Code conventions, Documentation style and Releasing.
- Maintainer notes and Live demo setup.