Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
Q

qiankun

> 前端框架
Open source

📦 🚀 Blazing fast, simple and complete solution for micro frontends.

16.6K stars0 likes14 views
WebsiteGitHub

About

📦 🚀 Blazing fast, simple and complete solution for micro frontends.

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:

  • 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 window and document, 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. Dynamic import() works, and so does a Vite dev server.
  • 🛡 Style isolation — opt-in runtime scoping built on the CSS @scope at-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/sandbox is 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:

bash
npx skills add umijs/qiankun

Or add qiankun to an existing host application:

bash
npm i qiankun@rc

Load a micro app into any container element, and keep the returned handle to unmount it:

typescript
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:

typescript
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:

bash
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:

bash
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.

Issues· 433 open

View all issuesOpen on GitHub
  • #2510

    qiankun处理子应用引起样式覆盖问题!

    Updated Sep 18, 2026
  • #281

    [Feature Request] Blueprint skeleton app or app generator?

    pr welcomeUpdated Sep 17, 2026
  • #172

    [Feature Request]模块自动依赖支持独立运行

    enhancementUpdated Sep 17, 2026
  • #31

    Who uses qiankun?[谁在用 qiankun]

    Updated Sep 17, 2026
  • #442

    [RFC] 2.0 文档计划

    pr welcomeUpdated Sep 17, 2026
  • #340

    子项目为create-react-app,修改任意后,主项目报错

    help wantedUpdated Sep 17, 2026
  • #303

    [Bug]子应用切换回来异步 css 未 block 导致高度计算的问题

    duplicateUpdated Sep 17, 2026
  • #470

    dynamicHeadAppend 逻辑优化

    pr welcomeUpdated Sep 17, 2026
  • #452

    如何使用angular作为基座

    pr welcomeUpdated Sep 17, 2026
  • #627

    [Feature Request] qiankun 如何复用公共依赖

    Updated Sep 17, 2026

> Tags

TypeScriptframeworkjavascriptmicro-frontendmicro-frontends

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架