You have rightly divided the micro-frontends into Home, Account, PLP&PDP and Cart&Checkout and these will have their own store which will allow you to maintain them separately.
However, the catch is that they should be making service calls separately and maintain their store for that.
Now this way, the userProfile
will be irrelevant to the Product Listing Page and Product Details Page. Same case with the Cart and Checkout Components. They might require a token to make some API calls, but that value can be fetched from the localStorage
.
The other alternative would be to have a single Store and pass in functions to the respective micro-frontends for the actions. However, that complicates your application and moves towards a monolithic approach , defeating the purpose of a MFE architecture.
Refer to this link to checkout the basics
https://martinfowler.com/articles/micro-frontends.html#Cross-applicationCommunication
As a side-note, using Custom Events is also effective when it comes to communication between MFEs but that is preferable in cases where there is a large set of interactions required between projects.
Refer:
https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events