Code Monkey home page Code Monkey logo

microfrontend-nginx-playground's Introduction

Overview

This project was created to better understand the usage of NGINX helper when architecting microfrontends following this tutorial.

Architecture Overview

The NGINX orchestrator its done via build-code (after run npm run build in the projects).

When API is triggerd, it receives and manages the response managing the routes.

It decides to which microfrontend it should load at which moment.

Its worth also to remember that our orchestrator works like a reverse-proxy.

Which means that using the nginx reverse proxy, it provides one more abstraction level which assures the traffic flow from the client to the server.

It means that wheneaver we send a request, our reverse-proxy double checks wheather we have to send to which docker (microfrontend01, 02, or 3...).

Commands

  • npm i: to install the dependencies and to generate the lock file so the build docker step, works.
  • npm ci: cleans the node_module folder if exists and assures that the dependencies are sync with the package.json specs.

Docker

The idea is to have one docker with the nginx image for each microfrontend.

Then, once each each micrfrontend is deployed on each docker, on each container, on each nginx, we will create the orchestrator to communicate on each of these nginx microfrontends.

  • docker ps: list the containers.

  • docker images: list the images.

  • docker build -t app-react01 .: build a new image from where the Dockerfile its accessing (./).

  • docker run --name orchestrator -d -p 80:80 nginx: runs a docker with the orchestrator name, binding to the port 80, using the nginx image.

  • docker run --name app-react01 -d -p 80:80 app-react01: runs a docker with the app-react01 name, binding to the port 80, using the app-react1 image.

  • docker rm -f app-react01 app-react02 app-react03: stops several images w/ 1 command.

  • docker rm -f orchestrator: stops the orchestrator docker image using the --force arg.

  • docker rm orchestrator: deletes the orchestrator docker image.

  • docker-compose build orchestrator app-react01 app-react02 app-react03: builds all the apps after some change.

  • docker-compose up: recreates the containers and runs them.

image

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.