Open Components

A Micro Frontend Framework

Jakub Pawłowski

Micro Frontends

App Architecture

monolith front-and-back microservices

Micro-everything

monolith-frontback-microservices

Autonomy

oc-composition

  • own tech stack
  • self contained
  • customer focused
  • has a mission

Micro Frontends

Advantages

  • team autonomy
  • reduced scope
  • experiment & rework
  • reusability (potentially)
  • breaking down the monolith
  • http & cacheable

  • immutability

  • reusability (potentially)

  • small, autonomous teams

  • customer focused

Challenges

Yes,

  • own tech stach
  • independent deployments
  • self contained
  • customer focused

But…

  • library hell
  • versioning
  • coherent styling
  • component interaction

Micro Frontends

Challenges

  • coherent styling
  • dependencies & versioning
  • interaction between components

Composition

How to implement?

  • separate pages, interlinked
  • iframes
  • Server Side Includes
  • Web Components
  • custom frameworks

OpenComponents

OpenComponents is an open-source, “batteries included” micro frontends framework

notes:

https://github.com/opencomponents/oc

Composition

oc-artictecture

Component structure

oc-composition

Component structure

oc-composition

Data flow

oc-composition

Interaction

via Events

// oc-buy-now
window.oc.events.fire('webshop:add-to-cart', {
  id: 'product123',
  amount: 1
});
// oc-basket
window.oc.events.on("webshop:add-to-cart", (_eventDetails, eventData) => {
  const { id, amount } = eventData;
  handleAddToCart(id, amount);
});

Versioning

oc-artictecture

Testing in isolation

oc-registry

skyscanner

Micro frontends

Challenges

  • library hell
  • versioning
  • coherent styling
  • component interaction

Ingredients

  • ✅ client-side templates
  • ✅ server-side registry with versioning
  • ⚒️ do it yourself :)
  • ✅ custom events

Examples

guestline

guestline

guestline

guestline

opentable

skyscanner

Links

Don’t forget

guestline Guestline - we’re hiring!

Thank you!

Questions?