I am currently investigating the use of microfrontends in our company.
We have multiple web apps (Angular, but also some legacy JSP ones) that are currently hosted on different domains.
Some of them are part of a product suite (see JSP), and some of them are separate products themselves.
However all of them target the same users :
1. Our Customers
2. Our employees (dev, service, support teams)
Those products have a complex way of authenticating and storing user data, since we haven't got a centralized auth server.
So we keep multiple copies of user data, and authentication mechanisms, which leads to duplication, trouble in syncinc changes etc.
Also, our customers, need to log in to different systems each time they need to work on 2 separate products,
let alone that the UI/UX might be quite different. This leads to frustration, confusion and bad UX in general.
At the moment, we are implementing a centralized authentication service, which means that we can finally integrate users across systems.
However we are trying to re-architect our frontend applications also, that's why I've been exploring microfrontends.
My first attempt, will be to integrate the Angular apps under a single login page which leads to a host app that will only handle :
1. Users (login/logout/manage)
2. Navigation (Send me to the required web app)
I have already used module federation (webpack) to integrate a new web app (module), into an existing product and it has been working fine for some time.
So I am exploring integrating all of the Angular apps under a single host (new webapp), and using module federation (or whatever else works) to fetch and run
the other modules, with routing (lazy loaded, remote modules)
It's worth noticing that our 2 main products I am trying to integrate, are Angular SPAs that use the same UI framework, and similar UI/UX.
There are 2 (currently) small-sized teams that work in these projects, and they have their own release cycles.
Each project has its own backend service.
The issues I have identified so far are :
1. Angular/package upgrades must be done simulatneously (if we care about performance, and don't want multiple copies of the framework downloaded and running in the same page)
2. JWT token sharing/refreshing (Since everyone will live under the same domain, we can share auth tokens in cookies/headers,
but we require a mechanism for all apps/modules to request a token refresh, and a way to communicate user status changes : user logs out, permissions have changed etc)
(p.s. Backend services - hosted in separate domains - will of course have to integrate the new Auth service, and inspect/validate the shared JWTs)
3. ALthough module federation might work for Angular SPAs, we will have to implement a separate mechanism for importing JSP apps (iframes probably?) and the way we share JWTs with them.
Since I've read a lot of constructive critisism on the issue here, I would love any feedback regarding my approach. Is there anything else I should explore?
I've thought about NX monorepos, with separete CI/CD pipelines for each project, but that looks more complicated from where I stand.
Thanks in advance.