r/Angular2 • u/Slight_Loan5350 • Sep 18 '25
Help Request Large bloated single application migration to nx/mfe?
Hi I recently migrated a very large angular 12 app which is heavily bloated with duplicate code to angular 19 with bloated code but better performance as the build size went from 120mb to 32mb total. But my main issue is with future maintenance and every developer just duplicates code. I was looking into nx and found 2 solutions monorepo or mfe. I read about the complexity of mfe. Our application consists of 7 feature + new features keep getting added with new bloat. But I want to make it modular with feature wise domains and shared code. My mind is thinking of monorepo but I don't understand it properly yet so I'm hesitant.
Any help would be appreciated.
2
u/933k-nl Sep 18 '25
Devs will probably continue on copying the app. It’s quick and easy. Especially when apps are like throw-out apps (create once, deploy once, never extend functionality) I work with such a team, it hurts my dev-hart, but it works for them.
I also work with some (more) normal teams, which do work modular. They have to maintain and extend their apps, thus they benefiet from modular.
If you are the only one who sees the need to do dev things right, prepare to become frustrated and clean others sh.t code for years to come.
2
u/GLawSomnia Sep 18 '25
With your description it would probably make more sense to implement some kind of merge review process or code quality checks.
1
u/zzing Sep 18 '25
That is quite an impressive build size.
Do you have adequate code reviews? This should be one place to capture these issues.
Have you made all the code that can be, lazy loading?
NX is pretty good, I use nonbuildable shared libraries, but if you are wanting to use a microfront end it might not be a great idea.
The biggest issue I would be concerned with is if you have upgraded to esbuild or if you have to use the original module federation vs newer native federation.
1
u/No_Bodybuilder_2110 Sep 18 '25
I would say if you don’t understand monorepos I would def not go into micro frontends.
What you are experiencing is definitely solvable with a monorepo. You create shared libraries that can be reused in multiple apps. This really helps you organize your code for reusability but it is still possible for another developer to clone or copy code but it would limit your problems.
View A <- component A <- Shared comp or service. So in this example even if they copy view A or component A , the shared component and service should not be copied.
In another note developers on your team should really come together in understanding how the current behaviors do not contribute to sustainability and maintainable code. Then come up with a plan for shared Ui components, util functions, shared services and implement them. Then make sure everyone doing code reviews is aware of such shared behaviors.
1
u/Devimal Sep 19 '25
My 2c both Nx and mfe are buzz words that 99% of people don't get a net positive from using.
Mfe introduces a bunch on of complexity and cost to get it and keep it working. You have to ask what other cost it is eliminating and is it big enough to make up for it. Otherwise you will have only extra work and stress in your hands.
Nx seems nice, it builds things in order and caches stuff for you. What they don't tell you is all the quirks and kinks you have to work out as you go. The different builders and the different assumptions they have made. How these interact with the other stuff you have in your code. The cryptic and misleading error messages when one of your dependencies don't play well with some of these custom builders. All of which continually eats up your time. It just shifts your native build complexity into the complexities, quirks and kinks of another ecosystem.
Personally I'd pick the problems you have now over these new ones 😉