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.

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
Do you have a large product built by many teams? Are you struggling to release often? Did your frontend turn into a massive unmaintainable monolith? If, like me, you’ve answered yes to any of those questions, this talk is for you! I’ll show you exactly how you can build a micro frontend architecture with Remix to solve those challenges.
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
Do you know what’s really going on in your node_modules folder? Software supply chain attacks have exploded over the past 12 months and they’re only accelerating in 2022 and beyond. We’ll dive into examples of recent supply chain attacks and what concrete steps you can take to protect your team from this emerging threat.
You can check the slides for Feross' talk here.
Monolith to Micro-Frontends
React Advanced Conference 2022React Advanced Conference 2022
22 min
Monolith to Micro-Frontends
Top Content
Many companies worldwide are considering adopting Micro-Frontends to improve business agility and scale, however, there are many unknowns when it comes to what the migration path looks like in practice. In this talk, I will discuss the steps required to successfully migrate a monolithic React Application into a more modular decoupled frontend architecture.
Towards a Standard Library for JavaScript Runtimes
Node Congress 2022Node Congress 2022
34 min
Towards a Standard Library for JavaScript Runtimes
Top Content
You can check the slides for James' talk here.
ESM Loaders: Enhancing Module Loading in Node.js
JSNation 2023JSNation 2023
22 min
ESM Loaders: Enhancing Module Loading in Node.js
Native ESM support for Node.js was a chance for the Node.js project to release official support for enhancing the module loading experience, to enable use cases such as on the fly transpilation, module stubbing, support for loading modules from HTTP, and monitoring.
While CommonJS has support for all this, it was never officially supported and was done by hacking into the Node.js runtime code. ESM has fixed all this. We will look at the architecture of ESM loading in Node.js, and discuss the loader API that supports enhancing it. We will also look into advanced features such as loader chaining and off thread execution.
Out of the Box Node.js Diagnostics
Node Congress 2022Node Congress 2022
34 min
Out of the Box Node.js Diagnostics
In the early years of Node.js, diagnostics and debugging were considerable pain points. Modern versions of Node have improved considerably in these areas. Features like async stack traces, heap snapshots, and CPU profiling no longer require third party modules or modifications to application source code. This talk explores the various diagnostic features that have recently been built into Node.
You can check the slides for Colin's talk here. 

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.
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
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.
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.