So let's see micro frontend and architecture in practice. Let's get into VS Code. I'll be sharing the repository URL. There will be a slide at the last where you can access that. It's just an open source code. You can feel free to access that code and see how this multiplying architecture is implemented and how the micro frontend strategies are used in it.
So I'll just walk you through this repository and show you how the folders are created, how the project has been set up so that it will be easy for you when you try it on your own. There is a folder called examples in this repository, which contains some classic examples that you would have already tried in some of your previous POCs like Todo List, Ping Pong. These are the examples that anyone will try when they learn React for the first time, right? So yeah, again, those examples are built here.
So there's a folder called webapp, which is the container application, which is going all the individual channels or individual applications inside it, and run as a single web application. So I'll be running this webapp and show you how it looks on the browser. But before that, we'll just go through this folder, and see how this actual multiplying architecture and how the folders are created, and how the configurations are made. We'll start with this channel here. This Todo List view, VS Code extension is a channel. And this Todo List view is the view, actual view. So if you just recall the components, the four core components of multiplying architecture we discussed in our previous slide, the channel, envelope, view, and the editor, right? So here, this Todo List view is the actual view, which is a JAK application, if you see here, it contains envelope. So this envelope is responsible for enabling communication between this view and the channel. So if you just go through this envelope file, it contains some abstract methods. If you have tried Todo List before, you must remember the actions that we can do on Todo List, to create a note, edit a note or delete a note, and to mark a note as complete, something like that. These abstract methods contains the definition of each of these actions that you can do on Todo List. And this view is going to be communicating with the channel and it will be going to be abstracted inside the channel. So this extension is a TypeScript, based on TypeScript. So yeah, it just initiates this view. So if you see this package Json, Todo List view is installed as a dependency and in the extension it is just imported here and just it just initiates it, that's it. So the channel does nothing apart from that. It's as simple as that. And if you take another example of ping-pong view, again, this ping-pong view is the actual view which is React component is going to contain all the TSX files. And for this ping-pong view we have two types that is one with iframe and the other with div, so that you can try both the ways. So in my previous slides I also mentioned the same. So this multiplying architecture we managed to avoid usage of iframes.
Comments