Git Product home page Git Product logo

micro-frontend-example's Introduction

micro-frontend example

This repository serves to demonstrate an example of micro-frontend implementation. It consists of the following apps in the respective directories:

  • restaurant (container app)
  • pizza-app (micro-frontend app)

The example is of a restaurant menu, where the pizza and sandwich are two sections. The pizza section is served as a micro-frontend while the sandwich section is not.

Getting Started

For the impatient: docker-compose

You can use docker-compose to start the setup quickly. Run the following command:

$ docker-compose up

Starting the container app: restaurant

Navigate to the restaurant directory and run the following:

$ npm install
$ npm start

The app will be available at http://localhost:8080.

Starting the micro-frontend: pizza-app

You can similarly navigate to the pizza-app directory and run the following commands to start the micro-frontend. It will serve up the micro-frontend JavaScript bundle at http://localhost:8081/app.bundle.js.

$ npm install
$ npm start

Rendering outside the micro-frontend frame

In this example, you can see how the pizza-app micro-frontend needs to control breadcrumbs that lie outside the micro-frontend frame:

micro-frontend-breadcrumbs

It does this by using React Portal APIs. When rendering the micro-frontend, the container app relinquishes control of the breadcrumbs to the micro-frontend. It passes the div ID of the breadcrumbs section to the micro-frontend, and the micro-frontend in turn uses React Portal APIs to render it's own breadcrumbs within that section.

micro-frontend-example's People

Contributors

aravindbuilt avatar contentstack-admin avatar nandeesh-gajula avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micro-frontend-example's Issues

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.