Skip to content
🐯 Micro Frontends solution for large application(面向大型应用的微前端解决方案)
TypeScript JavaScript
Branch: master
Clone or download

English | 简体中文


Micro Frontends solution for large application. Website docs.

NPM version Package Quality build status Test coverage NPM downloads David deps


npm install @ice/stark --save


icestark is a micro frontends solution for large application, contains:

  • Modular management of multiple independent applications based on route
  • Independent application independent warehouse, independent development and deployment
  • Unified management page public content (Common Header, Common Sidebar, etc.)
  • Support for low-cost migration
  • SPA user experience

Application architecture

Application architecture

  • Framework application and sub-application split according to UI structure
  • Framework application: responsible for sub-applications registration, loading, common content display (Common Header, Common Sidebar, Common Footer, etc.)
  • Sub-application: responsible for content display related to its own business


icestark requires the framework application to use react version 15+, which has no restrictions on the technology stack of the sub-application, supports different technology stacks such as react, vue, angular, etc., and supports multi-version coexistence of the same technology stack.

Getting Started

Framework Application

// src/App.jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { AppRouter, AppRoute } from '@ice/stark';

class App extends React.Component {
  onRouteChange = (pathname, query) => {
    console.log(pathname, query);

  render() {
    return (
        <div>this is common header</div>
          ErrorComponent={<div>js bundle loaded error</div>}
            path={['/', '/message', '/about']}
        <div>this is common footer</div>

ReactDOM.render(<App />, document.getElementById('ice-container'));
  • AppRouter locates the sub-application rendering node
  • AppRoute corresponds to the configuration of a sub-application, path configures all route information, basename configures a uniform route prefix, url configures assets url
  • icestark will follow the route parsing rules like to determine the current path, load the static resources of the corresponding sub-application, and render


  • Get the render DOM Node via getMountNode
  • Trigger app mount manually via registerAppEnter
  • Trigger app unmount manually via registerAppLeave
// src/index.js
import ReactDOM from 'react-dom';
import { isInIcestark, getMountNode, registerAppEnter, registerAppLeave } from '@ice/stark-app';
import router from './router';

if (isInIcestark()) {
  const mountNode = getMountNode();

  registerAppEnter(() => {
    ReactDOM.render(router(), mountNode);

  // make sure the unmount event is triggered
  registerAppLeave(() => {
} else {
  ReactDOM.render(router(), document.getElementById('ice-container'));
  • Get the basename configuration in the framework application via getBasename
  • renderNotFound triggers the framework application rendering global NotFound
// src/router.js
import React from 'react';
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
import { renderNotFound, getBasename } from '@ice/stark-app';

function List() {
  return <div>List</div>;

function Detail() {
  return <div>Detail</div>;

export default class App extends React.Component {
  render() {
    return (
      <Router basename={getBasename()}>
          <Route path="/list" component={List} />
          <Route path="/detail" component={Detail} />
          <Redirect exact from="/" to="list" />
            component={() => {
              return renderNotFound();


  • Possible js pollution problem between sub-applications
  • Possible style pollution between framework application and sub-application


Feel free to report any questions as an issue, we'd love to have your helping hand on icestark.

If you're interested in icestark, see for more information to learn how to get started.



You can’t perform that action at this time.