This project is an example of a micro frontend using Module Feredation
More and more front-end projects get bigger and complex, in 2016 I had a really cool experience with micro frontends, at that time it was not very common and our approach can be said that it was not the best possible but it worked very well. This project intend to be a simple and scalable boilerplate of a micro frontend, in it I used the Module Federation, to better understand I recommend accessing the following links:
Webpack 5 Module Federation - Zack Jackson
After cloning the repository, you must run the command below at the root of the project:
yarn install-all
Run the command below to start the applications: dashboard
, profile
and projects
yarn start-all
or if you prefer you can run the command below for each project: dashboard
, profile
and projects
yarn start
The ports of each project:
Project | Port |
---|---|
dashboard | 3000 |
profile | 3001 |
projects | 3002 |
The project structure presented is just an example, here I tried to make it as simple and scalable as possible:
.
βββ dashboard # Full dashboard using the `profile` and` projects` page.
βββ profile # Profile containing only the profile page and related components.
βββ projects # Projects containing only the projects page and related components.
Internal structure of each project:
.
βββ public # Public files
βββ src # Application code source
β βββ components # Generic application components
β βββ styles # Generic application styles
β βββ views # Pages used on the router
β βββ App.js # Main application bootstrap with routes
β βββ bootstrap.js # Responsible for importing App.js and rendering in the DOM
β βββ index.js # Performs async import from bootstrap.js
βββ webpack.config.js # Bundler the all project and also where modules are exported so that projects can be reused
This project is distributed under the MIT license.