microfrontends | nullcreate portal-like application | Frontend Framework library
kandi X-RAY | microfrontends Summary
kandi X-RAY | microfrontends Summary
microfrontends
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Build a production build .
- Convert the React environment environment to React environment
- Register the swagger worker .
- Check if a service worker is reloaded
- Ensures a given path is either a slash or a slash .
- Unregister the service worker
- Returns the absolute path for the application
- Copy the public folder to the dev folder
microfrontends Key Features
microfrontends Examples and Code Snippets
Community Discussions
Trending Discussions on microfrontends
QUESTION
I wanted to know how to use Microfrontends with Nuxt or at least Vue.
Is there a plug & play simple solution to have it working quickly?
I've heard about Webpack's v5 ModuleFederationPlugin for example, is this a valid thing to start my Nuxt project?
ANSWER
Answered 2021-Aug-31 at 14:03As of today, Nuxt2 is still using Webpack4 so ModuleFederationPlugin
will not be a possible solution.
Nuxt v3 will come with Webpack's v5 support and you'll probably be able to try it then.
As a general answer, you need to understand that a Microfrontend is not something simple to do. It is more about how you do structure your app in the larger scope.
It's like having a micro-service on the backend: it can be done is multiple ways and it all depends of the needs of the company/team.
If you do create a Vue2 or Vue3 project with the Vue CLI, you'll still have Webpack v4. You can probably try to make the upgrade yourself if planning to use ModuleFederationPlugin
.
As an alternative, there is single-spa. This is a way of doing it (probably not the only one).
Here is a podcast show talking about the subject in depth: https://devchat.tv/views-on-vue/building-micro-frontends-with-lawrence-almeida-vue-160/
It may be relevant to understand the general way this is working and also the pro/cons.
If you're not satisfied with this approach, there are a lot of articles on the Web talking about Microfrontends and some Google-fu will be enough to give you an alternative way.
QUESTION
I am trying to set up the new @faker-js/faker library. So far, I did this:
...ANSWER
Answered 2022-Jan-13 at 17:19Try to install the corresponding type declarations by running the command npm i @types/faker
QUESTION
I´m decomposing an Angular web in several microfrontends. One of these microfrontend handles the shopping cart, and it has a service to store products that have been added. My shell microfrontend needs to use that service to show in a icon how many items are in the car, add new items, etc.
Can I use a service in a microfrontend that is stored in a different microfrontend?
I´m using this tutorial, but it only explains how to route a page that are in another microfrontend.
Thanks.
...ANSWER
Answered 2022-Feb-02 at 17:57Can I use a service in a microfrontend that is stored in a different microfrontend?
No. Code in your microfront end is not shared among each other.
You need to create a library project within your repository. This library will be shared among your micro-apps. Here you can create a service which will be used to store some data & share it among apps.
https://angular.io/guide/creating-libraries
Is using Nx Workspace: https://nx.dev/workspace/library
QUESTION
I'm trying to find any examples I can that outline how to take an existing React application and gradually start migrating towards Next.js. I've read all the Next.js documentation I can regarding the incremental adoption strategies (e.g. subpaths, rewrites, microfrontends, proxies), but have yet to find a solid example showcasing what this actually looks like in a real-life "I've already got a massive React codebase" scenario.
The desired outcome is to corner off a subpath of my existing application, say /workshop
, and have /workshop
be the entrypoint to the Next.js application. I would then hope to be able to seamlessly navigate between the two applications, although the mechanics of that seem cloudy once you've entered the Next.js realm and need to navigate back out of the proxy.
For added context, both the React and Next.js applications will be served on Netlify. I've poured through their documentation, as well as Vercel's, looking for a working example but am still out of luck. Any knowledge or guidance on how best to approach this type of problem is greatly appreciated!
...ANSWER
Answered 2022-Jan-12 at 15:25For those interested, I was able to create a working demo.
https://hybrid-next-react.vercel.app/
https://github.com/coloradocolby/hybrid-next-react
The way it works is fairly simple. It's a basic Next.js application with a catch all route of [...app].js
which serves the entry point to the React SPA. A simple isMounted
variable (could easily be refactored into a hook) ensures that the React SPA (which likely has browser-specific code) is never processed by the server.
QUESTION
I'm planning to use single-SPA framework with angular to build a microfrontend architecture to a website. The website already exists in a legacy monolith way and we are planning to strangle it to microfrontend architecture to have independent teams working and doing independent deploys.
My plan is to use the actual monolith as the root for single-SPA and strangle the microfrontends one by one, coexisting with the actual monolith. I did some tests and the coexistence is possible but single-SPA always render the applications at the end of my page.
The question is if it's possible to render the application with single-SPA into a specific location on my HTML as inside a specific div element, for example. It's a really simple test i've been doing by now and this is how I'm registering the angular applications on single-SPA. By doing this it always render the application at the end of my body element.
...ANSWER
Answered 2021-Apr-23 at 13:49The answer to this isn't as straighforward so I'll break it up.
My plan is to use the actual monolith as the root for single-SPA and strangle the microfrontends one by one, coexisting with the actual monolith.
The single-spa team recommends not trying to put the root config into an application for better separation of concerns. See also "Should I have a parent/root app and children apps" and "Architectural overview". Instead, you should have an independent root-config and your first single-spa application should be the monolith.
The question is if it's possible to render the application with single-SPA into a specific location on my HTML
This is possible at the single-spa application level by passing in a domElementGetter
option to singleSpaAngular.
Alternatively, you can achieve the same thing from the config if using single-spa-layout in the root config.
as inside a specific div element
This is where I felt there was some need to further delve in. While you can have the application mounted at an arbitrary place in the DOM, you should not expect to try to mount a single-spa application within a single-spa application. Instead components can be shared through cross microfrontend imports if using the same framework between them, or single-spa Parcels for cross-framework interop.
QUESTION
I'm trying to figured out if it's possible share LESS variables among different React projects. I'm using Single-SPA to build a micro-frontends architecture. My micro-frontends are using some shared components like the react-microfrontend example does with react-mf/styleguide. Beside that, I also need to share some LESS variables (e.g. colors or typography) so I can just define them once into my styleguide project alike and then reference them in every micro-frontends I will define. Is that possible ? If yes, can you suggest to me a way to do that ? I guess the solution is to use webpack but I can't find the right way to do it.
...ANSWER
Answered 2021-Feb-25 at 19:51I found two possible solutions:
CDN
QUESTION
we're creating a new architecture for our microfrontends, and we'd like to avoid the use of another framework to orquestrate it, like single-spa. Our company currently use IIS for other products, and we need to keep it that way.
So, in order to have multiple SPAs responding to the same address, we simply depose our built SPAs in IIS's content directory, like this:
IIS root folder:
- spa1
- spa2
I can access myhost/spa1
and myhost/spa2
normally, and navigate thought their own internal routes (we're using Angular).
The problem is, we want to have URLs without #
, and than we need to tell IIS to redirect whatever is a sub-route, to it's SPA main route.
We have something in place, it works for myhost/spa1
, myhost/spa1/detail
, but does not work for myhost/spa1/detail/1
. Let's say, the third level.
Could someone help me with this?
...ANSWER
Answered 2021-Jan-14 at 02:55Try to use this URL rewrite rule:
QUESTION
I've created a few apps that follow the same pattern as the react-microfrontend projects listed on the Single-spa examples page. However, these examples are not using TypeScript.
I am receiving a TS error when App2 tries to import a function that exists in App1, because App2 is unable to find the typings for the App1 object. And this makes sense to me, since the importmap.json
that is referenced in the index.html
file of the root-config project only has a URL listed for the .js file of each microfrontend. I really don't want to add @ts-ignore statements everywhere, and I also don't want to do cross-app communication without being type safe.
An example of what I'm referring to:
This file in the Planets app references the Button component from the Styleguide app. I am unable to build this unless I place a @ts-ignore on the line before the import statement, because my Planets app cannot find the type declarations for Styleguide.
I am very new to import maps and SystemJS in general, so if anyone could point me in the right direction, I'd appreciate it. I've actually gone through the trouble of building my Styleguide as a regular npm library and just including it as a dependency in the Planets package.json file... which kind of defeats the whole purpose of using Single-spa in the first place.
importmap.json
...ANSWER
Answered 2020-Oct-30 at 17:45Unfortunately no, they cannot be shared via the import map because that operates in the browser, and browsers do not understand TypeScript syntax.
Your alternatives are:
- Publish your module's types to an npm registry and
npm install
it into each dependent microfrontend- One caveat here: you will need to update this with every new publish of the shared module, but that can be automated with various tools such as renovate
- Mock the utility module's types
More info can be found at this Github issue: https://github.com/single-spa/single-spa/issues/609#issuecomment-665132965
QUESTION
I'm currently working on internationalizing a system built with single-spa (microfrontends) with applications written on Angular and React. I started using i18next and it's going pretty well, however, I've found a problem when trying to share the i18next dependency between all the applications.
When two applications are mounted simultaneously on the view the one who loads last overrides the i18next instance and thus the translations for the first one are never found as they were not loaded on the latter.
Thanks in advance!
...ANSWER
Answered 2020-Jun-23 at 13:02It is better that I18next
will be initialized at the shell level with the shell namespaces, and each internal spa will add its namespaces to the shared instance.
This way you won't have duplication of instance & code.
You can use [i18next.addResourceBundle
][1] in order to add translation resources that are related to the current inner app.
QUESTION
We want develop few different services (React Apps) with the same users database and Rest API. Some users might have access to APP 1, some for APP 2, some for both depends on their role.
We decided to go on multiple subdomain apps method.
We want SSO so only one page/app to authenticate all the apps and not a local login component for each app. using JWT mechanism in our backend.
Lets say i go to the login app and log in, getting accestoken from the backend. How do i deliver the token to app1.company.com? should react login APP redirect with token in url param?
local storage is subdomain scoped.
iframe has problems with Safari.
I don't wanna save jwt in cookies for now because the flask REST can serve non-browser retailed clients.
Lets say the user want to go to app2. if we aren't able to share the token from app1 with iframes or any other method, then this app should be redirected to login and make the process again as app1, which is fine for us. But is this really the way? if token is invalid anymore and we get Error from backend, should we redirect to the login app in the other subdomain (embed the url we wanna go back to after login success)?
Can i just use 3rd party Open id connect service?
Should i consider microfrontends approcah to make the all the "apps" on the same domain?
How "Attlassian" as an example handles this process?
ANSWER
Answered 2020-May-01 at 09:34Lets say i go to the login app and log in, getting accestoken from the backend. How do i deliver the token to app1.company.com?
It is not a problem that login.company.com delivers the token as a parameter in the URL, because the site can verify the authenticity of the token by verifying the digital signature or with a specific endpoint in the central authentication domain. This is how openid/oauth2 does it using the "implicit" flow, although they also allows to send the token as POST, or use a 2-step flow ("authorization_code" flow)
Lets say the user want to go to app2. if we aren't able to share the token from app1 with iframes or any other method, then this app should be redirected to login and make the process again as app1, which is fine for us. But is this really the way?
You can share the token between domains using an internal iframe, but in your case I would recommend that each domain use its own token.
if token is invalid anymore and we get Error from backend, should we redirect to the login app in the other subdomain (embed the url we wanna go back to after login success)?
Yes, in the number 2) of your drawing, just redirect from app2.company.com to login.company.com and follow the same flow as in 1). You will need some type of cookie on login.company.com to avoid requesting credentials from the user again
Can i just use 3rd party Open id connect service?
Yes, you can use an external OpenIdConnect service, or deploy at login.company.com an OpenIdConnect server like IdentityServer or KeyCloak
Should i consider microfrontends approcah to make the all the "apps" on the same domain?
It is not necessary having a central authentication domain
How "Attlassian" as an example handles this process?
I don't know exactly how Attlassian does it, but currently most web services support OpenIdConnect
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install microfrontends
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page