Unified UI App
To provide Unified UI implementation as the container for react and angular apps.
Create a single app, which contains all other apps as micro frontend. Users can access the entire set of available apps from a single unified app. A unified app is a container for all apps which build on react and angular.
The following are the features of the app:
The app should support react and angular apps.
The app should carry out authentication and authorization for the user.
The app should display the app to the user based on the roles and allowed actions.
The app should contain a header and sidebar with a primal custom theme.
The app should contain a space to host all other micro frontend apps.
The app should allow users to perform actions on the micro-fronted apps.
Challenges / Problems:
Following are the feedback or problems for the available solutions for the Unified UI App:
- A custom global communication library (event bus within the browser) needs to be created for all apps and sent messages to each other micro front end. This business workflow hiding in the GCL and no one don’t know what will happen when the button is clicked.
- Redoing the browser creates UX problems like scrolling within the tab of a particular micro frontend tab, and then switching the tab and coming back to the position in the previous tab will not be in the same place.
- In the shell, there will be a micro frontend that contains bread crumbs and there is a need for another micro frontend in the bread crumbs. The team that creates the breadcrumbs owns the micro frontend responsibility.
- There are disadvantages to module federation which will limit certain behaviors aspect of UI, for example, inter navigation of components across multiple apps.
- Nextjs has a bad architectural design for rendering server-side UI (avoid the next Module Federation plugin). It is a secondary plugin for next js (next module federation )
- Nextjs uses file-based routing for slugin, you need to have file-based dependency management is the problem.
- Share the context, viz., a little bit of user token, roles, and menus.
- Doing module federation is straightforward and shared context is difficult, so we need to be strict about shared context
- Package integration is a kind of dependency management. Technically not so complex. So that all the team will check in the same repo.
Recommendations:
The following is the recommendation for the Unified UI App:
- Recommend convincing the client not to re-design the browser. As the shell application is a spa framework so it is more like a browser redesigned.
- Keep the shell as light as possible.
- As far as possible avoid sharing the data between components.
- Keep core business logic in the backend, keep the API
- Make sure that React apps are not using nextJs, which will not support type script.
- discourage inter-app communication
- How to call the app within the shell?
If it is a reverse proxy we need to reload the entire app using Nginx or serverjs configuration. - How to build a header and Footer?
Are those application needs SEO compliance? If it is client side, this application can expose a method, which can be consumed in the window.
Mount the angular application, for a given id, and the application will mount on that layout.
Create a layout, when routing one app to another app and mount on one app. Changing the code to expose the app for mounting (in modules) is the easiest way.
A lot of app migrations use a reverse proxy, which will reload the entire page - Single SPA is a new framework, when we create the shell, angular, and react app, should follow a single SPA API
- Module federation, expose remotely, and make a web app to expose the bundle. It is a bundle specification implementation.
- Create a layout as micro frontend as a consumer app for all other apps
Options:
The following are the options available for the solution:
- Reverse Proxy
- Single SPA
- module Federation
- iframe
- nextJS Federation
- Only Code
Comparison Study:
References:
Reverse Proxy:
Single SPA:
iFrame:
Module Federation:
Next JS Module Federation:
Only Code: