qiankun vs single-spa
Micro-Frontend Frameworks
qiankunsingle-spa

Micro-Frontend Frameworks

Micro-frontend frameworks enable the development of web applications as a composition of multiple smaller applications, allowing teams to work independently on different parts of a larger application. They help in managing the complexity of large-scale applications by breaking them down into manageable pieces, each developed and deployed independently. This approach enhances scalability, maintainability, and the ability to use different technologies within the same application. Both qiankun and single-spa provide mechanisms for loading, unloading, and managing these micro-applications seamlessly, but they have different philosophies and implementation details that cater to various use cases.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
qiankun016,5761.66 MB4242 years agoMIT
single-spa013,8662.12 MB65a year agoMIT

Feature Comparison: qiankun vs single-spa

Framework Compatibility

  • qiankun:

    qiankun supports multiple frameworks out of the box, including React, Vue, Angular, and others. This flexibility allows teams to choose the best technology for their specific micro-apps without being locked into a single framework, making it easier to integrate existing applications.

  • single-spa:

    single-spa also supports multiple frameworks, but it requires a more structured setup for each micro-app. It allows developers to use different frameworks side by side, but the integration process can be more complex, requiring adherence to specific conventions.

Loading Mechanism

  • qiankun:

    qiankun employs a dynamic loading mechanism that allows micro-apps to be loaded on demand, which can significantly improve the initial load time of the application. It uses a single entry point to manage the loading of multiple micro-apps, ensuring that only the necessary code is loaded when required.

  • single-spa:

    single-spa uses a more explicit loading mechanism where each micro-app must declare its lifecycle methods. This provides fine-grained control over when and how each micro-app is loaded and unloaded, but it can lead to more boilerplate code and complexity in managing dependencies.

State Management

  • qiankun:

    qiankun provides a simple way to share state between micro-apps using a global event bus. This allows micro-apps to communicate and share data without tightly coupling them, promoting loose coupling and independent development.

  • single-spa:

    single-spa does not provide built-in state management solutions. Instead, it encourages developers to implement their own state management strategies, which can lead to more flexibility but also requires additional effort to ensure consistent state across micro-apps.

Community and Ecosystem

  • qiankun:

    qiankun has a growing community and ecosystem, with many plugins and integrations available. This can be beneficial for developers looking for additional tools and resources to enhance their micro-frontend architecture.

  • single-spa:

    single-spa has a well-established community and a variety of resources, including documentation and tutorials. Its ecosystem is robust, but it may not have as many plugins specifically tailored for micro-frontend development compared to qiankun.

Learning Curve

  • qiankun:

    qiankun is generally considered easier to learn, especially for teams already familiar with micro-frontend concepts. Its API is designed to be intuitive, making it accessible for developers of varying skill levels.

  • single-spa:

    single-spa has a steeper learning curve due to its more complex lifecycle management and the need for developers to understand the underlying principles of micro-frontend architecture. This can be a barrier for teams new to micro-frontends.

How to Choose: qiankun vs single-spa

  • qiankun:

    Choose qiankun if you need a more flexible, easy-to-use solution that supports various frameworks and offers a straightforward API for managing micro-applications. It is particularly beneficial for projects that require dynamic loading and unloading of micro-apps and have a strong emphasis on performance and user experience.

  • single-spa:

    Choose single-spa if you prefer a more structured approach with a focus on the lifecycle management of micro-apps. It is ideal for applications that require strict control over the loading and unloading process of micro-apps and where you want to enforce a single framework for all micro-apps.

README for qiankun

qiankun

npm version coverage npm downloads build status dumi

qiankun(乾坤)

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

:sparkles: Features

Qiankun inherits many benefits from single-spa:

  • 📦 Micro-apps Independent Deployment
  • 🛴 Lazy Load
  • 📱 Technology Agnostic

And on top of these, it offers:

  • 💃 Elegant API
  • 💪 HTML Entry Access Mode
  • 🛡 Style Isolation
  • 🧳 JS Sandbox
  • Prefetch Assets
  • 🔌 Umi Plugin Integration

📦 Installation

$ yarn add qiankun  # or npm i qiankun

📖 Documentation

You can find the Qiankun documentation on the website

Check out the Getting Started page for a quick overview.

The documentation is divided into several sections:

💿 Examples

Inside the examples folder, there is a sample Shell app and multiple mounted Micro FE apps. To get it running, first clone qiankun:

$ git clone https://github.com/umijs/qiankun.git
$ cd qiankun

Now install and run the example:

$ yarn install
$ yarn examples:install
$ yarn examples:start

Visit http://localhost:7099.

🎯 Roadmap

See Qiankun 3.0 Roadmap

👥 Contributors

Thanks to all the contributors!

contributors

🎁 Acknowledgements

📄 License

Qiankun is MIT licensed.