FynMesh is a large enterprise scale web application framework that provides advanced module federation and micro-frontend capabilities using Rollup to enable seamless sharing of code between independently deployed applications.
FynMesh allows you to:
- Build independent micro-frontends with their own deployment lifecycle
- Share components and logic between applications using Module Federation
- Efficiently handle shared dependencies to avoid duplicate loading
- Integrate applications seamlessly at runtime
- Load multiple versions of the same module simultaneously
The kernel is the central component of FynMesh, located in the core/kernel
directory. It's responsible for:
- Loading and initializing fynapps (micro-frontends)
- Managing shared dependencies
- Providing runtime configuration
- Handling cross-fynapp communication
The kernel implementation is minimal but functional, focusing on the essential capabilities needed to load and manage fynapps.
FynApps are self-contained micro-frontends that can be developed and deployed independently. Each fynapp:
- Has its own build and deployment lifecycle
- Can expose components and modules for other fynapps to consume
- Can share dependencies with other fynapps
- Follows a specific structure with manifest files and module federation entry points
FynMesh provides powerful module federation capabilities that are valuable both for micro-frontend architectures and single applications. The framework can handle multiple versions of the same federated module running simultaneously through containers that implement the same federated module name but with different underlying implementations.
Core Features:
- Runtime Module Sharing: Load modules from other applications at runtime
- Shared Dependency Management: Smart loading of shared dependencies with version matching
- Framework Agnostic: Support for React, Vue, Marko, Preact, Solid, and more
- Development Tooling: CLI tools for creating and managing fynapps
Advanced Capabilities:
- Multi-Version Support: Load multiple versions of the same module simultaneously
- Dynamic Code Loading: Load application modules on-demand to reduce initial bundle size
- Plugin Architecture: Build extensible applications where features can be loaded dynamically
- Library Sharing: Share common libraries and components across different parts of a large application
- Code Splitting: Advanced code splitting strategies beyond what traditional bundlers offer
- Runtime Flexibility: Modify application behavior without rebuilding the entire application
- Gradual Migration: Deploy new versions alongside existing ones
- A/B Testing: Run different versions for different user groups
- Backwards Compatibility: Maintain support for legacy versions
- Isolated Dependencies: Apps can use different versions of the same library
- Version Resolution: Automatic handling of version compatibility
Micro-Frontend Capabilities:
- Flexible Architecture: Support for various micro-frontend patterns
- Independent Deployment: Each fynapp has its own build and deployment lifecycle
- Cross-App Integration: Seamless integration of independently developed applications
Multi Versions Demo Examples:
In demo, there's a fynapp fynapp-react-lib
with two versions implemented in different directories:
demo/fynapp-react-18/
- Provides React 18 library as a federated moduledemo/fynapp-react-19/
- Provides React 19 library as a federated module
In demo, there's a fynapp fynapp-x1
with two versions implemented in different directories, to provide some common React components for other fynapps to build with:
demo/fynapp-x1/
- Version 1 of shared component librarydemo/fynapp-x1-v2/
- Version 2 of shared component library
These capabilities enable:
- Independent deployment cycles for different teams
- Incremental adoption of new library versions
- Complex enterprise scenarios with mixed technology stacks
- Zero-downtime migrations and rollbacks
This is a colorepo managed with fynpo where each package can be developed and deployed independently, while being automatically interconnected locally:
core/kernel/
- Main kernel implementation for loading and managing fynappsrollup-federation/
- Core module federation based on SystemJS co-located at https://github.com/jchip/rollup-federationdemo/
- Example applications demonstrating the framework in action with various frontend frameworksdev-tools/
- Development tools including create-fynapp for scaffolding new fynappsmisc/
- Miscellaneous utilities and examples
Colorepo Benefits:
- Shared dependencies are managed efficiently by fyn
- Packages can import from each other easily within the colorepo
- The kernel provides runtime integration between independently deployed fynapps
- Clone the repository
or
git clone https://github.com/jchip/fynmesh.git
git clone git@github.com:jchip/fynmesh.git
- Install fyn if you don't have it already:
npm install -g fyn
- Install dependencies using fyn:
for production build:
fyn bootstrap
NODE_ENV=production fyn bootstrap
- Run the demo applications:
fyn start
The typical workflow for developing with FynMesh includes:
- Create a new fynapp using the
create-fynapp
tool - Develop the fynapp independently
- Build and deploy the fynapp
- Register the fynapp with the kernel
- The kernel loads and manages the fynapp at runtime
- Module Federation: Used for sharing code between independently deployed applications
- Rollup: Build tool used for bundling fynapps
- TypeScript: The primary language used throughout the codebase
- Various Frontend Frameworks: Support for React, Vue, Marko, Preact, and Solid
For more detailed documentation on how to use FynMesh, please check the documentation within each module.