Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Building Micro Frontends with React 18
Building Micro Frontends with React 18

Building Micro Frontends with React 18: Develop and deploy scalable applications using micro frontend strategies

eBook
€8.99 €22.99
Paperback
€27.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Building Micro Frontends with React 18

Introducing Microfrontends

We are coming full circle with microfrontends! During the Web 1.0 era, websites primarily comprised single pages built in ASP, JSP, or PHP, where we could make changes to each individual page and upload it to a server via FTP and it was immediately available to consumers. Then came the Web 2.0 era and the notion of web apps and Single-Page Apps (SPAs), where we compile, transpile, and deploy large monolithic apps. Now, we seem to be going back to working with smaller apps and pages.

The early 2000s brought in the era of Web 2.0 and the notion of web apps. A few years later, JavaScript frameworks allowed you to build SPAs that updated instantly and didn’t reload a new page each time the user clicked on a link or a button. SPAs were indeed fast for small to medium-sized apps, but as teams went full throttle with building large-scale SPAs, and as applications and teams grew, the velocity and speed of development dropped significantly. Teams seemed to be debating about folder structures, state management, and breaking each other’s code, due to centrally managed libraries and so on. These large SPAs also started becoming less performant due to the large bundle sizes of these apps. More importantly, the high execution time required to parse these JavaScript bundles made the apps even more sluggish on low-end devices and mobile phones. That’s when developers and architects started looking for solutions to these problems. Thankfully, they didn’t have to look too far.

You see, the backend teams went through the exact same problems with the large backend monoliths a few decades back and moved toward the microservices architecture pattern in order to solve their performance and scaling challenges. The frontend teams now look to apply the same principles of microservices to their frontend apps, which are being referred to as microfrontends.

The journey for backend teams toward microservices has been a very long one, spanning multiple decades, and many teams still struggle with it. However, thanks to a lot of debates, discussions, thoughts, leadership, and sharing learning from various microservice implementations, there is an overall maturity to and consensus around microservices architecture.

Frontend teams are just waking up to the notion of microfrontends, and there are multiple schools of thought on what defines a microfrontend, including, in fact, whether microfrontends are even a good thing or not. It will take a couple of years, if not a decade, before there is some consensus around microfrontends. The good thing, however, is that we can learn a lot from the journey of microservices, as a lot of principles and architecture patterns of microservices also apply to microfrontends.

In this chapter, we’ll start by understanding the need for microfrontends. We will cover the definition of microfrontends, and then the different patterns of microfrontends. We will also look into the parameters that will help us choose which pattern to go with for designing your apps. Finally, we will create our very first microfrontend.

In this chapter, we will cover the following topics:

  • Defining Microfrontends
  • Understanding Microfrontend patterns
  • Choosing a suitable pattern
  • Hello World with Microfrontends

By the end of this chapter, you will have a better understanding of two of the most common patterns for building microfrontends and a guide to help you decide which one would be most suitable for you.

Toward the end of this chapter, we will build out a simple multi-SPA microfrontend example and get a feel for how we navigate between the the different SPAs.

Technical requirements

As you go through the code examples in this chapter, you will need the following:

  • A PC, Mac, or Linux desktop/laptop with at least 8 GB of RAM (16 GB preferred)
  • An Intel chipset i5+, AMD, or an Apple M1 + chipset
  • At least 256 GB of free hard disk storage

You will also need the following software installed on your computer:

  • Node.js version 16+ (use nvm to manage different versions of Node.js if you have to).
  • Terminal: A modern shell such as zsh, iTerm2 with oh-my-zsh for Mac (you will thank me later), or Hyper for Windows (https://hyper.is/).
  • IDE: We recommend VS Code.
  • npm, yarn, or pnpm. We recommend PNPM because it’s fast and storage efficient.
  • Browser: Chrome/Microsoft Edge, Brave, or Firefox (I use Firefox).

The code files for this chapter can be found here: https://github.com/PacktPublishing/Building-Micro-Frontends-with-React.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Go through strategies for building and deploying production-grade micro frontends on the cloud
  • Explore the right choice and guiding principles to build different micro frontend patterns
  • Learn how to use React the right way to build and deploy micro frontends with this step-by-step guide
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Although deservedly popular and highly performant tools for building modern web applications, React and single-page applications (SPAs) become more and more sluggish as your applications and teams grow. To solve this problem, many large web apps have started to break down monolith SPAs into independently deployable smaller apps and components—a pattern called micro frontends. But micro frontends aren't a perfect solution, but rather a double-edged sword. This book teaches you how to architect and build them with the right principles to reap all the benefits without the pitfalls. This book will take you through two patterns of building micro frontends, the multi-SPA pattern and the micro apps pattern. You’ll find out which patterns to use and when, as well as take a look at the nuances of deploying these micro frontends using cloud-native technologies such as Kubernetes and Firebase. With the help of this book, you’ll gain an in-depth understanding of state management, solving problems with routing, and deployment strategies between the different micro frontends. By the end of this book, you’ll have learned how to design and build a React-based micro frontend application using module federation and deploy it to the cloud efficiently.

Who is this book for?

This book is for intermediate- to advanced-level developers with a working knowledge of React and web application development with JavaScript and TypeScript. Knowledge of concepts like client-side and server-side rendering, React, NodeJS, Webpack, and the basics of Kubernetes and serverless computing is desirable, but not necessary.

What you will learn

  • Discover two primary patterns for building micro frontends
  • Explore how to set up monorepos for efficient team collaboration
  • Deal with complexities such as routing and sharing state between different micro frontends
  • Understand how module federation works and use it to build micro frontends
  • Find out how to deploy micro frontends to cloud platforms
  • Figure out how to build the right development experience for teams

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 20, 2023
Length: 218 pages
Edition : 1st
Language : English
ISBN-13 : 9781804610961
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Oct 20, 2023
Length: 218 pages
Edition : 1st
Language : English
ISBN-13 : 9781804610961
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 95.97
React 18 Design Patterns and Best Practices
€33.99
Learn React with TypeScript
€33.99
Building Micro Frontends with React 18
€27.99
Total 95.97 Stars icon
Banner background image

Table of Contents

18 Chapters
Part 1: Introduction to Microfrontends Chevron down icon Chevron up icon
Chapter 1: Introducing Microfrontends Chevron down icon Chevron up icon
Chapter 2: Key Principles and Components of Microfrontends Chevron down icon Chevron up icon
Chapter 3: Monorepos versus Polyrepos for Microfrontends Chevron down icon Chevron up icon
Part 2: Architecting Microfrontends Chevron down icon Chevron up icon
Chapter 4: Implementing the Multi-SPA Pattern for Microfrontends Chevron down icon Chevron up icon
Chapter 5: Implementing the Micro-Apps Pattern for Microfrontends Chevron down icon Chevron up icon
Chapter 6: Server-Rendered Microfrontends Chevron down icon Chevron up icon
Part 3: Deploying Microfrontends Chevron down icon Chevron up icon
Chapter 7: Deploying Microfrontends to Static Storage Chevron down icon Chevron up icon
Chapter 8: Deploying Microfrontends to Kubernetes Chevron down icon Chevron up icon
Part 4: Managing Microfrontends Chevron down icon Chevron up icon
Chapter 9: Managing Microfrontends in Production Chevron down icon Chevron up icon
Chapter 10: Common Pitfalls to avoid when Building Microfrontends Chevron down icon Chevron up icon
Part 5: Emerging Trends Chevron down icon Chevron up icon
Chapter 11: Latest Trends in Microfrontends Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9
(19 Ratings)
5 star 89.5%
4 star 10.5%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Yondela Myataza Jul 29, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Feefo Verified review Feefo
Ari Nov 02, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Building microfrontends with react 18 covers all of the necessary topics on setting up and executing a successful react microfrontend. Microfrontends are essential architectural patterns necessary for building large web applications. As a full stack developer my job is to stay on top of new technologies, design patterns and learn new architecture to stay up to speed in the evolving data world. I really enjoyed the breakdown on how to choose a suitable design pattern depending on your team composition and goals. My team uses DevOps methodology and there is a section in this book that highlights how this is crucial for the long term success of a microfrontend architecture. Automation is also a necessary step for the success of this architecture.Part three of this book covers the various deployment possibilities in full detail making implementation a breeze. The section on rolling back the microfrontend was a massive bonus.Most books cover deployment but not always troubleshooting things like CORS issues, setting up CI/CD or rolling back an app. This book is the complete package, I HIGHLY recommend it!
Amazon Verified review Amazon
Majdm Nov 01, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
After grappling with the complexity of microfrontends in my day-today, this book offered my some solid insights, The book didn't just rehash old concepts; it introduced me to new React 18 features and how to implement them effectively. While I wish some sections were explained in greater detail, the well-commented code samples made up for it. It's already impacted how I approach my projects.Recommending it if you’re mid level and above as some concepts needs a prior knowledge.
Amazon Verified review Amazon
Sarah Nov 15, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
From the first line of code to the whole deployment completed. This book describes in great detail best practices to accomplished a modern and performant app, and explain the use cases where Marcie front ends are needed.
Amazon Verified review Amazon
Rusty Divine Oct 27, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book will help enterprise teams (where >1 team works on a given solution) deliver features for the front end."Microfrontends are a composition of micro apps that can be independently deployed and are owned by independent teams responsible for delivering business value of a focused area of the overall application.The keywords in this definition are independently deployed and independent teams. If at least one of these terms doesn’t apply to you or your team, then you probably don’t need a microfrontend."This book will help your team decide if Micro Frontends are right for you, and if so, how to architect them and work on them so that your teams can independently deliver features.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.