A micro-frontend is an architectural style where a frontend app is composed of multiple smaller frontend apps or components. Each component is developed, deployed and maintained by different teams independently.
The key ideas behind microfrontends are:
- Break down a monolithic frontend into smaller pieces
- Allow teams to work in parallel on different features
- Each team owns the full lifecycle of their microfrontend component
- Components are integrated into a single user interface at runtime
This approach aims to allow large organizations to scale frontend development by giving teams autonomy and avoiding monolithic codebases that are difficult to maintain and evolve.
Piral is an open source framework for building modular web applications using micro-frontends. It allows you to combine multiple independent applications or components into a single user interface. The key features of Piral include:
- Composing applications from different sources
- Isolating team code and deployment
- Sharing dependencies and state
- Routing between components
- Updating components independently
Piral makes it easier to adopt a micro-frontend architecture, where different teams can develop and deploy parts of a web app separately, while still providing a seamless user experience.
npm i piral-cli -g
piral --version
piral new --target app-shell
piral debug
piral build
This will trigger the build of a Piral instance. By default, this command will create two folders within the
dist
folder:emulator
andrelease
. The latter contains the files for publishing the app shell to some host later on. The former contains an emulator package.
pilet new ./app-shell/dist/emulator/app-shell-1.0.0.tgz --target my-pilet
With the pilet new
command, a new pilet with pre-defined content is created. The first parameter ./app-shell/dist/emulator/app-shell-1.0.0.tgz
specifies the application shell, which the pilet will be built for. Make sure that you adjust the path to the Piral instance located in your local directory structure.
pilet debug
pilet build
pilet pack
pilet publish --fresh --url sample
pilet publish --fresh --url https://feed.piral.cloud/api/v1/pilet/mx-demo --api-key <KEY>
pilet publish --fresh --url http://localhost:8181/api/v1/pilet --api-key df133a512569cbc85f69788d1b7ff5a909f6bcfe1c9a2794283a2fc35175882c
docker build -t my-piral-app .
docker run -p 3000:1234 my-piral-app
docker-compose up -d --build
docker-compose down