Coder Social home page Coder Social logo

nxmfe's Introduction

Nx MFE

A sample repo of a micro frontend architecture using an Nx monorepo.

Getting Started

Run npm start to fire up the apps.

Recreate This Repo

  1. Run npx create-nx-workspace@latest nxmfe to create the repo.
  2. Add the React schematic to the workspace: npm i -DE @nrwl/react. Generate a container app: npx nx g @nrwl/react:app container. Make sure you add React Router to the container.
  3. Install more dependencies: npm i @mui/material @emotion/react @emotion/styled. Create bootstrap.tsx, update main.tsx and move app-specific code to App.tsx. Build the Header component and add some dummy routes.
  4. Generate the marketing app: npx nx g @nrwl/react:app marketing. Make sure you add React Router to the marketing app. Create bootstrap.tsx, update main.tsx and move app-specific code to App.tsx. Update the root id in index.html to _marketing-app.
  5. Setup bootstrap.tsx with a mount function. Render the app using the mount function if in a development environment. Add some special routing logic so the container and marketing apps stay in sync. Install the Material Icons: npm i @mui/icons-material. Build out the Copyright, Landing and Pricing components.
  6. Create webpack.config.js in both the container and marketing apps. Point each app's webpackConfig in its respective project.json to the appropriate configuration file. Make sure to explictly set a unique port for each app. Add decl.d.ts to container and declare the marketing module. Create the MarketingApp component which loads up the MFE. Lazily load the component for the base route.
  7. Add the Angular schematic to the workspace: npm i -DE @nrwl/angular. Generate an auth app: npx nx g @nrwl/angular:app auth. Make sure you add routing to the auth app.

nxmfe's People

Contributors

rdenman avatar

Watchers

James Cloos avatar  avatar

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.