Isomorphic Layout Composer (ILC) - layout service that compose a web page from fragment services.
This repository also contains an example of how using ILC you can create a micro service front-end and enable multiple applications to work in concert in a unified experience.
Microservices get a lot of traction these days. They allow multiple teams to work independently from each other, choose their own technology stacks and establish their own release cycles. Unfortunately, frontend development hasn’t fully capitalized yet on the benefits that microservices offer. The common practice for building websites remains “the monolith”: a single frontend codebase that consumes multiple APIs.
What if we could have microservices on the frontend? This would allow frontend developers to work together with their backend counterparts on the same feature and independently deploy parts of the website — “fragments” such as Header, Product, and Footer. Bringing microservices to the frontend requires a layout service that composes a website out of fragments. ILC was developed to solve this need.
Currently project is in the PoC stage and is not intended to be used in production. Stay tuned with us. We work hardly to prepare it for production.
- Clone the repo
- For Namecheap employees only: clone "ilc.internal" repo and follow the guide to setup NC specific applications.
- Run
npm install
- run
npm start
- Open running code at
http://localhost:8233/
- System (written in vanilla JS, with SSR)
- News (written in Vue.js, with SSR)
- People (written in React, no SSR)
- Planets (written in Vue.js, no SSR)
- Navigation (written in React, no SSR)
- fetchWithCache (used by News & People)
I'm using webpack (a static module bundler) to build each application for our micro-frontend approach. Webpack requires access to everything it needs to include in the bundle at build time. This means when an app that imports a service, for example planets importing the fetchWithCache service, webpack will try to bundle the service into the planets bundle. The built in way to avoid webpack doing this is webpack externals, using externals works really well but to avoid having to include a regex for each service I'm using the postfix to signal to webpack (and developers) that the import is another micro-app/service/front-end. The prefix isn't required if you would rather include a different postfix or none at all it should work, you'll just have to modify each webpack config for externals.
Code splitting is a complicated topic. I'm not going to dive into each facet of it within Webpack, see Webpacks docs for that.
In our project code splitting is further complicated because webpack's module format expects to load more modules from the website root, which will always fail in this project unless webpack is told where to load additional modules. Right now there is a single example of this, done in the people application.