It is not actually abbreviated as best friend forever, but it is. Actually, the abbreviation of BFF is back-end for front-end, which acts as a best friend for microfrontend, as well as microservice. So if you closely look at this diagram, the communication between the microfrontend and the microservice is not directly connected. So it is happening via BFF. So here this BFF acts as an intermediate between and also it uses the loads or efforts that a microfrontend should do. So whatever request that comes from the microfrontend is just passed on to the service. Whatever response the service is giving, it transpiles the data in such a manner that a microfrontend can understand it and display it. So the maximum effort of the microfrontend is reduced here.
Also, if we closely look at this diagram here, there won't be any communication between the microfrontends here. Every microfrontend is directly connected to the container, which is called an app shell, and the major decisions are taken only on the container itself. So there is no communication between the microfrontend here. So that's how a microfrontend works.
So when we speak about microfrontends, there are two important strategies that we use. Integration strategies, how we integrate the microfrontends together on a single container So we can just categorize on two different types. One is runtime integration, and the other one is build time integration. So when you say about runtime integration, each microfrontend is bundled and converted to a JavaScript file, and that is binded to the container application on a script tag. And the container will take the decision on what circumstance this particular bundle has to be rendered on the browser. So consider the scenario, a team A decides to develop a component C, and they develop the component, and they deployed it in the path, the domain name slash, the component.js, which is a bundle again. So the user who navigates to the domain, I mean, the container domain, the container app loads the domain, loads the component C, and then it displays in the specific path. So that's the here again, the container takes the control, I mean, entire control. This setup has its own downside as well, because the setting time is too high, and independent deployment is too challenging.
And coming to the other strategy that we have, which is build time integration. So here with this strategy, the NPM registry came as our boon where we can convert our, I mean, the component that we are developing, we can convert that as a package and we can just deploy to our NPM registry, the teams who want to use that particular component, the other micro-frontend team or other autonomous team who wants to use that particular component, they just can install that particular component as a dependency into their application, and they can just use it. The downside of this build time is, again, once you're using any package component as a dependency, the entire bundle has to be rebuilt, their entire application has to be rebuilt. So this bundling time and the rebuild time will be too high.
So there were other concerns over our micro-frontend strategy is that one such concern is working on an autonomous team. So while we were working on an autonomous team, each team just takes care about their own micro-frontend, they don't even care about other teams. But still, there could be a possibility that error could present on a container application, which I define that container, I mean, a bug on the container application is obviously going to be a tedious task, and hard to run a complete experience. If someone wants to specific, I mean, test some specific part of a feature, they have to rebuild the entire application once and then they have to test the particular smaller feature. Again, that's very hard.
Comments