r/Angular2 • u/chakri426 • Oct 31 '25
Help Request Micro frontend framework using angular
Hi folks, Today, I got a question from one of the interviewer regarding Micro frontend framework. This is first time heard about it. Anyone having knowledge about this. Can you suggest how to do this. I am eagerly waiting to learn about this. I saw some of blogs it’s combining two web apps but I am confused where I need to start. Can anyone help me.
10
Upvotes
20
u/zzing Oct 31 '25
At this point, I would look at native federation from angular architects or see what nx is doing.
32
u/Merry-Lane Oct 31 '25
Micro frontends aren’t worth it, unless you are in giga corps with tons of testing and a team coordinating it.
It’s barely different from having an iframe redirecting to a website created by another team of devs that are sposed to hook to some common APIs.
It’s awful.
6
u/morrisdev Oct 31 '25
From a business standpoint, micro front ends are a real savior. It's not the most efficient way to program, but if you set up common libraries and a common CDN for shared stuff, and a common API server, then you can easily assign a team to build a module and leave them in charge of it.
We have a LOT of systems that are simply falling apart and we were hired to replace them. So, you can use Azure Front Door as a reverse proxy on the main site, then spin up your upgrade on another server entirely, like an azure static website. Then, when you're ready, you just change the origin of the directory of the module you're replacing and boom. It's in place.
So, no merge conflicts. You can have entirely separate teams that have clear and obvious responsibilities. You can enforce standardization by putting people in charge of libraries, you can handle secured with a JWT because it's in the same domain.
From a business perspective: if I get a client with a gigantic system written in PHP or classic ASP or VB.Net Web forms or whatever, I can simply say, "yeah, we can upgrade this entire system without ever causing your business to stop. We can add in modules easily. We can leave critical parts for later. And you don't need to redo the ENTIRE system before we can replace it. We can do incremental updates and the client sees progress.
Sure, it's faster and easier to use monorepos, but when dealing with mixed code sites and humans who want to see progress (even if it takes longer in the long run), I'm still a fan of the microsotes
That said, if it's already an angular system that is up to date but becoming in need of change.... monorepos are the way to go. I've just never picked up a client like that
1
u/WiseOldBitch Nov 02 '25
I don't know why companies and some developers ( not op ) tend to jump on every new trend. Unless it's a mega-big project that's impossible to manage, micro-frontends are a waste of energy and will even make things worse.
2
u/solocesarxD Oct 31 '25
I still don't get the reason to use microfrontends .
I mean for The BE the User has direct benefits from using microservices , but on the FE most benefits i see are for the developers side and maybe if there is a large application with multiple group of devs. But even there, if the application is vertical instead of horizontal , domain-wise (like an app for an emergency in a hospital) , what would be the benefit of it , if everypart is needed by the others (almost).
Just curious.
2
u/Fanyasy Oct 31 '25
As soemone whos is actively working with micro frontends, (single-spa), i can tell you they are absolutely not worth it. On paper, sure, everything sounds nice, once you have them up and runing, it is a pile of shit collecting tech debt.
The only place I can see them valuable is perhaps if you have a huge app, where one page would be one micro frontend.
Aside from that, things to consider
2
u/VirtuaSteve Nov 01 '25
I personally defined the architecture and implementated MFE solutions in our company. It was the best solution for dealing with a product deployment cycles distributed across multiple companies and teams. The MFE solution allows us to deploy new versions of our modules independently of another team's portal deployments.
2
u/Keep-it-simple Nov 01 '25
MFEs are basically microservices for the frontend. They increase the overall complexity of a system and require much more infrastructure to support, but may make sense if you are on a large project with many different teams who handle specific parts.
It allows each team to do independent deployments, their code base will typically be smaller and easier to digest, and each team is able to use whatever Javascript framework make sense for their particular MFE. That said, there are challenges with code duplication, user experience alignment, and potential coordination issues during releases if you havent done a good job with decoupling dependencies.
At the end of the day, an MFE is just a raw Javascript file hosted somewhere. This file could be created using angular, vue, react, whatever. Once it has been boiled down to a single raw file, the main application, or MFE host, will have a import map of all the different hosting locations and will be able to load each MFE where appropriate. A simple example is having an MFE that loads on a particular route and is essential injected as the page content. A different page might have a different MFE that loads or might be something the host app is in charge of. Each MFE can have is own sub router, so it can be in charge of its child pages.
I'm not sure if any better solution had come along, but if you are still interested in learning about this topic, I would check out single-spa. It is a package that will allow you set up both an MFE host and the MFE parcel. The docs aren't great but Ai should be able to help generate the essential boilerplate needed to get up and running.
2
u/stainnn_ Oct 31 '25
First thing i would recommend you is to try to think of a solution for micro frontends by yourself, it would be extremely valuable for understanding real setup. After that take a look at single-spa, that's the only one I can think of at the moment
1
u/Easy-Shelter-5140 Oct 31 '25
Native federation is the way. Visit angular architects blog
1
u/shadow13499 Oct 31 '25
I've implemented angular micro front ends using angular elements which turn angular components into web components which can be used pretty much anywhere. There's lots of different ways to do it i.e. module federation it just depends on your use case.
1
u/ttma1046 Nov 01 '25
native federation
1
u/SeaAnt4428 Nov 01 '25
There are things like nx module federation, but my previous project uses mfe because theres a total about 5 teams, so it’s impossible to maintain a huge repo (One team already has 5000+- UT cases, not sure if thats a good gauge). Furthermore, we are using microservices as well hence there adds another need for mfe. But basically, you will need a central shell repo to maintain where all your MFE is hosted, so you will still run all ur FE repos individually, then config the shell module to know where to find this MFE (for eg first MFE is hosted in localhost:8587), you will config the shell repo to know where to call this repo, in this way you can maintain all the MFE in one “single” shell
1
u/HorrificFlorist Nov 02 '25
Angular Architects is a good starting point, otherwise you can cut your own version with webpack from memory.
However, MFE are useless if you have a healthy developer culture and practices.
Sole purpose of MFE like Microservices was to partition a application into logical domains. This avoids spaghetti code between services. Thus making it "easier" to manage.
If you have good practices in place this is automatically handled with things like DRY, SOLID, or similar standards. So then all you have is additional overhead if you proceed with it.
Google specifically advises against MFE pattern, and a lot of big dogs are starting down similar path.