A microfrontend architecture project demonstrating module federation with React (host) and Svelte (remote) applications, sharing state via RxJS.
?user=[id]
)microfront-reactive-query/
āāā host/ # React host application
ā āāā src/
ā ā āāā App.jsx # Main React component
ā ā āāā App.css # Styles
ā ā āāā userStore.js # Shared RxJS store
ā ā āāā index.js # Entry point
ā āāā public/
ā ā āāā index.html
ā āāā webpack.config.js
ā āāā package.json
āāā remote-svelte/ # Svelte remote application
ā āāā src/
ā ā āāā UserDetailSidebar.svelte # Sidebar component
ā ā āāā UserDetailSidebar.js # React wrapper
ā ā āāā userStore.js # Shared RxJS store
ā ā āāā App.svelte # Standalone app
ā ā āāā index.js
ā āāā public/
ā ā āāā index.html
ā āāā webpack.config.js
ā āāā package.json
āāā package.json # Root package with scripts
npm install
cd host && npm install
cd ../remote-svelte && npm install
cd ..
Or use the convenience script:
npm run install:all
Start both applications simultaneously:
npm run dev
Or start them individually:
# Terminal 1 - Start the host app (port 3002)
npm run dev:host
# Terminal 2 - Start the remote app (port 3001)
npm run dev:remote
Then open your browser:
Host Application (React on port 3002):
Remote Application (Svelte on port 3001):
UserDetailSidebar
component via Module FederationShared State:
userStore.js
with RxJS BehaviorSubjectsURL Synchronization:
?user=[id]
Host (React):
remotes: {
remoteSvelte: 'remoteSvelte@http://localhost:3001/remoteEntry.js'
}
Remote (Svelte):
exposes: {
'./UserDetailSidebar': './src/UserDetailSidebar.js'
}
host/src/App.jsx
UserDetailSidebar.svelte
stylescd host && npm run build
cd ../remote-svelte && npm run build
MIT