A powerful micro-frontend framework for React applications
Scalprum is a JavaScript micro-frontend framework that enables you to build dynamic, scalable applications by composing components from multiple sources. Built on top of Module Federation, Scalprum provides a developer-friendly abstraction for managing federated modules with advanced features like Remote Hooks and runtime plugin systems.
- π§© Dynamic Module Loading - Load React components from remote sources at runtime
- π£ Remote Hooks - Share React hooks across micro-frontends seamlessly
- β‘ High Performance - Built on Module Federation for optimal bundle sharing
- π§ Build Tool Agnostic - Compatible with Webpack 5, Rspack, and Module Federation Runtime
- π― Type Safe - Full TypeScript support with comprehensive type definitions
- π Plugin Architecture - Extensible system for building plugin-based applications
npm install @scalprum/core @scalprum/react-core
import { ScalprumProvider, ScalprumComponent } from '@scalprum/react-core';
const config = {
myModule: {
name: 'myModule',
manifestLocation: '/path/to/plugin-manifest.json'
}
};
function App() {
return (
<ScalprumProvider config={config}>
<ScalprumComponent scope="myModule" module="MyComponent" />
</ScalprumProvider>
);
}
Package | Description |
---|---|
@scalprum/core |
Framework-agnostic core for module federation |
@scalprum/react-core |
React bindings with hooks and components |
@scalprum/build-utils |
Build tools and NX executors |
@scalprum/react-test-utils |
Testing utilities for Scalprum apps |
Documentation is organized within individual package directories, following monorepo best practices. This ensures package READMEs appear on npm automatically and documentation stays aligned with the code it documents.
- π Getting Started Guide - Complete setup tutorial
- π¦ Package Documentation:
- @scalprum/core - Framework-agnostic core
- @scalprum/react-core - React bindings and hooks
- @scalprum/build-utils - Build tools and NX executors
- @scalprum/react-test-utils - Testing utilities
- π£ Remote Hooks - Share hooks across micro-frontends:
- Node.js 16+
- Build environment with Webpack 5, Rspack, or Module Federation Runtime support
- React 16.8+ (for hooks support)
-
Install Scalprum packages:
npm install @scalprum/core @scalprum/react-core
-
Create a host application:
import { ScalprumProvider, ScalprumComponent } from '@scalprum/react-core'; const config = { myModule: { name: 'myModule', manifestLocation: 'http://localhost:8003/plugin-manifest.json' } }; function App() { return ( <ScalprumProvider config={config}> <ScalprumComponent scope="myModule" module="MyComponent" /> </ScalprumProvider> ); }
-
Configure Module Federation in your bundler
For a complete step-by-step tutorial including remote module setup, see our Getting Started Guide.
Host Application: The main application that manages module loading, routing, and data sharing. It loads first and provides the foundation for your micro-frontend architecture.
Remote Modules: Independent applications that can be loaded dynamically at runtime. They expose components that can be consumed by the host application.
Scalprum works with multiple build tools and module federation implementations:
- Webpack 5: Native Module Federation support
- Rspack: High-performance Rust-based bundler with Module Federation
- Module Federation Runtime: Framework-agnostic module federation for any bundler
Required shared dependencies (must be marked as singletons):
const shared = {
'@scalprum/react-core': { singleton: true },
'react': { singleton: true },
'react-dom': { singleton: true }
};
Root component that provides module loading context:
import { ScalprumProvider } from '@scalprum/react-core';
const config = {
myModule: {
name: 'myModule',
manifestLocation: '/path/to/plugin-manifest.json'
}
};
<ScalprumProvider
config={config}
api={{ /* shared context */ }}
>
<App />
</ScalprumProvider>
Component for rendering remote modules:
import { ScalprumComponent } from '@scalprum/react-core';
<ScalprumComponent
scope="myModule"
module="MyComponent"
fallback={<Loading />}
ErrorComponent={ErrorFallback}
// Additional props passed to remote component
customProp="value"
/>
We welcome contributions to Scalprum! Whether it's bug reports, feature requests, or code contributions, your help makes this project better.
- Report bugs or request features - Open an issue on GitHub
- Join discussions - Ask questions or share ideas
- Submit pull requests - Fix bugs or add new features
- Improve documentation - Help make our docs better
- Share examples - Contribute real-world usage examples
For development setup and guidelines, check the individual package READMEs and explore the examples/
directory for reference implementations.