qiankun(乾坤)
August 11, 2026 · View on GitHub
Documentation · Quick start · Live examples · Roadmap
English · 简体中文
qiankun(乾坤)
Warning
🚧 qiankun 3.0 is currently under active development — check out the Roadmap for details. Looking for qiankun 2.x? Its documentation lives at v2.qiankun.umijs.org.
In Chinese,
qian(乾)means heaven andkun(坤)earth.qiankunis the universe.
Qiankun enables you and your teams to build next-generation and enterprise-ready web applications leveraging Micro Frontends. It is inspired by and based on single-spa.
🤔 Motivation
A quick recap about the concept of Micro Frontends:
Techniques, strategies and recipes for building a modern web app with multiple teams using different JavaScript frameworks. — Micro Frontends
Qiankun was birthed internally in our group during the time web app development by distributed teams had turned to complete chaos. We faced every problem micro frontend was conceived to solve, so naturally, it became part of our solution.
The path was never easy, we stepped on every challenge there could possibly be. Just to name a few:
- In what form do micro-apps publish static resources?
- How does the framework integrate individual micro-apps?
- How to ensure that sub-applications are isolated from one another (development independence and deployment independence) and runtime sandboxed?
- Performance issues? What about public dependencies?
- The list goes on long ...
After solving these common problems of micro frontends and lots of polishing and testing, we extracted the minimal viable framework of our solution, and named it qiankun, as it can contain and serve anything. Not long after, it became the cornerstone of hundreds of our web applications in production, and we decided to open-source it to save you the suffering.
TLDR: Qiankun is probably the most complete micro-frontend solution you ever met🧐.
✨ Features
Qiankun inherits the fundamentals of single-spa — independent deployment, lazy loading, and a technology-agnostic host that never dictates a micro app's stack — and adds the pieces a real product needs:
- 📄 HTML entry — point qiankun at a URL, not a manifest of assets. The entry is streamed into the live document as it arrives, so a micro app starts rendering before its HTML has finished downloading.
- 🧳 JS sandbox — every micro app runs against a Proxy-membrane view of
windowanddocument, so globals, timers, listeners and dynamic DOM stay inside the app and are reclaimed on unmount. On by default. - 📦 Native ESM —
<script type="module">micro apps execute as real modules, routed through the membrane with dynamically injected import maps. Dynamicimport()works, and so does a Vite dev server. - 🛡 Style isolation — opt-in runtime scoping built on the CSS
@scopeat-rule, including external stylesheets. No rewriting your CSS, no Shadow DOM tax. - ⚡ Prefetch — warm a micro app's assets while the user is still elsewhere, so the switch feels instant.
- 🧩 UI bindings —
<MicroApp />components for React and Vue, with loader and error-boundary slots, so a micro app is just another component. - 🔧 Bundler plugins — one plugin for webpack 4/5 and Vite that marks the entry script and fixes the output library, replacing the boilerplate you used to hand-write.
- 🔬 Standalone sandbox —
@qiankunjs/sandboxis usable on its own to contain any third-party script, with no micro-frontend framework attached.
🚀 Getting started
Note
v3 ships under the rc tag while latest still points at 2.x. Install with an explicit @rc to get it.
The fastest path is the agent skill — install it, then ask your coding agent (Claude Code, Cursor, …) to scaffold a host or a micro app wired up correctly:
npx skills add umijs/qiankun
Or add qiankun to an existing host application:
npm i qiankun@rc
Load a micro app into any container element, and keep the returned handle to unmount it:
import { loadMicroApp } from 'qiankun';
const microApp = loadMicroApp({
name: 'react-app',
entry: '//localhost:7100',
container: document.getElementById('subapp-container'),
});
// when this part of the page goes away:
await microApp.unmount();
If a micro app's activation is fully determined by the URL, the route-driven registerMicroApps + start APIs are the alternative orchestration model.
A micro app only has to export the three lifecycle hooks:
let root;
export async function bootstrap() {}
export async function mount(props: { container: HTMLElement }) {
root = render(props.container);
}
export async function unmount() {
root.unmount();
}
That is the whole contract. See the quick start for the bundler configuration each stack needs.
💿 Examples
Every example is deployed and browsable at examples.qiankunjs.com — two host shells (React and Vue) mounting the same four micro apps, each running with the JS sandbox and style isolation on, plus a standalone sandbox lab. Every app carries an "isolation lab" that demonstrates what the sandbox actually contains: globals, leaked timers, and injected styles. The shells switch between English and 简体中文, and the choice travels to the micro apps as a prop — they re-render through the update lifecycle rather than remounting.
To run them locally:
git clone https://github.com/umijs/qiankun.git
cd qiankun
pnpm install
pnpm start:example
This builds the workspace packages and starts every app in parallel — open http://localhost:7099 for the React shell or http://localhost:7105 for the Vue one. See examples/README.md for what each app demonstrates.

📦 Packages
| Package | Version (click for changelogs) | Description |
|---|---|---|
| qiankun | The framework: registerMicroApps, loadMicroApp, start, prefetch | |
| @qiankunjs/loader | Streaming HTML-entry loader | |
| @qiankunjs/sandbox | JS sandbox — usable standalone | |
| @qiankunjs/shared | Asset transpilers, fetch utilities, ESM-sandbox engine | |
| @qiankunjs/single-spa | Vendored single-spa fork the framework builds on | |
| @qiankunjs/react | <MicroApp /> for React | |
| @qiankunjs/vue | <MicroApp /> for Vue | |
| @qiankunjs/ui-shared | Shared internals of the UI bindings | |
| @qiankunjs/bundler-plugin | webpack 4/5 and Vite plugins for micro apps |
📖 Documentation
Full documentation lives at www.qiankunjs.com (English and 简体中文):
- Quick start — a running micro-frontend in five minutes
- Cookbook — style isolation, sandbox plugins, error handling, performance
- API reference — every option, typed
- FAQ — the questions that come up most
Design decisions are recorded as RFCs under docs/rfcs.
🎯 Roadmap
qiankun 3.0 is under active development. The plan, and the discussion around it, is in the 3.0 Roadmap.
🤝 Contributing
Issues and pull requests are welcome. The repository is a pnpm monorepo that requires Node ^22.15 || >=24 and pnpm@11:
pnpm install # install every workspace package
pnpm run build # build packages and examples
pnpm run test # unit tests (vitest, no build needed)
pnpm run test:e2e # end-to-end tests (Playwright, against built output)
pnpm run ci # what CI runs: build + eslint + prettier
Commits follow Conventional Commits — releases and changelogs are derived from them, so do not hand-write changesets. AGENTS.md documents the architecture, conventions and anti-patterns in depth.
👥 Contributors
Thanks to all the contributors!
🎁 Acknowledgements
- single-spa — what an awesome meta-framework for micro-frontends!
- writable-dom — utility to stream HTML content into a live document.
📄 License
Qiankun is MIT licensed.