qiankun README

The project's README from github.com/umijs/qiankun. As one markdown file: README.md.

qiankun logo

npm version coverage npm downloads build status license

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 and kun(坤) earth. qiankun is 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:

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:

🚀 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 qiankun version The framework: registerMicroApps, loadMicroApp, start, prefetch
@qiankunjs/loader loader version Streaming HTML-entry loader
@qiankunjs/sandbox sandbox version JS sandbox — usable standalone
@qiankunjs/shared shared version Asset transpilers, fetch utilities, ESM-sandbox engine
@qiankunjs/single-spa single-spa version Vendored single-spa fork the framework builds on
@qiankunjs/react react version <MicroApp /> for React
@qiankunjs/vue vue version <MicroApp /> for Vue
@qiankunjs/ui-shared ui-shared version Shared internals of the UI bindings
@qiankunjs/bundler-plugin bundler-plugin version webpack 4/5 and Vite plugins for micro apps

📖 Documentation

Full documentation lives at www.qiankunjs.com (English and 简体中文):

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

Ask DeepWiki

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!

contributors

🎁 Acknowledgements

📄 License

Qiankun is MIT licensed.

qiankun (umijs/qiankun)

Searching Database…

16.7K ·GitHub
What is this?Qiankun is a JavaScript framework for building micro-frontend applications, letting independently built and deployed apps (React, Vue, or anything else) run together inside one host page.
Is this a standalone app, or a framework I add to my own project?It is a framework/library you add to an existing host application; you load separately-built micro apps into a container element and keep a handle to control their lifecycle. It does not run on its own.
How do I add qiankun to a project?Install the npm package (use the @rc tag for the in-development v3, or the plain tag for 2.x), then call loadMicroApp to mount a micro app, or use registerMicroApps plus start for route-driven orchestration. There is also an agent skill that can scaffold a correctly wired host or micro app for you.
Does my micro app need a specific bundler?Qiankun ships bundler plugins for webpack 4/5 and Vite that mark the entry script and fix the output library format, which a micro app needs to be loadable; the micro app itself only has to export three lifecycle hooks (bootstrap, mount, unmount).
Is qiankun 3.0 ready to use right now?No — v3 is under active development and only ships under the npm rc tag, while the latest tag still points to the older 2.x line (whose docs live separately on v2.qiankun.umijs.org).
Can I use qiankun with frameworks besides React and Vue?The core loader and sandbox are framework-agnostic since a micro app just needs to export three lifecycle hooks; qiankun specifically ships ready-made UI binding components for React and Vue.
What is the JS sandbox actually isolating?Each micro app runs behind a Proxy-membrane view of window and document, so its globals, timers and listeners stay inside the app and are automatically cleaned up on unmount, instead of leaking into the host page or other micro apps.
Why build qiankun instead of just using single-spa?Qiankun was born internally to solve problems single-spa left open — asset distribution, runtime sandboxing, style isolation and prefetching — and packages that extra tooling into an open-sourced solution built on top of single-spa.
How does style isolation work without a Shadow DOM?Qiankun offers opt-in runtime CSS scoping built on the native CSS @scope at-rule, covering external stylesheets too, so you avoid rewriting your CSS or paying the performance cost of Shadow DOM.
Can I use the sandbox without the rest of the micro-frontend framework?Yes — the @qiankunjs/sandbox package is published standalone and can contain any third-party script even without qiankun's broader orchestration layer.
Creator
umijs
Size
38.6 MB
Stars
16.7K
Age
7y
Commits · 90 Days