In this article, we will read about how to make a pineapple curry… ahh…sounds different, you are here for micro-frontend but reading about pineapple curry, what the hell is this? Don’t worry, this is just a mind trick to make your brain more active before reading about micro-frontends :) Ok let’s jump into our main topic, micro-frontends.
“In this approach, the web application is broken down into its features, and each feature is owned, frontend to backend, by a different team. This ensures that every feature is developed, tested and deployedindependentlyfromotherfeatures” — ThoughtWorks Technology Radar
micro-frontends team view
Why we are calling it a ‘curry’?
“Curry” is a variety of dishes that use a combination of spices or herbs to make a dish yummy, similarly. Our micro-frontend curry is an approach that uses a combination of frameworks or libraries to make frontend applications yummy, i.e more scalable, testable and manageable.
Why we need Micro-frontend?
A micro-frontend is independent of any framework. This means we can use it with any of the popular frontend libraries, such as Angular, React, or Vue. We can classify it as a solution to solve some of the frontend design problems using available UI frameworks. So let’s understand what these design problems are:
Frontend up-gradation/change is expensive. We are living in the “new” era wherein after every six months we are getting some new technology/framework as a solution to a big industry problem. But upgrading the application technology stack is not as simple and also not as cost-effective as it looks. Using the micro-frontend approach, we can breakdown the application into features and then develop and deploy these features independently. Now in the future, if required, we can change/upgrade a small independent deployable feature rather than concentrating on whole application up-gradation. Also, it's “Easy to get approval from business stakeholders” :)
Monolith on top of microservices: We have seen the advantages of microservice design in backend systems. It brings flexibility in choosing different technology stack, more focused around the business requirement, and also easy to develop and maintain. Bringing all these benefits to the frontend requires a similar design approach which can break down the big monolith frontend hence we termed “Microservices for frontend” as “Micro-frontend”.
Cross-functional over cross-technology team: Most of us are working in an agile managed project delivery process that advocates cross-functional over a cross-technical team (Angular/React team, Java team, DB team, etc.). Benefits are big in terms of client expectation matching and end-product delivery if we align to be cross-functional. Micro-frontend provides the flexibility to have a cross-functional team that focuses on end-to-end delivery.
How we can implement Micro-frontend?
As we know, to make “Pineapple curry”, there are different recipes available. Similarly, to implement Micro-frontend there are different recipesavailable. Some recipes are very easy to execute, and some require heavy lifting. One can choose a recipe/solution based on business requirements. Let me list down some of the solutions here:
Using an iframe: one of the solutions to implementing micro-frontend is using the iframe approach. It’s somehow best suited, but not limited in those scenarios where the business is least bothered about technology up-gradation to implement a feature like single-sign-on. Using iframes, we can host multiple applications under a single parent window. Inter-app communication can be solved using HTML5 custom events. For app bundling and deployment, one could write a custom NPM script.
Using Web Components: There are many ways we can use web components to build micro-frontends. In Angular, we can create sub-applications to develop different apps under a single shell application. In this approach, there are two important items. First, you need a stitching shell to combine all sub-applications and second, a messaging channel that helps with inter-app communication. I would be soon writing a detailed blog on the Angular approach of building micro-frontends
Logical view
The same approach can be used with React as well. Here also we need a stitching shell which aggregates all sub-application at run-time.
microrfrontend using react
3. Readymade framework: There are a few frameworks available in the market which take care of the stitching and inter-app communication task and help you focus more on business feature implementation. Single SPA is one the popular framework which integrates sub-apps on the client-side and provides out-of-box communication layer for sub-app communication. ARA frameworkis a new addition to this list, it internally uses Airbnb’s Hypernova to make micro-frontends run. Tailor.js also helps engineers building micro-frontend easily. It’s a layout service that uses streams to compose a web page from fragment services. It’s partially inspired by Facebook’s BigPipe, but developed in an e-commerce context.
There are many other options available in the market which help you make build micro-frontends using a different recipe. If you want to look at the extended list, I would recommend you to visit awesome-microfrontends. There is also one book published on the same topic, you can find it here.
In the next post, I will deep-dive one of the approaches to understand how we can actually build it. Until then, enjoy your Pineapple CURRY :)
In today’s frontend ecosystem, there is an overflowing ocean of state containers and every developer is sailing with one or the other state container. State container is like an abstraction which helps in managing application state. If you are not aware of what a State container and State is then stop here, and read this blog before continuing. In this tutorial, I’m going to show you how to create a simple “ ToDo” app in React using some of the popular state container choices like, Hooks , Redux , Mobx , and setState . Let’s get started. Quickly, see what we are going to build, I divided the ToDO application in three-part 1. Add Item – this will add a new item in the to-do list 2. Item List – this will compose a list of Items and display ToDo and Completed List 3. Item – leaf level component which has a. Checkbox b. Item text c. Delete 4...
I am sharing my 11 year of technical journey so far. I came to this industry when Flash was leading the game from front. I used to write code in Actionscript and generally do a comparison with Java folks about AS and JAVA similarities. At that time i was writing more of e-learning games/courses in Flash. But then Adobe moved to Flex with more focus to web development. It was a smooth transition for us as we were using same scripting language (AS3) in Flex also. We started learning Flex and chanting the advantages of Flex over JSP/JSF and other server side frontend tooling. I did couple of mid size projects in Flex and then there was a harsh cold wave came from Adobe, they discontinued their development in Flex and donated it to open source community. I felt like a disown child in web ecosystem. Those days were very dark and silenced. I was blaming myself for not choosing Java/ASP as technology option in starting of my carrier. But you can't go back in past and ch...
There is a strong wipe going in the Front-end market regarding ReactJS Openness. Just to tell others who are not aware of this cold wave that “Facebook has moved out maximum of their products from Open source community, i.e React and other Facebook work will no longer be termed as Open Source. For the sake of simplicity and easy reading I am putting the summary of current changes in question-answer format. My Intent here is to make you aware of the current changes so that you can act before time. Please don’t consider me as anti-React for writing this mail, in past, i have evaluated and suggested React to multiple projects (based on their business needs). Let’s start reading about the change now. What is the new license status of ReactJs? BSD + patents license What is this ReactJs new license is all about? “BSD + patents” essentially means that the code is open (for everyone to see and use), but it’s copyrighted by...
Comments
Post a Comment