Skip to content

The Tractor v2 implemented with micro frontends using single-spa with SystemJS.

Notifications You must be signed in to change notification settings

FlorianRappl/single-spa-tractor-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

single-spa Demo · GitHub License Community Chat

The Tractor v2 Micro Frontends Sample using single-spa

⚡ Combine multiple micro frontends built with different frameworks - but all using Module Federation and single-spa.

Feel free to play around with the code using StackBlitz.

Open in StackBlitz

A micro frontends sample implementation of The Tractor Store built with Module Federation and React. It's based on the Blueprint.

Live Demo: single-spa-tractor-v2.florian-rappl.de

About This Implementation

Technologies

List of techniques used in this implementation.

Aspect Solution
🛠️ Frameworks, Libraries React, single-spa
📝 Rendering SPA
🐚 Application Shell rspack
🧩 Client-Side Integration Custom
🧩 Server-Side Integration None
📣 Communication Custom Events, Slots
🗺️ Navigation SPA, One MF per Team, history API routing
🎨 Styling Self-Contained CSS (No Global Styles)
🍱 Design System None
🔮 Discovery None
🚚 Deployment Static Page
👩‍💻 Local Development rspack

Limitations

This implementation is deliberately kept simple to focus on the micro frontends aspects. URLs are hardcoded, components could be more DRY and no linting, testing or type-safety is implemented. In a real-world scenario, these aspects should be addressed properly.

Performance

Several performance optimizations could still be applied, however, in the out-of-the-box state with three micro frontends and multiple components / pages included we'll end up with a lighthouse score of 89/100, which is decent, but not great.

Lighthouse Score

As a comparison a most lightweight SSR-only solution using the same codebase would be around 99/100. Another SPA sample that uses Picard.js with Native Federation ended up at 88/100. Using a full framework like Piral (which also includes a much cleaner codebase and a more powerful routing engine) ends up at 100/100, too.

Replacing SystemJS with Module Federation gives you 2 more lighthouse points. So, there is potential in the right direction.

How to run locally

Installation

Clone this repository. Then run the following command inside the repository:

./setup.sh

Running the Code

Now you can run all micro frontends:

./run.sh

Open http://localhost:1234 in your browser to see the integrated application.

About The Authors

smapiot is a growing company specialized in delivering IT solutions and services for the emerging space of digital transformation and IoT. smapiot was founded in 2014 and is located in Munich. We are the core maintainers of the Piral framework and the Picard.js library.

License

single-spa and this sample code is released using the MIT license. For more information see the license file.