DEV Community

Cover image for Micro frontends in 1 minute
Seb Gos (@tatakodzi)
Seb Gos (@tatakodzi)

Posted on

Micro frontends in 1 minute

I'm a big fan of reading docs & manuals before I try things especially when they are a bit more complex (advanced). However I know how much joy and motivation it gives when you get first positive experience fast (e.g. running working example). That's why I've decided to look into micro learning where you might scratch the surface, experience if it's for you and get some insights what's next if you want more.

Today I want to give you short introduction to micro frontends architecture starting from project structure setup. Following the words above let's get working example first. I will use real-life example - we will create a banking app consist of micro frontends.

๐Ÿ•’ Time start

First of all let's create an empty (None) NX workspace:

npx create-nx-workspace@latest
Enter fullscreen mode Exit fullscreen mode

and get into it:

cd bank-mfe
Enter fullscreen mode Exit fullscreen mode

Then let's add some framework to the NX workspace:

nx add @nx/angular
Enter fullscreen mode Exit fullscreen mode

Now let's create apps folder to store all our micro frontends:

mkdir apps
Enter fullscreen mode Exit fullscreen mode

and get into it:

cd apps
Enter fullscreen mode Exit fullscreen mode

It's time to create our micro frontends:

nx g @nx/angular:host shell --remotes=account,payment,investment,mortgage,pension
Enter fullscreen mode Exit fullscreen mode

๐Ÿ•’ Stop the time!

You did it! Your project consist of micro frontends! Now you can start and see it in browser by:

nx serve shell --open
Enter fullscreen mode Exit fullscreen mode

If you actively develop/change given micro frontend remember to serve it with devRemotes like:

nx serve shell --open devRemotes=account
Enter fullscreen mode Exit fullscreen mode

๐Ÿ‘จโ€๐Ÿ’ป Link to code example

Code example: https://github.com/sebgos/bank-mfe

Video: https://www.youtube.com/watch?v=Vyi8pjuuky0

I have used:

Curious to get more insights on micro frontends? Let me know in the comments!

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay