• Stars
    star
    211
  • Rank 186,867 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Multiple angular applications, coexisting in one page via single-spa.

Build Status

Coexisting Angular Microfrontends

Demo: http://coexisting-angular-microfrontends.surge.sh

This is a starter-kit / example repository for people who want to have multiple angular microfrontends coexist within a single page. Each of the angular applications was created and is managed by Angular CLI.

It uses single-spa to pull this off, which means that you can even add React, Vue, or other frameworks as additional microfrontends.

For mapping routes to applications it uses single-spa-layout.

An important note

This github repository has four projects all in one repo. But when you do this yourself, you'll want to have one git repo per angular application. The root-html-file project should also be in its own repo. This is what lets different teams and developers be in charge of different microfrontends.

Local development -- one app at a time

Tutorial video

With single-spa, it is preferred to run ng serve in only one single-spa application at a time, while using a deployed version of the other applications. This makes for an awesome developer experience where you can boot up just one microfrontend at a time, not even having to clone, npm install, or boot up all of the other ones.

To try this out, clone the repo and run the following commands:

cd app1
npm i
npm start

Now go to http://coexisting-angular-microfrontends.surge.sh in a browser. Click on the yellowish rectangle at the bottom right. Then click on app1. Change the module url to http://localhost:4201/main.js. Then apply the override and reload the page. This will have change app1 to load from your localhost instead of from surge.sh. As you modify the code locally, it will reload the page on coexisting-angular-microfrontends.surge.sh. See https://github.com/joeldenning/import-map-overrides for more info on this.

Local development -- all at once

It is preferred to only run one app at a time. But if you need to run them all locally, you can do so with the following instructions

# First terminal tab
cd root-html-file
npm install
npm start
# Second terminal tab
cd app1
npm install
npm start
# Third terminal tab
cd app2
npm install
npm start
# Fourth terminal tab
cd navbar
npm install
npm start

Now go to http://localhost:4200 in a browser. Note that you can change any of the ports for the projects by modifying the Import Map inside of root-html-file/index.html.

If you get serious about deploying your code, you'll want to make it no longer necessary to boot up all of the apps in order to do anything. When you get to that point, check out import-map-overrides, which lets you go to a deployed environment and override the Import Map for just one microfrontend at a time. The import-map-overrides library is already loaded in the index.html of root-html-file, so you can start using it immediately. You can make your deployed environment overridable, just like you can do overrides on http://coexisting-angular-microfrontends.surge.sh

More documentation

Go to https://github.com/CanopyTax/single-spa-angular to learn how all of this works.

More Repositories

1

coexisting-vue-microfrontends

A repo showing separate vue apps coexisting as microfrontends with single-spa
JavaScript
610
star
2

simple-single-spa-webpack-example

A simple example of how to use webpack with single-spa
JavaScript
282
star
3

narn

Never have to switch between npm and yarn commands ever again
JavaScript
123
star
4

systemjs-webpack-interop

An npm package for webpack bundles that are used by systemjs
JavaScript
93
star
5

vite-single-spa-example

JavaScript
63
star
6

utahjs-2019

JavaScript
15
star
7

vite-single-spa-root-config

EJS
12
star
8

single-spa-es5-angularjs

A single-spa example with an es5 angularjs app
HTML
12
star
9

import-map-service-worker

JavaScript
11
star
10

snowpack-single-spa-example

An example of a snowpack application that serves as a single-spa application
8
star
11

single-page-react

Lightweight, straightforward plugin for creating single page apps with React
JavaScript
7
star
12

live-import-map-deployer

JavaScript
6
star
13

eslint-config-important-stuff

An eslint config focused on catching bugs without being annoying
JavaScript
5
star
14

add-esmodule

Add __esModule property to native ES module objects
JavaScript
3
star
15

eslint-config-ts-react-important-stuff

An eslint config for important stuff in react / typescript projects
JavaScript
3
star
16

eslint-config-react-important-stuff

An eslint config for react important stuff
JavaScript
2
star
17

kremling

The smallest, fastest es6 to System.register compiler you'll find.
JavaScript
2
star
18

vue-3-single-spa

JavaScript
2
star
19

openmrs-esm-hackathon-seed

A seed repo for hackathons
JavaScript
2
star
20

single-spa-jspm

Helpers for making jspm applications compatible with single-spa
JavaScript
2
star
21

js-correct-lockfile

Test that incoming pull requests use the correct lockfile (npm, yarn, pnpm)
JavaScript
2
star
22

hot-reloading-meetup

JavaScript
1
star
23

system-import-chaining

https://github.com/systemjs/systemjs/issues/1954
HTML
1
star
24

shell-setup

Joel's favorite aliases and other shell stuff
Shell
1
star
25

make-fetch-happen-304

JavaScript
1
star
26

autopublish-template

JavaScript
1
star
27

scoped-bootstrap

JavaScript
1
star
28

multiple-react-instances

HTML
1
star
29

unimg

JavaScript
1
star
30

openmrs-esm-hackathon-seed-angular

Starter repo for kenya hackathon with angular
TypeScript
1
star
31

eslint-config-node-important-stuff

An eslint config that works for backend node projects
JavaScript
1
star
32

react-query-issue

1
star
33

bandicootjs

A scenario-based browser framework
JavaScript
1
star
34

single-spa-globals

A single-spa plugin for apps that leak globals
JavaScript
1
star
35

openmrs-esm-navbar

The navbar for the kenya hackathon
TypeScript
1
star
36

react-app-single-spa-test

JavaScript
1
star
37

openmrs-esm-patient-dashboard

Patient dashboard, for the Kenya hackathon
TypeScript
1
star
38

eslint-config-ts-important-stuff

No rules except important ones. For Typescript
JavaScript
1
star