Common Mistakes When Building Microfrontends
Common Mistakes When Building Microfrontends

"Code is a liability, not an asset."
Microfrontends had their flash of popularity more than 10 years ago. Now that they've stepped off the hype train, they haven't become as popular as their backend counterpart.
Still, they remain a relatively common choice in the corporate world. Possibly because of Conway's law and the culture these organizations adopt.
- mfe: microfrontend
- ms: microservice
- shell: host mfe that acts as the orchestrator of the other mfes
Table of Contents
When are remotes loaded?
If we're talking about Angular and Native Federation, we have federation.json files to register the remotes per mfe, and remoteEntry.json
to store the asset references.
You'll soon see this turns into a versioning and deployment management problem. This is where the classic blue-green and canary deployment options come in. Each with its own challenges.
(a) for example, we have a shell + SPA mfe application deployed to a CDN.
It works wonderfully. Except for some flickering that hurts CLS, but oh well, you add loading screens. Maybe SSG too for the bots looking for content.
Remotes are loaded from the browser and the requests go to the CDN.
Since keeping a version history costs nothing, retrying is straightforward. The browser remembers that on failure it should retry the last stable version. Either the browser or your CDN.
SSR
In another case, your solution might call for a server deployment.
Various reasons:
- an extra layer of isolation before reaching the backend
- SEO+
- session invalidation due to fraud/timeout/automatic detection
(b) you could deploy everything with SSR

And it would work... and you'd have an architecture that lets you deliver the solution.
But loading microfrontends involves more than your REST interfaces. Loading a remoteEntry.json triggers a cascade of asset requests.

And what happens when we do a rollout? Since the Native Federation shell (at least in Angular) does a pre-load every time it starts, we end up with stale memory that invites failures when loading the canary mfe's assets.
Below are two almost comical failures, for blue-green and rollout deployments.


This is a good moment to ask yourself whether you really need SSR for the whole architecture. Or whether it's enough to have only the shell in SSR, so we go back to the CDN-friendly architecture; you'd just need to share a deploy identifier between the server and the browser, which is simple.
(b.1)

And if you really need SSR in the mfes. I don't know, maybe for a video rendering or processing service that shouldn't affect the scaling of other screens, we can use sticky sessions. But this means keeping canary and stable coexisting for longer while the shell is redeployed.
(b.2)

Honestly, not a very elegant solution. Maybe you could try storing the deployments in a CDN and also using it as a fallback. The infrastructure complexity grows.
Shared Model Corruption
This is a Domain Driven Design classic.
When you decide to adopt an mfe architecture, you have to be aware that the boundaries between domains harden with much more force than just splitting domains into separate folders or repositories. Now we're even talking about a physical separation in the deployment environment.
That's how you can end up maintaining several implementations of the same class, thinking that, just like when you had a monolith, the cost of fixing the technical debt would be minimal.

It's worth saying that even using AI agents I find this task hard. The advantage of partitioning domains into separate mfes, which lets you put chains on the agents, makes them just as rigid when it comes to refactoring code across domain boundaries.
Conclusions
- Choosing a software architecture with decoupled development means putting much more detail into upfront planning, since the cost of a mistake multiplies. Not even AI saves us.
- If you're going to build mfes with SSR... please convince your team not to. Unless it's absolutely necessary. It multiplies the technical difficulty of keeping all the frontends aligned. Also keep in mind that debugging will happen on the server, and you'll have to maintain two sources of errors: the browser and the server.