Git Product home page Git Product logo

hello-world-with-module-federation's Introduction

Hello world with Module Federation

This repository is educational. The hello-world-with-module-federation is an example of Micro Frontends with Module Federation, React and Typescript. This a POC(Proof of Concept) project it may not look great, but that's not the point in our case. It's just a simple example of how to fetch components from micro-frontends and how to use a context state (which in our case is a user) from a micro-frontend.

Workflow:

  • app1 expose AppOne component and UserContext object.
  • app2 expose AppTwo component.
  • container import AppOne, AppTwo component and UserContext object.

How do you create applications?

How do you create container application?

npx create-react-app container --template typescript

yarn add html-webpack-plugin serve ts-loader webpack webpack-cli webpack-dev-server

npm install --save react-error-boundary

How do you create app1 application?

npx create-react-app app1 --template typescript

yarn add html-webpack-plugin serve ts-loader webpack webpack-cli webpack-dev-server

yarn add @pixability-ui/federated-types

How do you create app2 application?

npx create-react-app app2 --template typescript

yarn add html-webpack-plugin serve ts-loader webpack webpack-cli webpack-dev-server

yarn add @pixability-ui/federated-types

Install and run app 1

cd app1 yarn install yarn make-types yarn start

Install and run app 2

cd app2 yarn install yarn make-types yarn start

Install and run container

cd container yarn install yarn start

Guides and references:

https://ogzhanolguncu.com/blog/micro-frontends-with-module-federation

https://www.npmjs.com/package/@pixability-ui/federated-types

https://github.com/ogzhanolguncu/react-typescript-module-federation

https://github.com/fabecerra/mfe-poc-bluex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.