The Micro-Frontend Revolution at Amex

Rate this content
Bookmark

How do you scale a web application to be developed thousands of engineers and upgrade it to use the latest Javascript technologies (Nodejs + React)? The answer is, using Micro-Frontends!

American Express is a pioneer in the usage of this architecture using it in production since 2016 and transforming the face of a website used millions of users worldwide.

This talk has been presented at Node Congress 2021, check out the latest edition of this JavaScript Conference.

FAQ

A micro frontend is a way to apply microservices architecture to the frontend. It allows independent teams to develop, deploy, and manage parts of a web application separately, solving issues related to scaling and legacy code.

American Express adopted micro frontends to address challenges with scaling their frontend, such as communication issues, friction, slower feature addition, and difficulty in managing a large monolithic codebase.

Micro frontends offer modular design, independent deployments, server-side rendering, enterprise security, and ease of internationalization. They enable faster, more efficient development and deployment by independent teams.

Micro frontends solve scaling issues by allowing independent delivery and deployment of frontend modules. This prevents the need for a complete rewrite and avoids problems associated with a large monolithic codebase.

The "two-pizza rule" is a guideline suggesting that teams should be small enough to be fed by two pizzas, promoting efficiency and minimizing communication overhead.

Micro frontends handle user experience consistency by using modules for common elements like headers, footers, and navigation. This ensures a cohesive look and functionality across different parts of the application.

The Node.js server orchestrates the server-side rendering and composition of different micro frontend modules. It does not contain business logic, which resides in the independent Holocron modules.

Updates in micro frontends are managed through a module map, a JSON file that tracks module versions and changes. The Node.js server loads new modules into memory without restarting, allowing seamless updates.

Yes, micro frontends can be implemented without server-side rendering. The decision depends on the application's needs, such as SEO requirements. Client-side only micro frontends can be simpler to manage.

Holocron modules are micro frontend modules built on top of React at American Express. They handle business logic and user experience, while the Node.js server manages their composition and rendering.

Ruben Casas
Ruben Casas
28 min
24 Jun, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This Talk discusses the micro front-end revolution at American Express, highlighting the challenges of independent delivery and the solution of micro frontends. The architecture involves a Node.js server for server-side rendering and module composition, with Holocron modules deployed to a CDN. The development workflow includes local development environments and CI pipelines. Microfrontends are a pattern, not a set of tools, and should be implemented based on the specific use case. The adoption challenges include reworking the architecture and implementing features like Webpack and Module Federation. Communication between modules should be kept independent, and migration to micro frontends is simplified with existing microservices and Kubernetes. Server-side rendering is optional, and bundle size is limited to 250K.

1. Introduction to Micro Front-end Revolution

Short description:

Hello, everybody. My name is Ruben and I am a software engineer at American Express. Today I'm going to talk about the micro front-end revolution that took place at American Express. Let's start with a story. Imagine you are just being hired as the new CTO for a large corporation, responsible for digital transformation and scaling. You decide to add more developers and create smaller autonomous teams. However, applying these methods to the frontend presents challenges due to a large monolithic application with legacy code. Communication issues, friction, and difficulty in adding new features arise. A complete rewrite seems daunting, but let's pause for a moment.

Hello, everybody. My name is Ruben and I am a software engineer at American Express. And today I'm going to talk about the micro front-end revolution that took place at American Express.

So, first of all, let's start with a story. Let's imagine that you are just being hired as the new CTO for this very, very large corporation. So, you are responsible for the digital transformation of the company, as well as fixing issues with scaling. And you're in charge of fixing these issues.

So, the first decision that you make is, right, so, we need more developers. We need to add more people, and that's what you do. So, you also are a fan of the two-pizza rule, and you think, right, we need to create smaller teams and add those developers to those teams. So, we create smaller autonomous teams, and because in the past, you were part of this previous company and you had some previous experience, you think, oh, I think we should do microservices architecture here. It's a good idea. It's been proven. There are a lot of resources out there, and it's widely adopted.

So, let's make the most of the microservice architecture, and let's make the most of horizontal scaling, because we know that vertical scaling is not enough at some point, so we want to start doing horizontal scaling. And that is great. That is working very well. Until, well, until we try to apply these methods to the frontend. And what happens with the frontend? Well, the frontend, let's imagine this frontend is a really large monolithic application. It has a lot of legacy code. All the engineers are working on the same codebase. And if we want to add more engineers, obviously this is a bad idea, because they are working on the same codebase. So, the more engineers you add, the worse it becomes, because it will be just a nightmare to manage so many people working out of the same codebase.

So, the frontend has a lot of challenges. And these challenges are communication issues, friction, it takes longer and longer to add new features, fixing and finding bugs becomes a challenge, very hard to keep production and development environments in sync. And at some point of our careers, we all have had this question. We all were, like, what about a complete rewrite? And you think, oh, is that even possible? It seems like a very, very difficult task. Seems like an impossible task. But you're considering, right, we need to do a complete rewrite. Now, but hold on a second.

2. Challenges of Independent Delivery

Short description:

I think we have seen these problems before. We had this when we were adopting microservices. Independent delivery could be a turning point for large organizations to allow teams to deliver faster and collaborate more effectively. However, dividing the frontend into subdomains and allowing independent delivery can cause more challenges than solutions. Building applications in silos leads to fragmentary user experiences and the need to duplicate functionality. Upgrading and managing becomes difficult, resulting in authentication issues. Scaling a web application to be developed by thousands of engineers and adopting the latest technologies is a loaded question.

I think we have seen these problems before. We have seen all these communication issues, all this stuff. We had this when we were adopting microservices. So we think, hmm, what do we need to do to apply the microservices to the front end to solve these issues?

So the first thing you try is, well, I have seen this quote somewhere. Independent delivery could be a really turning point for large organizations to allow their teams to deliver faster and freely and to collaborate more effectively. And you think, well, that's it. I need to allow them to deploy independently. I want to allow them to deliver independently so they don't work on the same code base and they can deliver independently. And that's our first approach. And we try to divide the frontend and let's say that we are going to divide it into subdomains.

So, we give every single team a subdomain and they're going to build the application on that subdomain and everyone should be happy with that and we will solve a lot of issues. Well, actually, having that just independent delivery could more problems and more challenges than actual solutions. And let me expand on that.

Why this will cause more challenges. Well, if we give people their own subdomain or their own place on the website, teams will tend to start building applications in silos. And what is a silo? Well, it's a way of building software that is very difficult to communicate with another piece of software. So, the application and the features are built in siloes, and we start seeing people doing their own thing. Now, that also causes fragmentary user experiences. Because they're using their own tools and they're following their own thing, and they just don't care about communicating with other teams. We end up with a very disjointed user experience where the website might look very different if you go to one subdomain or if you go to a different subdomain of the website, when you're transferring, hold on a minute, the website doesn't look the same, and it starts looking very different.

Now, if we start also building the same functionality over and over, for example, if we want to build a different variation or if you want to translate that page to a different language or launch a different market in a different place, we end up building the same functionality again and again just because it has some variations in language or different regulation in different parts of the planet. So, we start building the same thing over and over again. There is no reuse. Also, because it's really difficult to upgrade and manage, things are everywhere and it's very difficult to have somewhere to update something in one place that will propagate throughout the website. This one is really annoying to me when you have authentication issues and you're on a website and it's asking you to log in again. But hold on, I just logged in on this part of the website and it's asking me to log in again. So, we end up with a lot of authentication issues and persistent authentication. Now, this is the big question. This is a big question on this presentation. How do we scale a web application to be developed not just by hundreds, but by thousands of engineers and upgrade it to use the latest technologies? It's a very loaded question.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
This talk discusses the usage of Microfrontends in Remix and introduces the Tiny Frontend library. Kazoo, a used car buying platform, follows a domain-driven design approach and encountered issues with granular slicing. Tiny Frontend aims to solve the slicing problem and promotes type safety and compatibility of shared dependencies. The speaker demonstrates how Tiny Frontend works with server-side rendering and how Remix can consume and update components without redeploying the app. The talk also explores the usage of micro frontends and the future support for Webpack Module Federation in Remix.
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Node Congress 2022Node Congress 2022
26 min
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Top Content
The talk discusses the importance of supply chain security in the open source ecosystem, highlighting the risks of relying on open source code without proper code review. It explores the trend of supply chain attacks and the need for a new approach to detect and block malicious dependencies. The talk also introduces Socket, a tool that assesses the security of packages and provides automation and analysis to protect against malware and supply chain attacks. It emphasizes the need to prioritize security in software development and offers insights into potential solutions such as realms and Deno's command line flags.
Monolith to Micro-Frontends
React Advanced Conference 2022React Advanced Conference 2022
22 min
Monolith to Micro-Frontends
Top Content
Microfrontends are considered as a solution to the problems of exponential growth, code duplication, and unclear ownership in older applications. Transitioning from a monolith to microfrontends involves decoupling the system and exploring options like a modular monolith. Microfrontends enable independent deployments and runtime composition, but there is a discussion about the alternative of keeping an integrated application composed at runtime. Choosing a composition model and a router are crucial decisions in the technical plan. The Strangler pattern and the reverse Strangler pattern are used to gradually replace parts of the monolith with the new application.
Towards a Standard Library for JavaScript Runtimes
Node Congress 2022Node Congress 2022
34 min
Towards a Standard Library for JavaScript Runtimes
Top Content
There is a need for a standard library of APIs for JavaScript runtimes, as there are currently multiple ways to perform fundamental tasks like base64 encoding. JavaScript runtimes have historically lacked a standard library, causing friction and difficulty for developers. The idea of a small core has both benefits and drawbacks, with some runtimes abusing it to limit innovation. There is a misalignment between Node and web browsers in terms of functionality and API standards. The proposal is to involve browser developers in conversations about API standardization and to create a common standard library for JavaScript runtimes.
ESM Loaders: Enhancing Module Loading in Node.js
JSNation 2023JSNation 2023
22 min
ESM Loaders: Enhancing Module Loading in Node.js
ESM Loaders enhance module loading in Node.js by resolving URLs and reading files from the disk. Module loaders can override modules and change how they are found. Enhancing the loading phase involves loading directly from HTTP and loading TypeScript code without building it. The loader in the module URL handles URL resolution and uses fetch to fetch the source code. Loaders can be chained together to load from different sources, transform source code, and resolve URLs differently. The future of module loading enhancements is promising and simple to use.
Out of the Box Node.js Diagnostics
Node Congress 2022Node Congress 2022
34 min
Out of the Box Node.js Diagnostics
This talk covers various techniques for getting diagnostics information out of Node.js, including debugging with environment variables, handling warnings and deprecations, tracing uncaught exceptions and process exit, using the v8 inspector and dev tools, and generating diagnostic reports. The speaker also mentions areas for improvement in Node.js diagnostics and provides resources for learning and contributing. Additionally, the responsibilities of the Technical Steering Committee in the TS community are discussed.

Workshops on related topic

Node.js Masterclass
Node Congress 2023Node Congress 2023
109 min
Node.js Masterclass
Top Content
Workshop
Matteo Collina
Matteo Collina
Have you ever struggled with designing and structuring your Node.js applications? Building applications that are well organised, testable and extendable is not always easy. It can often turn out to be a lot more complicated than you expect it to be. In this live event Matteo will show you how he builds Node.js applications from scratch. You’ll learn how he approaches application design, and the philosophies that he applies to create modular, maintainable and effective applications.

Level: intermediate
Micro Frontends with Module Federation and React
JSNation Live 2021JSNation Live 2021
113 min
Micro Frontends with Module Federation and React
Workshop
Alex Lobera
Alex Lobera
Did you ever work in a monolithic Next.js app? I did and scaling a large React app so that many teams can work simultaneously is not easy. With micro frontends you can break up a frontend monolith into smaller pieces so that each team can build and deploy independently. In this workshop you'll learn how to build large React apps that scale using micro frontends.
Build and Deploy a Backend With Fastify & Platformatic
JSNation 2023JSNation 2023
104 min
Build and Deploy a Backend With Fastify & Platformatic
WorkshopFree
Matteo Collina
Matteo Collina
Platformatic allows you to rapidly develop GraphQL and REST APIs with minimal effort. The best part is that it also allows you to unleash the full potential of Node.js and Fastify whenever you need to. You can fully customise a Platformatic application by writing your own additional features and plugins. In the workshop, we’ll cover both our Open Source modules and our Cloud offering:- Platformatic OSS (open-source software) — Tools and libraries for rapidly building robust applications with Node.js (https://oss.platformatic.dev/).- Platformatic Cloud (currently in beta) — Our hosting platform that includes features such as preview apps, built-in metrics and integration with your Git flow (https://platformatic.dev/). 
In this workshop you'll learn how to develop APIs with Fastify and deploy them to the Platformatic Cloud.
Building a Hyper Fast Web Server with Deno
JSNation Live 2021JSNation Live 2021
156 min
Building a Hyper Fast Web Server with Deno
WorkshopFree
Matt Landers
Will Johnston
2 authors
Deno 1.9 introduced a new web server API that takes advantage of Hyper, a fast and correct HTTP implementation for Rust. Using this API instead of the std/http implementation increases performance and provides support for HTTP2. In this workshop, learn how to create a web server utilizing Hyper under the hood and boost the performance for your web apps.
0 to Auth in an Hour Using NodeJS SDK
Node Congress 2023Node Congress 2023
63 min
0 to Auth in an Hour Using NodeJS SDK
WorkshopFree
Asaf Shen
Asaf Shen
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool.
We will enhance a full-stack JS application (Node.JS backend + React frontend) to authenticate users with OAuth (social login) and One Time Passwords (email), including:- User authentication - Managing user interactions, returning session / refresh JWTs- Session management and validation - Storing the session for subsequent client requests, validating / refreshing sessions
At the end of the workshop, we will also touch on another approach to code authentication using frontend Descope Flows (drag-and-drop workflows), while keeping only session validation in the backend. With this, we will also show how easy it is to enable biometrics and other passwordless authentication methods.
Table of contents- A quick intro to core authentication concepts- Coding- Why passwordless matters
Prerequisites- IDE for your choice- Node 18 or higher
GraphQL - From Zero to Hero in 3 hours
React Summit 2022React Summit 2022
164 min
GraphQL - From Zero to Hero in 3 hours
Workshop
Pawel Sawicki
Pawel Sawicki
How to build a fullstack GraphQL application (Postgres + NestJs + React) in the shortest time possible.
All beginnings are hard. Even harder than choosing the technology is often developing a suitable architecture. Especially when it comes to GraphQL.
In this workshop, you will get a variety of best practices that you would normally have to work through over a number of projects - all in just three hours.
If you've always wanted to participate in a hackathon to get something up and running in the shortest amount of time - then take an active part in this workshop, and participate in the thought processes of the trainer.