In a monolithic frontend architecture, a single codebase handles the entire user interface. While this can simplify initial development, it can bec...
For further actions, you may consider blocking this person and/or reporting abuse
This is great for SPAs, but if you guys just want a traditional website with different frameworks for functionality, try Astro instead
When choosing between Vite and Astro for microfrontends, it depends on your project’s needs.
Imagine you're building a SaaS dashboard for analytics with microfrontends:
Where Astro is Limited:
Why Vite Excels:
Conclusion
Astro is ideal for static pages, but for the dynamic, interactive SaaS dashboard core, Vite’s performance, flexibility, and robust runtime support can make it a better choice.
100% recommend Astro over anything else these days. Unless you need something specific from one of the other *kit frameworks
dev.to/mairouche/comment/2ka02
Sorry, but I don't see the "micro frontend architecture". There are some core properties that are unanswered (or maybe I could not see / find it):
Generally, if you look at things such as Module Federation, Native Federation, Piral, ... these solutions give you something that is distributed from the beginning, i.e., where you (by default) have runtime composition.
Having team autonomy (which is the most important aspect of a micro frontends architecture) is only possible with independent deployment processes. So how would I update, e.g., the trending module, without updating the whole application? How could I add another module without having to redeploy the application?
Sorry if my comment comes across negative - it is meant as an encouragement; not as a letdown.
Thank you for your comment! Every feedback is welcome.
You’re absolutely right that runtime composition and independent deployments are very important. My article primarily focuses on the get started, where modules are combined via
dist
directories for simplicity of the article and quick setup.However, for production, Vite can indeed support runtime federation by leveraging:
I’ll update the article to clarify that the dist approach is meant to onboard, while runtime federation is better suited for production. Thanks again for your valuable feedback, it helps make the article more complete! 😊
I added the bonus section to the article to explain how :) Thank you
very good tutorial, but angular v19 do not have .\app\app.module.ts, in dist folder, vue generated header.umd.cjs file, react do not generate trending.umd.js.
I passed everything in ESM since it's more standard now. Thank you for the feedback <3
current status - 2024-12-11 - base concept works fine
I added the repository with the overall code working (except for Angular) at the end of the article : github.com/mairouche/mfe-news-portal
Thanks, this is kick-ass.
I have a doubt, how would u share data across these 2 components? Vue to react and vice versa
With Redux for state management for example which is accessible from Vue, React or even Angular.
With RxJS for cross-component events since it's also compatible with each lib/framework.
You can also have shared data in the Shell like following for example :
Absolutely loved this post!!
Thank you very much <3
Thanks for sharing.
This is amazing.
This is exactly what's happening in Astro behind the hood.
Correct me if I'm wrong.
To be Honest I discovered Astro with a previous comment and I'll deep dive into it. It looks like the same with Astro being maybe a bit more opinionated and closer to a framework than a library. But I'll look for it to see if I well understood
After deep diving into astro and trying it (only for 2 days so not that much background at this stage), this is what I conclude :
dev.to/mairouche/comment/2ka02
How does the router work in this case?
This is a good question. I was affraid that the article would be too long if I deep dived into routing, state, refs etc...
I'll answer here then.
In the Shell, you can use a vue or react router (what you prefer) to route to any kind of component. For example :
Once the microfrontend is loaded throught the global Shell router, it uses its own internal router if it has one.
So a good practice would be to keep the Global Shell router just load the micr-frontends and then, each micro-frontends having its own dedicated standalone router.
Thanks for this post i will try this with angular
Absolutely agree with your points. This is a game-changer!
Thanks
Couldnt integrate angular app, got error:
Uncaught SyntaxError: The requested module '/apps/highlights/dist/main.js' does not provide an export named 'mount' (at main.js:3:10)
has anyone make it run successful?
Depends on the version. Try with this in src/main.js:
got an abnormal main.js file under dist folder:
Do you mind sharing your full project code? this is really interesting...i have never seen a solution like this...
I update to last versions and share it tomorrow. I ping you in comment when it's done
@lwz7512 Indeed, I was using module federation with old Angular versions. I will find out what's the best approach between, widgets, module federation or web component and propose it in an edit of the article.
Like it!
Gr8 explaination and systematic approach. Got to learn a lot.🙌
Integrating multiple technologies within a micro frontend architecture is generally regarded as a suboptimal design choice. This approach can lead to significant performance issues, as it necessitates loading numerous technology libraries alongside each component, resulting in a bloated and resource-intensive application. Moreover, the complexity introduced by this multi-technology setup can make maintenance and management exceptionally challenging.
A more streamlined and efficient approach is to standardize on a single library or framework across the micro frontend ecosystem. This strategy offers several advantages:
By focusing on a unified technology stack, development teams can create more cohesive, performant, and maintainable micro frontend applications that align better with the core principles of this architectural pattern.
Agree. This is why I explained in the article that it can be a solution (temporary one) to shift from a framework to another smoothly here :
For example, in my experience, we transitionned form Angular to Vue step by step thanks to this approach. I'm not saying it's a desirable design but it's an existing one. Used in the appropriate context, it can bring value.
did you have any luck with precious angular versions , eg 18?
I succeed with module federation from Angular 16- but it's not that simple. I'm still testinfg things but Vue and React are Libraries whereas Angular, as a Framework, has it's own event, state, data management etc... So it's not that easy.
i wonder how to manage route?