<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Şükriye Soyer on Medium]]></title>
        <description><![CDATA[Stories by Şükriye Soyer on Medium]]></description>
        <link>https://medium.com/@sukriyesoyer?source=rss-b71a0f23e68d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Dcm3DFNAjGnwBGZcaRw4Yg.jpeg</url>
            <title>Stories by Şükriye Soyer on Medium</title>
            <link>https://medium.com/@sukriyesoyer?source=rss-b71a0f23e68d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 12:22:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sukriyesoyer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Micro Frontend Architecture]]></title>
            <link>https://medium.com/@sukriyesoyer/micro-frontend-architecture-cea856954033?source=rss-b71a0f23e68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cea856954033</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[micro-frontends]]></category>
            <dc:creator><![CDATA[Şükriye Soyer]]></dc:creator>
            <pubDate>Wed, 30 Mar 2022 09:30:19 GMT</pubDate>
            <atom:updated>2022-05-04T16:27:33.079Z</atom:updated>
            <content:encoded><![CDATA[<p>Microservice architecture is characterized by independent services that are focused on a specific business function and maintained by small, self-contained teams. <a href="https://medium.com/ebebek-tech/e-bebek-microservis-yap%C4%B1s%C4%B1-11183f017aa9">Microservice architectures</a> are used frequently for web applications developed on <a href="https://www.e-bebek.com/">E-bebek,</a> and for good reason. They offer many well-known benefits such as development agility, technological freedom, targeted deployments, and more. Despite the popularity of microservices, many frontend applications are still built in a monolithic style.</p><p>In this article, I’ll describe a recent trend of breaking up frontend monoliths into many smaller, more manageable pieces, and how this architecture can increase the effectiveness and efficiency of teams working on frontend code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*yIjz_NvjGxzvGjBG12thmg.png" /></figure><h3>What is a Micro-frontend?</h3><p>Micro Frontend is a Microservice Testing approach to front-end web development. The current trend is to build a powerful and feature-rich web application that resides on top of a Microservice architecture. Over time the Micro Frontend Architecture becomes a part of the application, often it is developed by a separate team, grows, and gets more difficult to maintain, this type of application is called Frontend Monolith.</p><blockquote>The idea behind Micro Frontends is to think about a website or web app as <strong>a composition of features</strong> that are owned by <strong>independent teams</strong>. Each team has a <strong>distinct area of business</strong> or <strong>mission</strong> it cares about and specializes in. A team is <strong>cross-functional</strong> and develops its features <strong>end-to-end</strong>, from database to user interface.</blockquote><p><strong>Monolithic Frontends</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*35CH3rrumv-HwWExeml-lA.png" /><figcaption><em>Figure 1: </em><strong>Monolithic Frontends</strong></figcaption></figure><p><strong>Micro-frontends</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Plv-5-O8_E-DZWvgQZDKaw.png" /><figcaption><em>Figure 2: </em><strong>Micro-frontends</strong></figcaption></figure><h3>Core Ideas behind Micro Frontends</h3><p><strong>Be Technology Independent</strong></p><p>Each team should choose and upgrade the stack without coordinating with other teams. Custom elements help to hide implementation details while providing a neutral interface to others.</p><p><strong>Isolate Team Code</strong></p><p>Never share a runtime, even if teams use the same framework. Build an independent application self-contained. Do not rely on shared state or global variables.</p><p><strong>Create Team Prefixes</strong></p><p>Use naming conventions where isolation is not possible yet. Namespace CSS, Local Storage, Events, and Cookies to avoid collisions and clarify ownership.</p><p><strong>Favor Native Browser Features over Custom APIs</strong></p><p>Instead of building a global PubSub system, use browser events for communication. If there is a need to build a cross-team API, try to keep it as simple as possible.</p><p><strong>Build a Resilient Web design</strong></p><p>The features should be useful, even if JavaScript is unable to execute. To improve perceived performance, use universal rendering and progressive enhancement.</p><h3><strong>The Benefits of Micro Frontend Architecture</strong></h3><ul><li><strong>Independent deployment: </strong>A core tenet of microservice development is that artifacts can be deployed independently, and this remains true for micro-frontends. In a micro-frontend architecture, teams should be able to independently deploy their frontend applications with minimal impact on other services.</li><li><strong>Flexible technology choices: </strong>Autonomy allows each team to make technology choices that are independent of other teams. For instance, the billing service team could develop their micro-frontend using Vue.js and the profile service team could develop their frontend using Angular.</li><li><strong>Scalable development: </strong>Micro-frontend development teams are smaller and are able to operate without disrupting other teams. This allows us to quickly scale development by spinning up new teams to deliver additional frontend functionality via child applications.</li><li><strong>Easier maintenance:</strong> Keeping frontend repositories small and specialized allows them to be more easily understood, and this simplifies long-term maintenance and testing. For instance, if you want to change an interaction on a monolith frontend, you must isolate the location and dependencies of the feature within the context of a large codebase. This type of operation is greatly simplified when dealing with the smaller codebases associated with micro-frontends.</li><li><strong>Ease of testing:</strong> The testing becomes very simple, and for every small change, you don’t have to go and touch the entire application.</li></ul><h3>Sample Application</h3><p>Below I describe <strong><em>an example</em></strong><em> </em>application that uses micro frontends. Imagine a website where customers can order food for delivery. On the surface, it’s a simple concept, but there’s a surprising amount of detail if you want to do it well:</p><p>· There should be a<strong> landing page</strong> where customers can browse and search for restaurants. The restaurants should be searchable and filterable by any number of attributes including price, cuisine, or what a customer has ordered previously.</p><p>· Each restaurant needs its<strong> own page</strong> that shows its menu items and allows a customer to choose what they want to eat, with discounts, meal deals, and special requests.</p><p>· Customers should have a<strong> profile page </strong>where they can see their order history, track delivery, and customize their payment options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*ESqLFJ2C2G1IHR6xcSjAzA.png" /><figcaption><em>Figure 3: </em>A website where customers can order food for delivery</figcaption></figure><p>There is enough complexity in each page that we could easily justify a dedicated team for each one, and each of those teams should be able to work on their page <strong>independently</strong> of all the other teams. They should be able to develop, test, deploy, and maintain their code without worrying about <strong>conflicts or coordination</strong> with other teams. Customers, however, should still see a single, seamless website.</p><h3>Integration Approaches Micro Frontends</h3><p>There are many approaches that could reasonably be called micro frontends. We are considering three ‘integration approaches’.</p><h4>· Build-time integration</h4><h4>· Server-side integration</h4><h4>·Run-time integration</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*WrNgYj1Zs0XsT424Zc6cTQ.png" /><figcaption><em>Figure 4: </em>Integration Approaches Micro Frontends</figcaption></figure><h4>Build-time integration</h4><p>In our transformation from monolith to micro frontends, initially, we integrated them during <strong>build time</strong>. This approach that we sometimes see is to publish each micro frontend as a package and have the container application include them all as library dependencies. Here is how the container’s package.json might look for our example app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*ojg0aZVu6FAXKShlM-Qu-g.png" /></figure><p>At first, this seems to make sense; however, this approach means that we have to re-compile and release every single micro frontend in order to release a change to any individual part of the product. Just as with microservices, we’ve seen enough pain caused by such a <strong>lockstep release process</strong> that we would recommend strongly against this kind of approach to micro frontends. We should find a way to integrate our micro frontends at <strong>run-time</strong>, rather than at build-time.</p><h4>Server-Side Integration</h4><p>SSI is rendering HTML on the server from multiple templates or <strong><em>fragments</em></strong>. These fragments represent the micro frontends. In the example below, an <em>index.html is shown</em>, which uses <em>server-side includes </em>to include a fragment of HTML files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*iS7ZAw-HUkp5oTtM9mMGEg.png" /></figure><p>We serve this file using <strong>Nginx</strong>, configuring the $PAGE variable by matching against the URL that is being requested:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*UscB46Og28ynpIbLiqnMKQ.png" /></figure><h4><em>Nginx:</em></h4><p>What is not shown here is how those various fragment HTML files end up on the webserver. The assumption is that each has its own build <strong>pipeline</strong>, allowing us to make changes to one fragment without affecting another page.</p><p><em>Each of these servers can be built and deployed independently.</em> For even greater independence, there could be a separate server responsible for rendering and serving each micro frontend, with one server out the front that makes requests to the others. With careful caching of responses, this could be done without impacting latency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*B42BrAhhdeNyuSZ_ejXt_Q.png" /><figcaption><em>Figure 5: These servers can be built and deployed too independently</em></figcaption></figure><h4><strong>Run-time integration</strong></h4><h4>Run-time integration via Web Components</h4><p>An index.html is shown below which simulates our sample application (ordering food). The example is clearly a primitive example, but it demonstrates the runtime integration via web components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*3hoS6toTFbmCoFoD7NTm2g.png" /></figure><p>At the top, our micro frontends are included with <strong>&lt;script&gt; tags</strong>. The <strong>micro-frontend-order-food</strong> just discussed, is defined in the JavaScript bundle: <strong>https:// order.example.com/bundle.js</strong></p><p>The constant <em>webComponentType</em> contains the actual selected micro frontend based on the selected route via: <strong>window.location.pathname </strong>Using <strong>document.createElement(web ComponentType)</strong> we instantiate the selected micro frontend. Finally, it is linked to the placeholder: &lt;div id=”micro-frontend-root”&gt;. This is done with <strong>root.appendChild(webComponent)</strong>.</p><h4>Run-time integration via iframes</h4><p>By their nature, iframes make it easy to build a page out of independent sub-pages. They also offer a good degree of isolation in terms of styling and global variables not interfering with each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*R4ajlWQWIn413KoxqacX0g.png" /></figure><p>When we consider the benefits of micro frontends listed earlier, iframes are most appropriate, as long as we’re careful about how we slice up the application and structure our teams.</p><p>On the other hand, the <strong>easy isolation</strong> mentioned above does tend to make them<strong> less flexible </strong>than other options. It can be difficult to build integrations between different parts of the application, so they make routing, history, and deep linking more complicated, and they present some extra challenges to making your page fully responsive.</p><h4>Run-time integration via JavaScript</h4><p>Teams adopting run time integration via JavaScript <strong>most frequently</strong>, probably the <strong>most flexible</strong> one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*t-FyiJRH1st5R0SMQXPESg.png" /></figure><p>Each micro frontend is included on the page using a &lt;script&gt; tag, and upon load exposes a global function as its entry-point. The container application then determines which micro frontend should be mounted and calls the relevant function to tell a micro frontend when and where to render itself.</p><p>Unlike with build-time integration, we can deploy each of the bundle.js files independently. And unlike with iframes, we have full flexibility to build integrations between our micro frontends however we like.</p><h3>Which Integration Approach to Use?</h3><p>You can deduce which integration approach you can use in which situation. For <strong>small and/or non-complex applications</strong> (where 1 or 2 teams are working) you can <em>ignore</em> the integration approaches and just assume a frontend <strong>monolith</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*gMB9OqowGY6jggnFr_PdHA.png" /><figcaption><em>Figure 6: </em>Integration Approaches</figcaption></figure><h3>Communication Between Micro Frontends</h3><p>It is generally recommended that the micro frontends communicate as little as possible as this introduces an unwanted link that we are trying to avoid in the first place. That said, a certain amount of communication between micro frontends is often required.</p><p>In this example, the only requirement we have is that the browsing page needs to tell the restaurant page which restaurant to load. Here we will see how we can use <strong><em>client-side routing</em></strong> to solve this problem.</p><p>All three React applications involved here are using React Router for declarative routing but are initialized in two slightly different ways. For the container application, we create a- &lt;BrowserRouter&gt;, which internally will instantiate an history object. This is the same history object that we&#39;ve been glossing over previously. We use this object to manipulate the client-side history, and we can also use it to link multiple React Routers together. Inside our micro frontends, we initialize the Router like this:</p><pre>&lt;Router history={<strong>this</strong>.props.history}&gt;</pre><p>All the &lt;Router&gt; instances are now connected, so route changes triggered in any of them will be reflected in all of them. This gives us an easy way to pass “parameters” from one micro frontend to another, via the URL. For example, in the browse micro frontend, we have a link like this:</p><pre>&lt;Link to={`/restaurant/${restaurant.id}`}&gt;</pre><p>When this link is clicked, the route will be updated in the container, which will see the new URL and determine that the restaurant micro frontend should be mounted and rendered. That micro frontend’s own routing logic will then extract the restaurant ID from the URL and render the right information. In this architecture, it can be a useful way to communicate intent across micro frontends.</p><p><em>We can use another method for the communication of micro frontends. </em><strong><em>Custom events</em></strong> allow micro frontends to communicate <em>indirectly.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*rnVY51K7eb8ekDDgy9P08g.png" /></figure><p>Events can be created with the ‘<em>Event constructor</em>’ as follows: <strong>New Event(‘build’) </strong>For example, the <strong>dispatchEvent</strong> can be initiated in <strong>micro frontend X</strong> to dispatch an <em>event</em> called: ‘build’. <strong>Micro frontend Y</strong> then listens for this event (using the <strong>addEventListener</strong> method) and handles further processing.</p><h3>Conclusion</h3><p>Micro-frontend architectures introduce many of the familiar benefits of microservice development to frontend applications. A micro-frontend architecture also simplifies the process of building complex frontend applications by allowing you to manage small, independent components. That is why today, micro frontend architecture is widely used by many large companies. Thank you for reading this article :)</p><h3>References:</h3><ul><li><a href="https://micro-frontends.org/">Micro Frontends</a></li><li><a href="https://martinfowler.com/articles/micro-frontends.html">Micro Frontends</a></li><li><a href="https://aws.amazon.com/tr/blogs/architecture/micro-frontend-architectures-on-aws/">Micro-frontend Architectures on AWS | Amazon Web Services</a></li><li><a href="https://www.xenonstack.com/insights/micro-frontend-architecture">Micro Frontend Architecture and Best Practices</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cea856954033" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>