♪♪♪ Hello, everyone. Welcome to this lightning talk. First of all, thank you JS Nation for this space. It's really great to be here. My name is Natalia Rocha. I'm from Ecuador, a small, beautiful country where politics has more bugs than legacy code. I work at Stack Builders as a software developer, and I also play the guitar.
But let's get into the topic, micro-frontends. So I have the feeling that this topic, when it is mentioned, it creates a lot of buzz and discussion. So let's talk a little bit about it and what role module federation plays in their implementation.
So simply put, micro-frontend is an architecture that breaks down a large frontend like this one into smaller pieces that are independently deployable. Here's the key, independently deployable. It's probably the core idea of micro-frontends. But why the buzz? Because this approach is gaining a lot of traction because it can improve scalability, team autonomy, and code maintenance. So instead of waiting for one team to finish the feature to be able to deploy the entire app, each model is isolated, flexible, and it can be rolled out independently.
So we have two primary ways to implement micro-frontends, build time and run time. Build time, where models are compiled together at build time, libraries for example, and run time, where models are loaded independently during run time. Module federation is an example of this implementation, which is great for dynamic real-time updates across teams.
So are micro-frontends new? Let's see. Has anyone used iframes before? Yeah? Has anyone used libraries before? Yeah? So maybe you have implemented a micro-frontend architecture. But when would you call a library or an iframe a micro-frontend? Because on a daily basis, we all use libraries to add functionalities, utilities, even entire frameworks to our applications. So I like to think that the architecture or mental model that you define for your project and the use case of how you intend to separate the application into a library or an iframe or a federated model is what makes it a micro-frontend. For example, on a movie theater application, teams separately develop a seat beaker and user profile models. So this gives them the possibility to work independently, having the chance to move faster, for better or worse. Right?
Now let's jump a little bit into implementation. Module federation is one way to implement this architecture. So it allows you to expose modules like functions, components, hooks, and use them as remotes that will be loaded on run time. It was introduced on Webpack 5. Zach Jackson, the creator, should be around here. And the 2.0 version was released this year.
Comments