Git Product home page Git Product logo

micro-frontends's Introduction

micro-frontends

example repo for micro frontends with react and dependency inversion as integration pattern

playground to learn how to integrate micro frontends, usages product and content search as example

Assume you have two ore more different search providers as e.g. product and content search. Both are developed in different teams which want to develop and release their features independently. But you have to integrate them in frontend like the following:

alt search-example

Why?

To scale with multiple teams in a micro services environment

  • Keep coupling low
  • One-way dependency graph
  • Specialized assets know general assets, but not vice versa

Set up

yarn build

cd app/composer
yarn serve

cd app/search
yarn serve

cd app/product
yarn serve

cd app/content
yarn serve

Open http://localhost:8080 in web browser

Architecture

Components

Dependency graph without cycles

alt components dependency

Sequence

Load HTML and JS

alt load html and js

Execute search with one product search provider

alt execute search with one product search provider

... and add additional content search provider

alt execute search with product and content search provider

... and if no results from any search provider, provide fallback with suggestions

alt fallback with suggestions

Project structure

.
├── composer
│   └── server
├── content
│   ├── client
│   └── server
├── product
│   ├── client
│   └── server
├── search
│   ├── client
│   └── server
└── search-api
    ├── lib
    └── src
    

search-api

interface to register different search providers with

  • ID
  • order
  • execute_search
  • execute_count
  • getSearchTab
  • getResultComponent

search

  • client

    • provides container stuff, like rendering search tabs or search results
    • calls search callback on active search provider
    • handles search errors, search fallback and merges suggestions from all search providers
  • server

    • delivers client js, could be a CDN as well

product

  • client

    • provides components to render search results and search tabs
    • could implement filter and use fetchData callback to re-execute search
  • server

    • delivers client js, could be a CDN as well
    • could provide REST-API in real world use case

content

same as product

composer

  • server
    • central unit that receives browser request and return html document
    • includes all scripts
    • may or may not fetch initial data and could be used for server side rendering

Slides

Uses demoit and Go

  1. Install Go
  2. Start with ./demoit slides/demo

or use PDF.

ToDos

Suspense/Loading optimization

error handling

add example and test it

layout

optimization, evt. remove react-bootstrap

micro-frontends's People

Contributors

bseber avatar denise-schaefer avatar deniseschaeferdmde avatar dependabot[bot] 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

Watchers

 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.