To split our FE into smaller, focussed codebases with different ownership and release cadences whilst still allowing us to share logic and features and deliver a unified single SPA experience
Even though the Module federation pattern isn't limited to a monorepo, I have created this as a monorepo for convenience.
Install package dependencies using yarn.
yarn
.env
Each package contains a .env.example
file that stands up that particular SPA up locally whilst using the deployed versions as remotes. Copy this example file to .env
before running any of the scripts below
Each package has 3 scripts
serve
- Compiles and hot-reloads for developmentbuild
- Compiles and minifies for productionstart
- Compiles and minifies for production and serves with Servor
You can chose to run these scripts individually from their package dir
yarn serve
yarn build
yarn start
...or all at once from the repo root using the lerna cmd line tool
lerna run serve
lerna run build
lerna run start
Base application, responsible for exposing the basic layout, routing and login functionality for the unified SPA
Deployed to https://nervous-jones-f43a95.netlify.app/
Focussed SPA, closely integrated with Shell, exposing a single page to be shown on the unified SPA
Deployed to https://happy-kirch-47dfe1.netlify.app/app
Simple standalone SPA that showcases components, exposes shared base components
Published to https://www.npmjs.com/package/@brockreece/test-styleguide