Micro-frontend interaction
ION’s user experiences (Alya, Veritas) are composed of independently deployed micro-frontends (MFEs) loaded by a shell. Those MFEs show event-sourced state that changes in near real time as commands are accepted and events are committed. This page defines how the MFE architecture connects to the event-sourced backend without every MFE opening its own real-time connection, and without the shell becoming a single point of failure.
It builds on the UI interaction page, which defines the CQRS read/write split, the BFF, the hot-entity Sidecar, and SignalR groups. Here the focus is MFE composition and real-time delivery.
The problem: one connection per MFE does not scale
If each MFE opens its own SignalR/WebSocket connection, the session exhausts concurrent-connection quotas, multiplies network overhead, and fragments authentication. The fix is a shared connection pattern: the shell holds one SignalR connection per authenticated session and MFEs share it.
The risk with centralizing is that the shell becomes a single point of failure. ION avoids this by making the shell a network-lifecycle orchestrator only — it owns the connection, not the business logic. If the shell blocks or throws, it must not freeze the real-time pipeline for every MFE.
Design goals
| Functional | Non-functional |
|---|---|
| One SignalR connection per authenticated session | No direct MFE-to-MFE dependencies |
| MFEs read the shared connection state | No runtime coupling between MFEs |
| MFEs stay independent of SignalR implementation details | No business logic in the shell |
| Automatic reconnect | Scales to dozens of MFEs and resilient to reconnects |
Composition topology
The shell holds the single SignalR connection in SignalRProvider from
@fe-ws/signalr. That package is a Module Federation singleton, so the shell and
every remote share one module instance, one React context, and one connection. MFEs
read the connection state and register their own hub handlers; the shell never calls
an MFE method directly.
- The shell owns connection, reconnection, and disconnection, and exposes the state
(
connection,isConnected,error) through the shared context. - The shell does not parse data channels or apply business logic to payloads.
- Each MFE registers its own hub handlers, manages its own backend subscriptions, and stays operationally isolated.
Responsibilities
| Shell | MFE | |
|---|---|---|
| Owns | Authentication, SignalR negotiation, connection and reconnection, sharing the connection state | Reading the connection state, registering hub handlers and business subscriptions, recovering subscriptions after reconnect |
| Does not own | Resource authorization, entity subscriptions, business messaging, payload routing | The connection lifecycle or the SignalR SKU |
From committed event to MFE
Real-time updates originate from the event store, not from the shell. A command is accepted, an event is committed, and a backend producer publishes a signed CloudEvent to Service Bus. The Shell SignalR BFF sends it to the scoped group the MFE registered for. The shell’s connection carries it; the shell adds no business logic.
Each MFE registers handlers only for the event names it understands. The shell applies no parsing or routing logic, so a fault in one MFE’s handler cannot corrupt another’s. The Micro-frontends real-time page documents the endpoints, the group contract, and the producer contract.
Lifecycle phases
Phase 1 — Authentication and negotiation
- The shell authenticates the user with
msal.jsagainst Microsoft Entra ID and acquires an access token. - The shell calls the Shell SignalR BFF negotiate endpoint with the Entra ID bearer token.
- The BFF validates the token and issues an Azure SignalR client token carrying
the user’s
oidas the user identifier.
Phase 2 — Connection establishment and shared state
- The shell’s
SignalRProvideropens one WebSocket to Azure SignalR with@microsoft/signalr. - On handshake, the provider sets
isConnectedand exposes the connection through the shared context. - MFEs read that state with
useSignalR. The shell never invokes MFE methods.
Phase 3 — MFE resource registration
When an MFE needs updates for a resource (for example an investigation), it requests them through an authorized route on its own BFF — the MFE, not the shell, owns this.
- The MFE sends an HTTP POST to its own BFF with the shared Entra ID context, for
example
POST /api/subscriptions/investigation/{id}. - The BFF verifies the user’s permission for that resource and asks the Shell
SignalR BFF to add the user to the group
{entity_name}-{entity_id}. Groups are backend-controlled; the frontend never grants itself membership.
Phase 4 — Reconnection resiliency
- On a drop,
withAutomaticReconnect()retries and the provider setsisConnectedto false; MFEs can show a “reconnecting” state. - On recovery, the connection has a new connection ID.
- MFEs catch up missed data over HTTP/REST and re-register their subscriptions. Membership is per user and normally survives, but re-registering is idempotent and restores it if the hub was recreated.
Failure modes and SPOF isolation
| Failure vector | Impact | Remediation |
|---|---|---|
| Shell UI-thread block | SignalR keep-alive pings time out and drop the connection | Run the raw SignalR client in an async WebWorker so a heavy UI thread cannot stall keep-alives. |
| Shell script crash or connection down | No live updates | Each MFE applies a timeout fallback and downgrades to HTTP polling. This is a directive that is not implemented yet (real-time gaps). |
| Handler leaks | Degraded performance over long sessions | Strict lifecycle control: useHubEvent unregisters its handler on unmount. |
Design principles
- One SignalR connection per authenticated browser session.
- The shell owns only connection management.
- MFEs own all business subscriptions.
- The shell shares only connection state, through the
@fe-ws/signalrsingleton. - MFEs re-register subscriptions after reconnect.
- No business state is stored in the shell.
- No MFE-to-MFE communication.
- Resource authorization is always performed by backend APIs.
- SignalR groups remain backend-controlled.
- Connection lifecycle and business lifecycle stay completely separated.
Service SKU
The shared connection depends on a SignalR SKU that supports availability zones and autoscaling. The deployed SKU, unit count, and verdict against the 6,000 concurrent-connection envelope are tracked in the capacity model.