Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identity Dashboard (FE) - Micro-frontend aka Module Federation #59147

Closed
2 of 3 tasks
asg5704 opened this issue May 25, 2023 · 8 comments
Closed
2 of 3 tasks

Identity Dashboard (FE) - Micro-frontend aka Module Federation #59147

asg5704 opened this issue May 25, 2023 · 8 comments
Assignees
Labels
Identity All Identity related tickets identity-frontend

Comments

@asg5704
Copy link
Contributor

asg5704 commented May 25, 2023

Description

Research and implement Module Federation with Next.js (identity-dashboard-fe) and Vue (fwa-dashboard)

Tasks

  • Research the micro-frontend architecture with Module Federation
    • Time box research/PoC to 1 week
  • Implement Module Federation for Next.js + Vue
@asg5704 asg5704 added Identity All Identity related tickets identity-frontend labels May 25, 2023
@asg5704 asg5704 assigned asg5704 and acald-creator and unassigned asg5704 May 26, 2023
@acald-creator
Copy link

Created private repo at https://github.com/department-of-veterans-affairs/identity-microfrontend for testing implementation unrelated to the current Next.js and Vue app.

Will list findings of potential issues and how this can be implemented.

@acald-creator
Copy link

Created separate repo to track different implementations on how to setup module federation with different frameworks: https://github.com/department-of-veterans-affairs/vsp-idp-microfrontend-test

@acald-creator
Copy link

Implementation Module Federation with Next.js 13 app router and Vue.js 3

Pros:

  • allow us to share code between multiple applications with duplications
  • enables us to develop micro frontend architecture, where each team can own and deploy their own module
  • independent development and deployment among the teams
  • version control management, allows managing different versionings and can deploy packages

Cons:

  • setting up microfrontend architecture can be complex
  • build performance can be slower, and depends on the number of applications are created, build time can slow because there is a process of resolving and bundling dependencies
  • compatability - not all frameworks work with Module Federation, refactoring will be needed
  • debugging and troubleshooting will be necessary and can be more challenging

Resources:

However, pertaining to the current project, implementing Micro-frontend with Vue.js and Next.js will not work as expected.

Next.js 13 currently has an app directory layout which might not have full support with using @module-federation/nextjs-mf, and if there is, this implementation is tightly coupled and supported within Next.js apps, not any other apps outside of Next.js.

There is support to use React with Next.js in a module federation format, but extra configuration are needed to make sure that the implementation works properly.

Also, Next.js 13 also supports React Server Components, which means you have to declare which is Client Component and which is Server Components.

Next.js 13 also has a pages directory layout where @module-federation/nextjs-mf is working properly, but there are potential issues with importing and displaying the component. There are suggestions to use async boundary, which means waiting to check the module is available before loading the module.

In the case of using Next.js 13 with Vue.js, there doesn't seem to be an easier way to implement this.

Tool that could serve as a wrapper to use React in Vue, and Vue in React

Cons for the above is adding overhead and maintaining another package if we were to create our own library.

Potential alternative project layout (future reference)

@asg5704
Copy link
Contributor Author

asg5704 commented Jun 9, 2023

@acald-creator Can you provide your recommendation on moving forward. Would it be easier to migrate the FWA dashboard to React, or would it be worth it to use one the packages you mentioned. Thanks

@acald-creator
Copy link

acald-creator commented Jun 9, 2023

@asg5704

My recommendation is to migrate the FWA app to React.

If we do try and use one of the libraries that is a wrapper for a React component and vice versa, the question would be whether the package itself is maintained or not. There is one that is not maintained at this link: https://github.com/akxcv/vuera.

The other two are for their company use cases, and may not necessarily suit us.

The other issue would be permission on whether we can use it, so this means forking our own to maintain it.

In conclusion, I would suggest migrating the FWA dashboard to React. I can assist with this if there are issues with migrating.

@asg5704
Copy link
Contributor Author

asg5704 commented Jun 9, 2023

Sounds good. Put this ticket in PM review and I'll create a new one for the eventual migration in the backlog.

@aparsley
Copy link
Contributor

Looks great, keep up the good work.

@asg5704
Copy link
Contributor Author

asg5704 commented Jun 20, 2023

Added to sprint report 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Identity All Identity related tickets identity-frontend
Projects
None yet
Development

No branches or pull requests

3 participants