Giter Site home page Giter Site logo

sasoria / astro-microfrontends Goto Github PK

View Code? Open in Web Editor NEW
55.0 2.0 8.0 265 KB

Client-side composition of microfrontends using Astro

Home Page: https://medium.com/@sergio.a.soria/setting-up-micro-frontends-with-astro-and-ecma-script-modules-137340d2c520

License: MIT License

HTML 12.84% JavaScript 69.86% CSS 5.71% Astro 11.59%
astro esm importmaps javascript react ssr micro-frontends microfrontends

astro-microfrontends's Introduction

astro-microfrontends

This demo takes advantage of EcmaScript Modules (ESM) and url-imports to do client-side composition of microfrontends. Express is used for serving assets, but ideally one would have a dedicated CDN hosting them.

Features

  • โœจ Client-side composition of microfrontends
  • ๐Ÿ“ฆ Multiframeworks with Astro Islands
  • ๐Ÿš€ SSG/SSR supported by Astro

Usage

Micro frontends

  • Build each micro frontend with npm run build
  • Start each micro frontend with npm run preview

For production you would start the node server in the server folder, after building.

Shell

  • Build the shell with npm run build
  • Start the shell with npm run preview

Shared dependencies

Dependencies such as react and react-dom are shared across applications. They are fetched from esm.sh and gets cached in the browser, reducing the bundle size. Each app can share other dependencies as well through url imports.

Recommendations

I've written a few recommendations and best practices. You can read them here. I also have a section for questions and answers.

Resources

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.