<?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 Amil Ali on Medium]]></title>
        <description><![CDATA[Stories by Amil Ali on Medium]]></description>
        <link>https://medium.com/@amilaliwaris?source=rss-4c50a7803d10------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bRsOKaOKdhzA1Ja2uisYsQ.png</url>
            <title>Stories by Amil Ali on Medium</title>
            <link>https://medium.com/@amilaliwaris?source=rss-4c50a7803d10------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:50:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amilaliwaris/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[Beyond the API: Using Functional Contracts and Internal RPCs to Architect Resilient Micro-Frontends]]></title>
            <link>https://medium.com/@amilaliwaris/beyond-the-api-using-functional-contracts-and-internal-rpcs-to-architect-resilient-micro-frontends-33238ef02535?source=rss-4c50a7803d10------2</link>
            <guid isPermaLink="false">https://medium.com/p/33238ef02535</guid>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[react-microfrontend]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[eventemitter]]></category>
            <category><![CDATA[micro-frontends]]></category>
            <dc:creator><![CDATA[Amil Ali]]></dc:creator>
            <pubDate>Fri, 06 Mar 2026 19:53:44 GMT</pubDate>
            <atom:updated>2026-03-06T19:53:44.338Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Introduction: Taming the “Wild West” of Distributed Frontends</blockquote><p>In the shift toward Micro-Frontend (MFE) architectures, many teams inadvertently trade a monolithic headache for a distributed nightmare. Without a rigorous communication strategy, you don’t have a decoupled system; you have a “Wild West” of fragmented logic, fraught with race conditions and global namespace pollution. The challenge for any architect is maintaining a Single Source of Truth (SSOT) when the very nature of the architecture is to pull things apart.</p><p>The solution isn’t more global state or heavier libraries. Instead, it lies in an intentional blend of “fake” network calls and functional programming patterns. By treating internal communication as a series of “Functional Contracts” and simulating a network layer within the browser, we can enforce governance and achieve true location transparency.</p><h4>The Internal RPC: Creating an Architectural Illusion of the Network</h4><p>The most effective way to decouple two micro-apps is to make them believe they aren’t in the same browser at all. This is the core of the <strong>Request-Proxy (RP) Pattern</strong>. By using virtual prefixes like RP:// or /rp/ instead of standard function calls, we implement an <strong>Internal RPC (Remote Procedure Call)</strong>.</p><p>The mechanics rely on a central Service Registry: a concrete <strong>Map or Register object</strong> usually defined in the index.js of the host or individual repos. When Micro-App A &quot;calls&quot; a path like RP://getUserData, a central interceptor performs a lookup in this Map to find the corresponding callback function.</p><p>This provides <strong>Location Transparency</strong>, a hallmark of mature distributed systems. As the source material suggests: <em>“The code doesn’t care if the service is a local function in another MFE or a real API on a server. You could swap the ‘RP’ call for a real ‘HTTP’ call later without changing Micro-App A’s logic.”</em> By simulating the network, we eliminate leaky abstractions where one app knows too much about the internal function names of another.</p><h4>Curried Functional Contracts: Inversion of Control as a Governance Tool</h4><p>In this architecture, currying is far more than a mathematical curiosity; it is a mechanism for <strong>Inversion of Control (IoC)</strong>. Traditionally, a feature team might “request” a token or “fetch” an AppID from a global store a pattern that invites tampering and inconsistency.</p><p>By using currying to create “Functional Contracts,” the Core or Shell team flips the script. They “pre-bind” global configurations (AppIDs, environment variables, security tokens) into a utility function <em>before</em> it is ever handed off to a feature team. The Core team is providing the environment, rather than the feature team managing it. This ensures the SSOT remains untampered with across the entire ecosystem.</p><p><em>“We use currying to create ‘Functional Contracts.’ It allows us to inject global context into local utilities, ensuring our Single Source of Truth remains untampered with across distributed teams.”</em></p><h4>The Closure “Backpack”: Leveraging Lexical Scoping for Persistent Memory</h4><p>To understand how these contracts stay valid, we must look at the relationship between the index.js registry and lexical scoping. When a function is curried and registered, it creates a closure an architectural &quot;backpack.&quot;</p><p>This backpack serves as <strong>Persistent Memory</strong> in the Heap. Even after the initial configuration function finishes, critical metadata like Auth Tokens and Env settings stay alive within the closure’s scope. This preserves data integrity through <strong>immutability</strong>: once the Core layer has “zipped the backpack” by currying a value, the Feature team cannot reach inside and change that metadata. It creates an immutable encapsulation boundary that protects the system’s most sensitive context.</p><h4>Zero Prop-Drilling: Decoupling State via Service Factories</h4><p>The closure “backpack” is the specific mechanism that enables us to eliminate one of the most persistent “code smells” in frontend development: prop-drilling.</p><p>In a standard MFE setup, configuration data often has to be passed through multiple layers of the UI tree to reach a remote module.</p><p>By utilizing curried API service factories and Module Federation, we move state management from the UI layer to the architectural layer.</p><p>The <strong>Host</strong> handles the global state (like a Global Auth Token) through a curried function, while the <strong>Remote</strong> module provides the specific endpoint. Because the state is “carried” within the function’s closure, it doesn’t need to be “passed” through components. This centralizes governance at the host level while decentralizing execution to the feature teams, keeping orthogonal concerns strictly separated.</p><h4>The Gatekeeper Pattern: Enforcing a Single Source of Truth via the Pipe</h4><p>To ensure internal event communication remains reliable, we deploy a three-level curried factory that acts as a standardized “Gatekeeper” for the internal event bus:</p><ol><li><strong>Level 1 (Core):</strong> Locks the source metadata (e.g., Source_MFE_ID).</li><li><strong>Level 2 (Contract):</strong> Locks the specific Event_Type.</li><li><strong>Level 3 (Feature):</strong> Accepts the raw data Payload.</li></ol><p>This structure creates a <strong>“Pipe” logic</strong> where the Core team can inject critical operations without the feature teams needing to intervene.</p><p>The sequence — compress(data) -&gt; validate(data) -&gt; log(data) -&gt; emit(data)—happens automatically within the factory. Performance optimizations like compression and telemetry logging become &quot;invisible&quot; infrastructure, handled by the Core team to ensure that every event across the system adheres to the same metadata schema and quality standards.</p><h4>Conclusion: Toward a More Intentional Architecture</h4><p>As architects, our goal is to build systems where the right path is also the path of least resistance. Currying, closures, and the RP pattern are not merely functional programming “tricks”; they are essential pieces of architectural infrastructure. They transform a chaotic collection of micro-apps into a governed, resilient ecosystem.</p><p>By moving away from fragile, hard-coded dependencies and toward a system of virtual routes and functional contracts, we ensure that our components are truly decoupled.</p><p><strong>Final Thought:</strong> Look at your current micro-frontend communication. Is it truly decoupled, or have you simply traded a monolith for a series of fragile, hard-coded dependencies that will break at the first sign of scale?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33238ef02535" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event Propogation | Event Bubbling & Capturing]]></title>
            <link>https://medium.com/@amilaliwaris/event-propogation-event-bubbling-capturing-6153fec70713?source=rss-4c50a7803d10------2</link>
            <guid isPermaLink="false">https://medium.com/p/6153fec70713</guid>
            <dc:creator><![CDATA[Amil Ali]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 14:47:12 GMT</pubDate>
            <atom:updated>2025-12-25T14:47:12.834Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever heard of Event bubbling?</p><p>But, First We need to understand that what is event propogation,</p><p><strong><em>Event propagation describes how events travel through the DOM tree when they’re triggered.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TcD6VkICK8CH9y72" /></figure><p>Most developers have, but few actually understand how it works or why it matters in real world React apps.</p><p><strong><em>Event bubbling in JavaScript is a mechanism where an event triggered on a child element propagates upward through its ancestors in the DOM. It allows parent elements to respond to events triggered by their child elements.</em></strong></p><p><strong>There are three Phases of Event Propagation:</strong></p><p><strong>- Capturing Phase: </strong>In the capturing phase, the event propagates from the root of the DOM down to the target (child). However, no listeners are explicitly set to handle events in this phase.</p><p><strong>- Target Phase: </strong>The event reaches the element that actually triggered it.</p><ul><li><strong>Bubbling Phase: </strong>After reaching the target element (child), the event enters the bubbling phase, propagating back up through the DOM tree to the parent (parent).</li></ul><pre>&lt;div onClick={() =&gt; console.log(&quot;Parent clicked&quot;)}&gt;<br>  &lt;button onClick={() =&gt; console.log(&quot;Child clicked&quot;)}&gt;<br>    Click<br>  &lt;/button&gt;<br>&lt;/div&gt;</pre><p><em>Why is this useful?</em></p><p>The bubbling mechanism enables <strong>Event Delegation</strong>. This is a pattern where a single event listener is attached to a common parent to manage events for multiple child elements, rather than attaching individual listeners to each child. This improves memory usage and code maintainability.</p><p>React follows this same principle internally. Instead of attaching event listeners to every component, React uses event delegation by registering a small number of listeners at the root of the application (typically on the document). These events are handled through React’s Synthetic Event system, which normalizes browser differences and efficiently propagates events through the React component tree.</p><p>Event bubbling is powerful, but uncontrolled bubbling causes bugs.</p><p>Sometimes you don’t want the event to bubble up to parent elements.<br>For example, clicking a button inside a modal should not trigger the modal’s parent click handler.</p><p>In such cases, JavaScript provides a method to prevents further propagation of the current event in the capturing and bubbling phases we can use <strong>stopPropagation()</strong> method.</p><pre>&lt;button onClick={(e) =&gt; e.stopPropagation()}&gt;<br>  Click Me<br>&lt;/button&gt;</pre><p>and <strong>stopImmediatePropagation() — </strong>it will stops all event listeners on the current element</p><p>Use it when:<br>- Nested modals / dropdowns<br>- Preventing parent side-effects</p><p>Avoid it when:<br>- It hides poor component boundaries</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6153fec70713" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to design a  good user interface (UI) design?]]></title>
            <link>https://medium.com/@amilaliwaris/how-to-design-a-good-user-interface-ui-design-7e8b42e27e1a?source=rss-4c50a7803d10------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e8b42e27e1a</guid>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[user-experience-design]]></category>
            <dc:creator><![CDATA[Amil Ali]]></dc:creator>
            <pubDate>Sun, 08 Jan 2023 08:55:03 GMT</pubDate>
            <atom:updated>2023-01-08T08:55:30.135Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6VFfhaBAVlfoxtktYyamg.png" /></figure><p>Here are some 📝 steps to follow in order to design a 🔥 good user interface:</p><p>🧭 Ensure user-friendliness: The interface should be straightforward and easy to navigate.</p><p>🧱 Maintain consistency: Use the same design elements, such as colors, fonts, and icons, throughout the interface to create a cohesive look.</p><p>🌈 Make it visually appealing: Use a pleasing color scheme, eye-catching typography, and other design elements to make the interface appealing and engaging.</p><p>📣 Offer clear feedback: Let users know what’s happening in the interface, whether they take an action or encounter an error.</p><p>🚀 Test and improve: Test the interface with users to identify and resolve any issues.</p><p>📜 Organize content with hierarchy: Use headings, subheadings, and bullet points to help users find what they’re looking for.</p><p>⏳ Use white space effectively: Leave appropriate amounts of empty space between different elements to improve readability.</p><p>💡 Take inspiration from other designs to help guide your own UI design process</p><p>🔆 Use good contrast: Make sure text and other important elements are easy to see by using high-contrast colors.</p><p>📜 Use appropriate font sizes and styles: Choose font sizes and styles that are easy to read.</p><p>🧹 Avoid clutter: Only include essential elements in the interface to keep it clean and uncluttered.</p><p>Also, Checkout my portfolio: <a href="http://amilali.engineer/">www.amilali.engineer</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e8b42e27e1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>