Micro Frontends split a large frontend into independently developed and deployed apps. Combined with Vite and Module Federation, this approach enables fast builds, team autonomy, and scalable frontend architecture.
A Micro Frontend is an architectural pattern where each UI domain is built, tested, and deployed separately, then composed at runtime by a host application. This helps teams:
Module Federation allows one app to dynamically load modules from another app at runtime, while sharing dependencies like React to avoid duplication.
With Vite, this is enabled via:
@originjs/vite-plugin-federation
Host App└── loads → Remote Components (via remoteEntry.js)
npm create vite@latest host-app -- --template reactnpm create vite@latest todo-components -- --template reactnpm install
Expose reusable UI from the remote app:
Input.jsxList.jsxfederation({name: "todo-components",filename: "remoteEntry.js",exposes: {"./List": "./src/components/List.jsx","./Input": "./src/components/Input.jsx",},shared: ["react"],})
Build and serve:
npm run buildnpm run preview
federation({name: "host-app",remotes: {todo_components: "http://localhost:4173/assets/remoteEntry.js",},shared: ["react"],})
import Input from "todo_components/Input";import List from "todo_components/List";
Remote components now behave like local imports.