libero / publisher-micro-frontend-experiment

https://github.com/libero/publisher/issues/371
MIT License
0 stars 0 forks source link

Libero Publisher micro-frontends experiment

Instructions

  1. Run make
  2. Open http://localhost:8081/ and add an article (click the ⚡️ under the /articles link on the bottom right).
  3. Open http://localhost:8000/ to view the homepage and follow the links.

What's here

Bunch of services showing two forms of micro-frontends:

  1. Page-level (homepage and article-page) composed by Nginx (web)
  2. Server-side component level (header and footer) used by the page-level front-ends.

Page-level

This is useful to be able to replace/extend at the page (group) level, so you don't have to throw everything away to change something.

Hypermedia helps somewhat anyway, but probably isn't enough for customisable areas (eg an About section), or adding different content types (eg podcasts) without it having to understand everything that is possible.

Concerns

Component-level

The header and footer is shared across all the pages, and duplicating it is hard.

Two approaches:

  1. Expose data that is used in the pattern

    Means the rendering, and assets, of the pattern is done by the page-service. Would be complicated to make flexible etc.

  2. Expose the rendered pattern

    Means the HTML, CSS, JS etc is rendered by the component service and is then embedded in the page-service. Means that it's easy to make changes without individual page services having to care (Want a custom footer? Just replace the footer service).

    This is method that has been tried. (At the code-level, rather than a simple server-side include.)

Concerns