Statistics
5
Views
0
Downloads
0
Donations
Support
Share
Uploader

高宏飞

Shared on 2026-02-22

AuthorLuca Mezzalira

What's the answer to today's increasingly complex applications? Micro-frontends. Inspired by the microservices model, this approach lets you break interfaces into separate features managed by different teams of developers. In this updated second edition, software architects, tech leads, and software developers will learn how to design, build, and deploy independent micro-frontends that compose unique frontend systems.

Tags
No tags
Publisher: O'Reilly Media, Inc.
Publish Year: 2026
Language: 英文
File Format: PDF
File Size: 8.1 MB
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

(This page has no text content)
Praise for Building Micro-Frontends This book is the intersection of Luca’s multidisciplinary excellence—combining the rigor of a seasoned architect, the clarity of a tech video creator, and the insight of a widely read newsletter curator—distilled into the definitive guide to micro-frontends. —Max Gallo, Distinguished Engineer at DAZN The first edition covered every critical aspect of adoption. This update keeps pace with today’s tech and practices, modern composition, platform needs, and real scenarios, so it remains my go-to field guide. —Alessandro Cinelli, Engineering Manager at Samsara If microservices and team topologies had a frontend baby, this book would be it. —Michael Di Prisco, Tech Lead at Jointly If you are a technical lead or decision maker looking into introducing and implementing micro-frontends in your organization, then Luca Mezzalira has written the book for you. —Jens Oliver Meiert, Engineering Manager and Author (meiert.com)
Building Micro-Frontends SECOND EDITION Distributed Systems for the Frontend Luca Mezzalira
Building Micro-Frontends by Luca Mezzalira Copyright © 2026 Luca Mezzalira. All rights reserved. Published by O’Reilly Media, Inc., 141 Stony Circle, Suite 195, Santa Rosa, CA 95401. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800- 998-9938 or corporate@oreilly.com. Acquisitions Editor: Louise Corrigan Development Editor: Angela Rufino Production Editor: Christopher Faucher Copyeditor: Piper Content Partners Proofreader: Andrea Schein Indexer: Ellen Troutman-Zaig Cover Designer: Karen Montgomery Cover Illustrator: Susan Thompson Interior Designer: David Futato Interior Illustrator: Kate Dullea November 2021: First Edition November 2025: Second Edition
Revision History for the First Edition 2025-10-24: First Release See http://oreilly.com/catalog/errata.csp? isbn=9781098170783 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Building Micro-Frontends, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. The views expressed in this work are those of the author and do not represent the publisher’s views. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-098-17078-3 [LSI]
Foreword for the 1st Edition Named architecture styles (such as microservices) are like art periods in history—no one plans for them, no single person is responsible for the ideas, yet they suffuse through a community. For example, no group of artists gathered in France in the late 19th century and decided to create impressionism. Rather, forces in the art world (reacting to the introduction of primitive photography) drove artists toward representation rather than capturing reality. The same is true for styles of architecture—regardless of what some developers may suspect, there is no ivory tower to which architects retreat to concoct the New Big Thing. Instead, clever architects notice new capabilities appearing within the ecosystem, and they identify ways to combine these emerging capabilities to solve old problems. For microservices, the advent of DevOps, programmatic control of machine configuration (which led to containerization), and the need for faster turnaround spawned this architecture style at several influential organizations. In the past, the name of the architecture style would lag for several years as people figured out that a trend was underway and identified the distinguishing characteristics that would lead to a name. However, that story slightly differs for microservices. Architects have become clever about noticing the development of new trends and keep a keen eye out for them. In March 2014, Martin Fowler and James Lewis published an iconic essay on Fowler’s website describing a new architecture style going by the name microservices. They didn’t coin the term, but they certainly contributed to the popularity of the new style. And I suspect the authors did the industry a favor as well—their delineation of the characteristics of microservices quite early in their life cycle helped teams hone in on what is and
isn’t a microservice more quickly, avoiding months or years of churn trying to figure out their real uses. Because they were describing a new phenomenon, Fowler and Lewis necessarily predicted a few things, including the impact microservices would have on user interface design. They observed that one of the defining features of microservices is the decoupling of services, and they predicted that architects would partition user interfaces to match the level of decoupling. Alas, the real world interfered with their prediction…until now. It turns out that user interfaces are necessarily monolithic in nature: users expect to go to a single place to interact with an application, and they expect certain unified behaviors—all the parts of the user interface work in concert. While it is possible to create truly decoupled user interfaces, this has proved challenging for developers, who have awaited proper framework and tool support. Fortunately, that support has finally arrived. You hold in your hand the definitive guide to this important aspect of microservice development. Luca Mezzalira has done an excellent job describing the problem in clear terms, following up with cutting-edge support to solve common roadblocks. This well-organized book begins by covering the frontend issues that developers currently face, then delves into the various aspects of micro-frontends. Luca provides not only technical details but also critical ecosystem perspectives, including how to untangle a monolith into a more decoupled user interface, and how common engineering practices such as continuous integration can fit into teams’ use of this new technology.
Every developer who builds microservices, regardless of whether they build user interfaces, will benefit from this enjoyable guide to a critical subject. Neal Ford, Director/Software Architect/Meme Wrangler at Thoughtworks, Inc.
Preface At the beginning of December 2016, I took my first trip to Tokyo. It lasted just a week, but—as I would discover—I would travel to the Japanese capital many more times in the near future. I can clearly remember walking to the airplane at London Heathrow Airport and mentally preparing my to-do list for the impending 12-hour flight. By then, I’d already been traveling for a few weeks in the United States: attending conferences in the San Francisco Bay Area and Las Vegas. The project I was working on at that time was an over-the- top platform similar to Netflix but dedicated to sports, with daily live and on-demand content available in multiple countries and on more than 30 different devices (web, mobile, consoles, set-top boxes, and smart TVs). It was near the end of the year, and as a software architect, I had to make a proposal for a new architecture that would enable the company to scale to hundreds of developers distributed across multiple locations, without reducing the current throughput and ideally enhancing it as much as possible. When I settled in my seat, I became relatively calm. I was still tired from the Vegas trip and admittedly a bit annoyed about the 12 hours I would have to spend on the plane, but I was excited to see Japan for the first time. A few minutes later, I had a glass of champagne. For the first time in my life, I was in business class, with a very comfortable seat and plenty of space to work. At the end of the first hour, it was time to get my laptop out of my backpack and start working on “the big plan.” I still
had over 10 hours of flight time during which I could make progress on this huge project that would serve millions of customers around the world. I didn’t know then that the following hours would deeply change the way I would architect cross-platform applications for the frontend. In this book, I want to share my journey into the micro- frontend world: the lessons I learned, the tips for getting a solid micro-frontend architecture up and running, and (finally) the benefits and pitfalls of this approach. Hopefully, these lessons will enable you to evaluate whether this architecture fits your current or next project. Now it’s time for your own journey to begin. Why I Wrote This Book I started thinking about micro-frontends in 2015. During the years that followed, I had the opportunity to implement them in a large-scale organization with distributed teams composed of hundreds of developers, and to explain their benefits as well as their pitfalls. During this time, I also shared these experiences at conferences, webinars, and meetups, which enabled me to engage with the community —listening to their stories, answering their questions, and collaborating with other companies that embraced this paradigm in different ways. More recently, I suggested several of the practices presented in this book to enterprise organizations all over the world, from Australia to North America. I was exposed to multiple challenges during the design and implementation phases, and the lessons I learned are gathered in these pages as well.
This book represents my research, experiences, studies, and insights from the ground up, collected over several years of work with hundreds of teams worldwide. I want to share real examples and topics that I believe are key to succeeding with micro-frontends. Finally, everyone who is interested in learning how to use this architecture style end to end—despite the inevitable evolution we are going to see in the next few years—will find a pragmatic guide that covers every aspect: from engineering culture and organizational structure, to best approaches for dealing with this architecture in production. What you are going to learn in these pages will act as your North Star for creating successful micro-frontend projects.
Who This Book Is For This book is for developers, architects, and tech leaders who are looking to scale their organizations and frontend applications. It’s a collection of mental models and experiences useful for approaching any micro-frontend architecture, and you will find the principles and solutions applied to every approach implemented so far. By following these practices, you will be able to complete a micro- frontend project with the right mindset and overcome common challenges that your teams are going to face during the journey. In this book, you’ll find technical architectures and implementation as well as end-to-end coverage of micro- frontends—from the design phase through to how to organize your teams for migrating existing or greenfield projects to micro-frontends.
How This Book Is Organized The chapters in this book cover specific topics so a reader can jump from one to another without too many references across chapters. Although the best way to read this book is sequentially, it is also useful as a reference while working— so if you need to jump to a specific topic, you can pick the chapter and read just the part you are interested in. The book covers the following: Chapter 1, “Micro-Frontend Principles” We begin by examining the foundational ideas behind microservices and how those concepts translate to frontend development. You will learn the core principles that serve as a “North Star” for micro-frontend implementations, principles that will guide every architectural decision you make. Chapter 2, “Micro-Frontend Architectures and Challenges” This chapter lays the groundwork for you to understand micro-frontends in depth. I introduce four key pillars for designing successful architectures, supported by a decision- making framework for identifying, composing, orchestrating, and communicating micro-frontend solutions. With these choices in place, you can design the rest of the system—from automation strategies to design systems—with confidence. Chapter 3, “Discovering Micro-Frontend Architectures” Micro-frontends can be implemented in many different ways. Here, I categorize and evaluate those approaches,
exploring their benefits, trade-offs, and ideal use cases so you can choose the right fit for your context. Chapter 4, “Client-Side Rendering Micro-Frontends” This chapter offers a deep dive into best practices for building client-side rendered micro-frontends using common frameworks such as Module Federation. Chapter 5, “Server-Side Rendering Micro-Frontends” Server-side rendering (SSR) brings its own opportunities and complexities. We look at how to implement SSR micro- frontends effectively, including the infrastructure considerations that make this one of the most challenging approaches to get right. Chapter 6, “Micro-Frontend Automation” Successful micro-frontend architectures rely on solid automation. This chapter shares strategies for repository organization, continuous integration, and other automation fundamentals that keep teams moving quickly without sacrificing quality. Chapter 7, “Discover and Deploy Micro-Frontends” In production-grade systems, managing multi-environment deployments is critical. You will learn how to apply discovery patterns—as well as techniques like canary releases and blue-green deployments—to reduce risk and to build deployment confidence. Chapter 8, “Automation Pipeline for Micro-Frontends: A Case Study” Building on Chapter 6, “Micro-Frontend Automation” and Chapter 7, “Discover and Deploy Micro-Frontends”, this case
study walks through a real-world automation pipeline for micro-frontends, showing how theory translates into practice. These are insights you can apply immediately to your own continuous integration or continuous delivery (CI/CD) setups. Chapter 9, “Backend Patterns For Micro-Frontends” Frontends do not exist in isolation. In this chapter, we explore integration patterns for working with monolithic backends and microservices, including backend for frontend (BFF), API gateways, and service dictionaries, with examples and best practices for each. Chapter 10, “Common Antipatterns in Micro-Frontend Implementations” Not every pattern stands the test of time. Here, I share common antipatterns that I have encountered over the past five years, explain why they fail, and offer practical alternatives to avoid costly mistakes. Chapter 11, “Migrating to Micro-Frontends” Migrations are complex. Drawing on years of experience helping organizations transition, this chapter focuses on asking the right questions, identifying priorities, and tackling the critical aspects of moving from a monolithic frontend to micro-frontends. Chapter 12, “From Monolith to Micro-Frontends: A Case Study” Here, we follow the fictional ACME Inc. through its migration journey, exploring the technical and organizational decisions that shaped its move to a distributed frontend architecture.
Chapter 13, “Introducing Micro-Frontends in Your Organization” Technology is only part of the story. This chapter addresses the organizational aspects of micro-frontends, including how to align teams, foster collaboration, and set up processes that support long-term success. Chapter 14, “AI and Micro-Frontends: Augmenting, Not Replacing” In the final chapter, I share a year of experimentation with AI in the micro-frontend space, highlighting where it shines, where it falls short, and how it can augment rather than replace your work. You will leave with a practical playbook for leveraging AI to accelerate micro-frontend development. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold Shows commands or other text that should be typed literally by the user.
Constant width italic Shows text that should be replaced with user-supplied values or by values determined by context. TIP This element signifies a tip or suggestion. NOTE This element signifies a general note. WARNING This element indicates a warning or caution. Using Code Examples Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/lucamezzalira. If you have a technical question or a problem using the code examples, please send email to support@oreilly.com. This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from O’Reilly books does require permission.
Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but generally do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Building Micro-Frontends, 2nd Edition, by Luca Mezzalira (O’Reilly). Copyright 2026 Luca Mezzalira, 978-1-098-17078-3.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com. O’Reilly Online Learning NOTE For more than 40 years, O’Reilly Media has provided technology and business training, knowledge, and insight to help companies succeed. Our unique network of experts and innovators share their knowledge and expertise through books, articles, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in- depth learning paths, interactive coding environments, and a vast collection of text and video from O’Reilly and 200+ other publishers. For more information, visit https://oreilly.com.
How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 141 Stony Circle, Suite 195 Santa Rosa, CA 95401 800-889-8969 (in the United States or Canada) 707-827-7019 (international or local) 707-829-0104 (fax) support@oreilly.com https://oreilly.com/about/contact.html We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at https://oreil.ly/building-micro-frontends-2e. For news and information about our books and courses, visit https://oreilly.com. Find us on LinkedIn: https://linkedin.com/company/oreilly- media Watch us on YouTube: https://youtube.com/oreillymedia
Acknowledgments First, I’d like to thank my family, Maela, and my daughters for everything they do and the strength I receive from them to move forward every single day. Thanks to all the people who inspire me on a daily basis through every form of communication. A huge thank-you to DAZN, who allowed me to apply a micro-frontend architecture and explore its benefits end to end, and who trusted my ideas and judgment. Thanks to O’Reilly for the opportunity to write about micro- frontends. In particular, thanks to Louise Corrigan and Angela Rufino for all the support they gave me during these months of writing and the constant feedback that improved the book. And thanks also to Erin Brenner, my fantastic editor who spent a considerable amount of time unwinding my thoughts and translating them into what you are about to read. Finally, thanks to all the people who reviewed this manuscript and provided fundamental suggestions to improve the book, and to all the attendees of my talks and workshops who shared their experiences and challenges, which are probably now reflected in these pages.