<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alejandro Ramírez Jiménez</title>
    <description>The latest articles on DEV Community by Alejandro Ramírez Jiménez (@alejandrorzjz).</description>
    <link>https://dev.to/alejandrorzjz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1227563%2F2e5a29b6-5878-4580-b0c4-2a219153bc8c.jpg</url>
      <title>DEV Community: Alejandro Ramírez Jiménez</title>
      <link>https://dev.to/alejandrorzjz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alejandrorzjz"/>
    <language>en</language>
    <item>
      <title>Getting started with Microfrontends: Key Concepts and Strategies</title>
      <dc:creator>Alejandro Ramírez Jiménez</dc:creator>
      <pubDate>Tue, 02 Jan 2024 13:05:29 +0000</pubDate>
      <link>https://dev.to/playfulprogramming-angular/getting-started-with-microfontends-key-concepts-and-strategies-510k</link>
      <guid>https://dev.to/playfulprogramming-angular/getting-started-with-microfontends-key-concepts-and-strategies-510k</guid>
      <description>&lt;p&gt;This lecture is aimed at individuals who are considering learning about MFEs and potentially implementing them in their current projects. I strongly recommend reading the &lt;a href="https://dev.to/this-is-angular/when-you-should-embrace-mfes-2bng"&gt;the first article&lt;/a&gt; since it will give you an overall image of this series.&lt;/p&gt;

&lt;p&gt;In this lecture, I aim to guide you through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The main concepts.&lt;/li&gt;
&lt;li&gt;How to identify different roles&lt;/li&gt;
&lt;li&gt;The technology required and how it works.&lt;/li&gt;
&lt;li&gt;Options when distributing the code.&lt;/li&gt;
&lt;li&gt;Initial technical implementation&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;This lecture will focus more on concepts and ideas rather than specific technical solutions.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
The main concepts.

&lt;ul&gt;
&lt;li&gt;Shell&lt;/li&gt;
&lt;li&gt;Microfrontends&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

How to identify the different roles

&lt;ul&gt;
&lt;li&gt;Shell&lt;/li&gt;
&lt;li&gt;Microfrontend&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

The technology required and how it works

&lt;ul&gt;
&lt;li&gt;Web Components&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Polyrepo versus monorepo

&lt;ul&gt;
&lt;li&gt;Polyrepo&lt;/li&gt;
&lt;li&gt;Monorepo&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Initial Technical Implementation&lt;/li&gt;

&lt;li&gt;Wrapping it up&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  The main concepts.
&lt;/h2&gt;

&lt;p&gt;When we are talking about the Microfrontends world, the &lt;code&gt;MFE (Microfrontend)&lt;/code&gt; is the main concept used to talk about this, but there are a few other concepts that you should know:&lt;/p&gt;

&lt;h3&gt;
  
  
  Shell
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;Shell&lt;/code&gt; is an application that can work independantly, typically with an architecture almost identical to a &lt;code&gt;SPA (Single Page Application)&lt;/code&gt;. It's distinct feature is that the Shell can host another applications, known as &lt;code&gt;MFEs (Microfrontends)&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Microfrontends
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;Microfrontend&lt;/code&gt; is a application that &lt;em&gt;cannot be displayed by itself&lt;/em&gt;. The purpose of a &lt;code&gt;Microfrontend&lt;/code&gt; is to be hosted by a &lt;code&gt;Shell&lt;/code&gt; and will act as a piece of it, the difference being invisible to the user when browsing the website.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A &lt;code&gt;Microfront&lt;/code&gt; can be also used with a &lt;code&gt;standalone operation&lt;/code&gt;. It is an architectural decision supported, being the most useful use case for local development.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How to identify the different roles
&lt;/h2&gt;

&lt;p&gt;Now that we have our two main pieces identified (&lt;code&gt;Shell and Microfrontend&lt;/code&gt;), it's time to differentiate the parts of the current &lt;code&gt;SPA (Single Page Application)&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shell
&lt;/h3&gt;

&lt;p&gt;When we talk about a &lt;code&gt;Shell&lt;/code&gt;, we talk about a host, about a container, and about what's common and mandatory in a &lt;code&gt;SPA&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If for example, our SPA is a &lt;code&gt;modulith&lt;/code&gt;, or applies &lt;code&gt;frontend DDD&lt;/code&gt;, then we have to look for the part of the application that invokes the different &lt;em&gt;modules&lt;/em&gt; or &lt;em&gt;domains&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;Shell&lt;/code&gt; should be in charge of distributing the different sections of the application, and bringing to the table the common space for them to load. Normally what a &lt;code&gt;Shell&lt;/code&gt; contains and does, is a header bar, handles the authentication, and handles the shared procceses.&lt;/p&gt;

&lt;h3&gt;
  
  
  Microfrontend
&lt;/h3&gt;

&lt;p&gt;When we talk about a &lt;code&gt;Microfrontend&lt;/code&gt;, we are talking about a section, a piece of an application, and just a certain area of the &lt;code&gt;SPA&lt;/code&gt; that does not need to communicate or has dependencies with other areas.&lt;/p&gt;

&lt;p&gt;Following the example of the &lt;code&gt;modulith&lt;/code&gt; or &lt;code&gt;frontend DDD&lt;/code&gt; SPA, it's time to look for the lazy loaded modules or domains that our application contains.&lt;/p&gt;

&lt;p&gt;For instance, in a banking application, if the &lt;code&gt;Shell&lt;/code&gt; encompasses the header bar and the authenthication procceses, our Microfrontends could be the &lt;em&gt;Accounts&lt;/em&gt; section, or the &lt;em&gt;Credit Cards&lt;/em&gt; section.&lt;/p&gt;

&lt;p&gt;Another way of looking at it is the Microsoft example, where Microsoft suite is the &lt;code&gt;Shell&lt;/code&gt; and the different applications such as Word, Excel, Powerpoint are the &lt;code&gt;Microfronts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;Microfrontend&lt;/code&gt; should be responsible for a very specific area of the entire application. This area normally is independent from another &lt;code&gt;MFEs&lt;/code&gt; (areas) but still needs the &lt;code&gt;Shell&lt;/code&gt; context in order to see the whole picture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fok2sumz1iqgl9x33hn4m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fok2sumz1iqgl9x33hn4m.png" alt="Representation of Shell and MFE roles where the MFEs are inside of it" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The technology required and how it works
&lt;/h2&gt;

&lt;p&gt;Now that we have established the concepts and identified the different components, the next step is to understand the neccesary technology for this ecosystem.&lt;/p&gt;

&lt;p&gt;The technology used is called &lt;em&gt;Module federation&lt;/em&gt;. This technology aims to have multiple separate builds that will form a Single Application when combined.&lt;/p&gt;

&lt;p&gt;You can read more in depth &lt;a href="https://webpack.js.org/concepts/module-federation/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Again, using an example of &lt;code&gt;modulith architecture&lt;/code&gt;, what we are looking for is that those &lt;code&gt;lazy loaded modules&lt;/code&gt;, that will be &lt;em&gt;remote modules&lt;/em&gt; and are going to be known only at a runtime.&lt;/p&gt;

&lt;p&gt;Now mixing this with the concept we have talked previously, what we are looking for, is that the &lt;code&gt;Shell&lt;/code&gt;, will load those bundles at &lt;em&gt;runtime&lt;/em&gt;. Being those bundles, the &lt;code&gt;Microfrontends&lt;/code&gt;, whose have been built before, now have it's bundles exposed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web Components
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;Web Component&lt;/code&gt; or &lt;code&gt;Custom Element&lt;/code&gt; in certain aspects is similar to a &lt;code&gt;Microfrontend&lt;/code&gt;. It's an encapsulation of some part or the whole application. This Web Component can be loaded with HTML tags, for example &lt;code&gt;&amp;lt;my-webcomponent&amp;gt;&amp;lt;/my-webcomponent&amp;gt;&lt;/code&gt;.&lt;br&gt;
It is used to implement multi version or multi framework in the ecosystem.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A Web Component is a piece that not neccesarily has to be used in the Microfrontend ecosystem, but often appears.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Polyrepo versus monorepo
&lt;/h2&gt;

&lt;p&gt;When it comes to code distribution, we primarily have two options, &lt;code&gt;Polyrepo&lt;/code&gt; and &lt;code&gt;Monorepo&lt;/code&gt;. &lt;br&gt;
Now that the application has been sliced into different parts, it can be appropriate to divide the repository into multiple repositories.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhwkd7dit1d98ov9tzoo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhwkd7dit1d98ov9tzoo.png" alt="Representation of Monorepo and Polyrepo, portraying the git icon in monorepo just one time and in polyrepo for each project" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Polyrepo
&lt;/h3&gt;

&lt;h4&gt;
  
  
  When it works
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;When the different teams need &lt;strong&gt;large autonomy, different pipelines, resources and isolation&lt;/strong&gt;. This normally fits for large companies where the final application is only one, and every small part and team is and has a whole different world with their own budget and resources.&lt;/li&gt;
&lt;li&gt;Where the &lt;strong&gt;different teams are small&lt;/strong&gt;, it becomes more approchable with the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cons
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Sharing code: Since each project has its own repository, it can be challenging to share code between projects. This can lead to duplicated code and a lack of consistency in dependencies, which can increase the risk of errors and make it more difficult to maintain the codebase over time. However, this limitation &lt;strong&gt;can be mitigated by implementing effective dependency management and common libraries developed by the company.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make it harder to have shared dependencies because of potentially different dependency versions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Demand for better coordination: With separate repositories and teams now &lt;strong&gt;the need for good coordination increases&lt;/strong&gt;. Especially in this ecosystem of Microfrontends, where Shell and Microfrontends have to communicate with each other to ensure a correct implementation. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Monorepo
&lt;/h3&gt;

&lt;h4&gt;
  
  
  When it works
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;There aren't too many teams. It also works with a great number of them but it is a different approach on how to develop a common application (suite).&lt;/li&gt;
&lt;li&gt;When a lot of code has to be shared between projects.&lt;/li&gt;
&lt;li&gt;Developers have way easier access to all the code across the applications&lt;/li&gt;
&lt;li&gt;When the pipeline of CI/CD can be the same accross different parts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cons
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Large codebase, that slows down every git interaction.&lt;/li&gt;
&lt;li&gt;If different parts need different pipelines, it will be harder to implement than usual.&lt;/li&gt;
&lt;li&gt;Limited flexibility of languages and frameworks, while it's still possible in monorepo, it increases the complexity and makes it harder to maintain.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In either option, &lt;code&gt;monorepo&lt;/code&gt; or &lt;code&gt;polyrepo&lt;/code&gt;, have been and are being used by big enterprises so don't worry about what options are the best. &lt;strong&gt;What is important is what fits the situation the best.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Initial Technical Implementation
&lt;/h2&gt;

&lt;p&gt;In this lecture I am not going to go through a full technical implementation, but, I strongly recommend the very same book I learnt from the first time I discovered &lt;code&gt;Microfrontends&lt;/code&gt;. It's the amazing book from &lt;strong&gt;AngularArchitects.io&lt;/strong&gt; named &lt;strong&gt;Enterprise Angular: Micro Frontends and Moduliths with Angular&lt;/strong&gt;. You can download by free &lt;a href="https://www.angulararchitects.io/en/ebooks/micro-frontends-and-moduliths-with-angular/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. &lt;br&gt;
You will learn more about &lt;code&gt;Microfrontends&lt;/code&gt; and be able to make your own implementations.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Before continuing the series of article, I strongly recommend completing the book completely.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Wrapping it up
&lt;/h2&gt;

&lt;p&gt;With this lecture, you should now be able to understand the main concepts about Microfrontends and also be able to apply them to an existing project and get some code running. In the following articles, different challenges and solutions will be explained in more depth.&lt;/p&gt;

&lt;p&gt;I hope you have enjoyed reading this lecture and that it has been useful to you, for any question you might have, you can contact me in any of my linked social medias. Make sure to follow me for more content about frontend!. Thank you!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>frontend</category>
      <category>angular</category>
      <category>microfrontends</category>
    </item>
    <item>
      <title>When you should embrace MFEs.</title>
      <dc:creator>Alejandro Ramírez Jiménez</dc:creator>
      <pubDate>Wed, 13 Dec 2023 17:09:56 +0000</pubDate>
      <link>https://dev.to/playfulprogramming-angular/when-you-should-embrace-mfes-2bng</link>
      <guid>https://dev.to/playfulprogramming-angular/when-you-should-embrace-mfes-2bng</guid>
      <description>&lt;p&gt;Since some time ago, there has been growing criticism towards Microfrontends (&lt;code&gt;MFEs&lt;/code&gt;) with the assertion that "&lt;em&gt;if Microfrontends are needed, it's due to organizational problems.&lt;/em&gt;"&lt;/p&gt;

&lt;p&gt;I think this statement holds some truth as it is indeed related to organizational challenges. However, in these situations, &lt;strong&gt;the code must be adapted to address these issues effectively&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this lecture, I aim to guide you through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When Microfrontends are neccessary&lt;/li&gt;
&lt;li&gt;The problems Microfrontends solve&lt;/li&gt;
&lt;li&gt;Unmask the myth that Microfrontends are harmful&lt;/li&gt;
&lt;li&gt;The challenges that accompany Microfrontends&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;This lecture will focus more on concepts and ideas rather than specific technical solutions.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;This is mainly my opinion based on my experience and research.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
From a Small Project to a Behemoth

&lt;ul&gt;
&lt;li&gt;The First Challenge: Scaling the Team&lt;/li&gt;
&lt;li&gt;The Second Challenge: Budget Constraints&lt;/li&gt;
&lt;li&gt;The Third Challenge: Framework Limitations&lt;/li&gt;
&lt;li&gt;The Current State of the Project&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

MFEs: A Potential Solution

&lt;ul&gt;
&lt;li&gt;Defining Roles&lt;/li&gt;
&lt;li&gt;Module Federation&lt;/li&gt;
&lt;li&gt;Web Components&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Emerging Challenges

&lt;ul&gt;
&lt;li&gt;Normalization&lt;/li&gt;
&lt;li&gt;Bundle?&lt;/li&gt;
&lt;li&gt;Contractual Coordination&lt;/li&gt;
&lt;li&gt;Routing Considerations&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Wrapping it up&lt;/li&gt;

&lt;li&gt;Interesting Links&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  From a Small Project to a Behemoth
&lt;/h2&gt;

&lt;p&gt;When a project begins, it is typically small, manageable, and easy to collaborate. &lt;/p&gt;

&lt;p&gt;In the case of a small &lt;code&gt;Single Page Application (SPA)&lt;/code&gt;, a &lt;code&gt;modulith architecture&lt;/code&gt; often provides an efficient and quick solution for web needs.&lt;/p&gt;

&lt;p&gt;The team, around 5-10 people, are able to work together, coordinate, have nice DX and develop and maintain features without any problem.&lt;/p&gt;

&lt;p&gt;Let's say, the project is a huge seller, it's the golden goose of the company, attracting significant attention.&lt;/p&gt;

&lt;h3&gt;
  
  
  The First Challenge: Scaling the Team
&lt;/h3&gt;

&lt;p&gt;As the company invests more in the project, seeking to enhance its speed, power, and scope, &lt;strong&gt;they increase the team's size&lt;/strong&gt;. Soon, 20 to 30 people are working on it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collaboration becomes more challenging, leading to the team dividing into smaller groups&lt;/strong&gt; of about 10 people, each focusing on different modules or domains of the SPA. Despite this, it remains a &lt;code&gt;monorepo SPA&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This growth introduces bureaucratic hurdles. &lt;strong&gt;Every new feature or library addition impacting the entire ecosystem requires alignment with all teams.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Second Challenge: Budget Constraints
&lt;/h3&gt;

&lt;p&gt;Over time, some sections of the website gain more popularity or importance, leading to a reallocation of resources and reshuffling of teams. This results in &lt;strong&gt;uneven development capabilities across different groups&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Time keeps passing and your favorite framework (Angular❤️) has released a new shining version that brings a lot of interesting features to the table. Some of the teams are eager to upgrade inmediately, because the new control flow syntax it's amazing, but, others lack the resources required to migrate in that moment and &lt;strong&gt;can not afford the breaking changes and adapt their code&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Third Challenge: Framework Limitations
&lt;/h3&gt;

&lt;p&gt;When the product continues to be successful, the company will want to hire more people, invest more resources and make it even bigger, but they find a shocking surprise:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;❗They cannot find more Angular developers❗&lt;/em&gt;. The company already contains a lot of them, but there are not enough developers in the market, and even less with strong skills in Angular.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hiring developers from other frameworks and training them poses a significant financial burden.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Current State of the Project
&lt;/h3&gt;

&lt;p&gt;Now the project is in a tight spot, although the client that uses the application does not feel any of these problems, thanks to modulith, the efficiency of the website keeps feeling contingent, but, &lt;strong&gt;our DX is getting worse and worse&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The codebase has grown enormous, leading to &lt;strong&gt;long build and deploy times, and local development becoming increasingly painful&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcd47uomrqb4bxfv4429l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcd47uomrqb4bxfv4429l.png" alt="The problems" width="428" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  MFEs: A Potential Solution
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Defining Roles
&lt;/h3&gt;

&lt;p&gt;After all the problems we have discussed, let's now introduce our hero of the day. &lt;strong&gt;Microfrontends&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let's apply &lt;code&gt;MFEs&lt;/code&gt; to the &lt;code&gt;SPA&lt;/code&gt; we have been talking about. The first step is to designate the &lt;code&gt;Shell&lt;/code&gt; and the others &lt;code&gt;MFEs&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;Shell&lt;/code&gt; will handle common functionalities across the application, including authentication, relieving the &lt;code&gt;MFEs&lt;/code&gt; of these concerns.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each team, previously working on a specific module or section, now oversees an individual &lt;code&gt;MFE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This leads to splitting our &lt;code&gt;SPA monorepo&lt;/code&gt; into multiple repositories, one for the &lt;code&gt;Shell&lt;/code&gt; and others for each &lt;code&gt;MFE&lt;/code&gt;. Each now operates as a separate application with its own deployment and build processes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Module Federation
&lt;/h3&gt;

&lt;p&gt;Now we can integrate Webpack Module Federation, for example with the library of &lt;a href="https://www.npmjs.com/package/@angular-architects/module-federation" rel="noopener noreferrer"&gt;AngularArchitects.io&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Remember&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;As said, this lecture focuses more on the idea and concepts. For a technical solution, I recommend reading the series of post of AngularArchitects.io&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;At this stage, we have already solved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Team Scalability&lt;/strong&gt;: Teams can work independently, reducing conflict risks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Framework Flexibility&lt;/strong&gt;: Adoption of different frameworks (e.g., React) becomes feasible within teams.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But what about budget constraints?&lt;/p&gt;

&lt;h3&gt;
  
  
  Web Components
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Web components allows us to encapsulate even further our Microfrontends&lt;/strong&gt;, solving the existing problems with pure &lt;code&gt;MFEs&lt;/code&gt; about conflicts in namespace, css and dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This allows for different Angular versions&lt;/strong&gt; within the &lt;code&gt;Shell&lt;/code&gt; and various &lt;code&gt;MFEs&lt;/code&gt;.&lt;br&gt;
For example, the &lt;code&gt;Shell&lt;/code&gt; might run &lt;code&gt;Angular 17&lt;/code&gt;, while a budget-constrained &lt;code&gt;MFE&lt;/code&gt; continues on &lt;code&gt;Angular 15&lt;/code&gt;, yet they still function cohesively and they can communicate with each other through &lt;code&gt;Web Component&lt;/code&gt; using &lt;code&gt;Inputs&lt;/code&gt; and &lt;code&gt;Outputs&lt;/code&gt; (Outputs transformed to &lt;code&gt;CustomEvent&lt;/code&gt; by itself) or a whole own implementation for communication purposes based on &lt;code&gt;custom events&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Module federations allows using shared services for sharing state but when using different versions of the framework this is not longer possible, because &lt;strong&gt;they have separated Angular Dependency Injection trees with different root scopes&lt;/strong&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Emerging Challenges
&lt;/h2&gt;

&lt;p&gt;Despite its advantages, this new ecosystem introduces its own set of challenges.&lt;/p&gt;

&lt;h3&gt;
  
  
  Normalization
&lt;/h3&gt;

&lt;p&gt;Now we have so many separate artifacts (Shell and MFEs). Before in our &lt;code&gt;SPA&lt;/code&gt; it was as easy as using a &lt;code&gt;shared module&lt;/code&gt;, with this new context we cannot do that. &lt;br&gt;
In order to still have normalization of UI components, styles and etc, &lt;strong&gt;we would need some libraries&lt;/strong&gt;. We can develop libraries for normalization to be used in every single artifact.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;❗ Important!&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;I' am using Shared Modules as an example but they are not a good solution for sharing code.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Bundle?
&lt;/h3&gt;

&lt;p&gt;Now our bundles are smaller, but we have a new problem. &lt;strong&gt;The bundle now depends on versioning&lt;/strong&gt;, and Web Components can increase it significantly. If we have a happy path and every single artifact is &lt;code&gt;Angular 17&lt;/code&gt;, when the client enters the website, it will load the &lt;code&gt;Shell&lt;/code&gt; and the bundles for &lt;code&gt;Angular 17&lt;/code&gt;, the users navigates and everytime it loads a &lt;code&gt;MFEs&lt;/code&gt;, if using &lt;code&gt;Angular 17&lt;/code&gt;, they will just reuse the already download bundle.&lt;/p&gt;

&lt;p&gt;Now let's see another reality, where we have the &lt;code&gt;Shell&lt;/code&gt; and four &lt;code&gt;MFEs&lt;/code&gt; in &lt;code&gt;Angular 17&lt;/code&gt;, another two &lt;code&gt;MFEs&lt;/code&gt; in &lt;code&gt;Angular 16&lt;/code&gt;, and three in &lt;code&gt;Angular 15&lt;/code&gt;. What will happen when the user keeps navigating through those &lt;code&gt;MFEs&lt;/code&gt; is that it will download the bundles for each &lt;code&gt;Angular&lt;/code&gt;, ** increasing the usage of resources in the client.**&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ Important note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;I have used Angular versioning as an example, but this affects to every single dependency, could be the framework, or any library.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Contractual Coordination
&lt;/h3&gt;

&lt;p&gt;Another thing to keep in mind are the contracts. Now the &lt;code&gt;Shell&lt;/code&gt; and &lt;code&gt;MFEs&lt;/code&gt; will communicate mainly through Inputs and Outputs, and those are separated in the &lt;code&gt;Shell&lt;/code&gt; and &lt;code&gt;MFE&lt;/code&gt;, so they have to be very well-defined. &lt;strong&gt;This could be helped with shared libraries&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Routing Considerations
&lt;/h3&gt;

&lt;p&gt;The browser of our client has only one url sadly, so this means that it should always be delineated as what is being shown on the screen. If we go to a scenario where we have two &lt;code&gt;MFEs&lt;/code&gt; loaded at the same time, and both of them have routing, they will navigate internally but will also modify and replace the url, so now it could be different from what is being shown in the other &lt;code&gt;MFE&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;❗ Important!&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Only the &lt;code&gt;Shell&lt;/code&gt; and maximum one &lt;code&gt;MFE&lt;/code&gt; should have access to the routing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;☝️ But soon...&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;angular-architects is currently developing a &lt;a href="https://www.npmjs.com/package/@angular-architects/microapp" rel="noopener noreferrer"&gt;library&lt;/a&gt; that allows multiple routers, the first stable version should be in the first quarter of 2024&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Wrapping it up
&lt;/h2&gt;

&lt;p&gt;In conclusion, &lt;code&gt;MFEs&lt;/code&gt; can be an excellent solution to solve a vast amount of issues that are not necessarily because of the lack of organization or planning, &lt;strong&gt;but because of the nature of the product itself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Although, there are always new challenges to be solved when working in this ecosystem. In my opinion, for big projects, this solution is mandatory and &lt;strong&gt;new challenges can be solved with robust and thoughtful architecture&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I hope you have enjoyed reading this lecture (my very first article ^^) and that it was useful for you, for any question you might have, you can contact me in any of my linked social media. Thank you!&lt;/p&gt;

&lt;p&gt;Also especial thanks to &lt;a href="https://twitter.com/MikeZks" rel="noopener noreferrer"&gt;MikeZks&lt;/a&gt; for helping me polishing the article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interesting Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.angulararchitects.io/wp-content/uploads/2023/12/report.pdf" rel="noopener noreferrer"&gt;Report of Architects.io about MFEs and its usage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.angulararchitects.io/en/blog/the-microfrontend-revolution-module-federation-in-webpack-5/" rel="noopener noreferrer"&gt;How to use Module Federation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Banner by &lt;a href="https://www.artstation.com/emilyalvin" rel="noopener noreferrer"&gt;Emily Alvin&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>microfrontends</category>
    </item>
  </channel>
</rss>
