Whats Microfrontends?

Abhinav Vinci
4 min readApr 20, 2023

--

A micro frontend is a microservice that exists within a browser.

Micro frontend is an architectural approach for developing web applications that involve breaking down the front end into smaller pieces.

  • Each piece is responsible for a specific functionality and independent of other pieces.
  • Each piece can be developed and deployed separately.

This allows for greater flexibility, scalability, and faster development cycles.

Microfrontends are sections of your UI

https://www.c-sharpcorner.com/article/micro-frontends-with-webpack/

Benefits of microfrontends?

With micro frontends, teams can work independently on different parts of the application without worrying about interfering with other teams. This approach allows for the development of complex, large-scale applications that can be updated or changed quickly without having to redeploy the entire application.

  1. Independent Development: Microfrontends allow teams to work independently on different parts of the application without worrying about interference from other teams.
  2. Scalability: Microfrontends can be scaled independently
  3. Reusability: Microfrontends can be reused across multiple applications or web pages, reducing the need for duplication of effort and improving consistency across different parts of the application.
  4. Flexibility: Microfrontends can be developed using different technologies and frameworks, making it easier to adopt new technologies or update existing ones.
  5. Resilience: Microfrontends can be designed to be fault-tolerant, allowing the application to continue functioning even if some micro frontends fail.

Drawbacks?

Micro frontends can be implemented using different technologies and frameworks, such as React, Angular, Vue.js, or Web Components.

They can also be deployed in various ways, including server-side rendering, client-side rendering, or hybrid rendering.

While micro frontends can provide numerous benefits, they can also introduce new challenges, such as ensuring consistent UI and UX across different micro frontends and managing shared dependencies.

  1. Increased complexity: While micro frontends can provide greater flexibility and independence for development teams, they can also lead to increased complexity in the application architecture. This can make it more challenging to develop, test, and maintain the application.
  2. Increased communication overhead: With micro frontends, there is more communication between different components of the application. This leads to increased latency and reduced performance, particularly if the application relies heavily on inter-micro frontends communication.
  3. Higher deployment complexity: With micro frontends, there are more individual components that need to be deployed and managed. This can make it more challenging to deploy and maintain the application, particularly if there are multiple micro frontends that need to be updated simultaneously.
  4. Increased effort to ensure UX consistency : When using micro frontends, it can be challenging to manage shared resources such as styling and state management across different components. This can lead to more effort required to ensure consistency across the application.
  5. Increased effort for integration testing: With micro frontends, integration testing can become more complex and time-consuming, as there are multiple components that need to be tested and integrated.

Common mistakes when implementing micro frontends:

  1. Sharing too many dependencies: Sharing dependencies between micro frontends can lead to tight coupling, making it difficult to maintain and scale the application. Instead, each micro frontend should have its own set of dependencies and communicate with other micro frontends using APIs.
  2. Not considering performance: Each micro frontend should be optimized for performance, and unnecessary requests and data transfers should be minimized to ensure that the application remains fast and responsive. Each micro frontend may load its own resources, which can lead to slow page load times and increased server load. It’s important to address these issues by implementing caching, lazy loading, and other performance optimization techniques.
  3. Not testing thoroughly: Each micro frontend should be tested thoroughly, and integration testing should be performed to ensure that all micro frontends are working together as expected.
  4. Inconsistent UI/UX: Because each microfrontend is developed by a separate team, there is a risk of inconsistent user interface (UI) and user experience (UX).

Micro frontend vs Microservice ?

Micro Frontend focuses on the user interface, whereas Microservices focus on the backend or service layer.

  • Communication: Micro Frontend communication may involve inter-process communication in the UI layer, while Microservices communication is typically done over the network
  • Consistency: Micro Frontend requires strategies to ensure a consistent UI experience

Definition : Server-side rendering (SSR) vs client-side rendering (CSR)

SSR and CSR are two different approaches for rendering web pages.

SSR involves rendering the web page on the server and sending a fully rendered HTML page to the client.

  • This means that when user requests a page, server generates the HTML content and sends it to client , which can display it immediately.
  • SSR is commonly used for static web pages or websites that do not require a lot of interactivity.

CSR involves sending a bare-bones HTML page to the client. Whereupon the browser downloads JavaScript code, which runs and fetches data from server, and then renders the content.

  • CSR is commonly used for dynamic web applications or websites that require frequent updates and interactivity.
  • SSR can be faster to load the initial page and better for SEO, while CSR can provide a more responsive and interactive user experience.
  • SSR can be more challenging to implement and scale, while CSR can be easier to develop and maintain.

--

--