Skip to content

unstubbable/mfng

Repository files navigation

MFNG

⚗️ A Minimal React Server Components Bundler & Library

Packages

MFNG offers two packages that together enable the building of a production-ready RSC app.

@mfng/core

This package contains the essential building blocks required on both the server and the client to create a streaming, server-side rendered, and properly hydrated RSC app. It also provides utilities that are needed for server-centric, client-side navigation.

Documentation

@mfng/webpack-rsc

This package provides a set of Webpack loaders and plugins required for building an RSC application bundle for the browser, as well as for the server. The server bundle can be deployed to any serverless, edge, or Node.js-based environment. @mfng/webpack-rsc can be used standalone as an RSC bundling solution or in conjunction with @mfng/core.

Documentation

Features

  • React server components
  • Server-side rendering
  • Client components, lazily loaded as separate chunks
  • Server actions
    • passed as props from the server to the client
    • imported from the client
    • top-level functions/closures with inline 'use server' directive
    • auto-binding of closed-over variables (not planned)
  • Progressively enhanced form actions
  • Suspensy routing
  • Production builds
  • Development server
  • Serverless deployment examples
  • Support for poisoned imports
  • Support for the Vercel AI SDK
  • Partial prerendering
  • Advanced routing

Name Origin

The name MFNG stands for "Microfrontends Next Generation". The project was originally motivated by the following questions:

Do we still need to deploy microfrontends and their APIs (also known as BFFs – Backends for Frontends) independently of the main app? Or can we integrate them at build-time, though dynamically composed at run-time, and allow them to use server components to fetch their data on the server?

It has since evolved into a general-purpose RSC library, not specifically targeted at the microfrontends use case... until we explore some form of federation integration, as pioneered by federated-rsc, perhaps.