Configuring Federated Discovery
This guide explains how to configure production infrastructure (Nginx/Ingress) to serve the Unified Discovery Manifest required for Framework M's federated shell.
The Goal
The Shell bootstraps by fetching a JSON manifest from /api/gateway/remotes. In production, this manifest can be static (hardcoded in Nginx) or dynamic (served by a dedicated discovery service).
Static "Monolith" Discovery (Nginx)
Use this if you have a set of MFEs that are deployed together or change infrequently.
location /api/gateway/remotes {
default_type application/json;
return 200 '{
"finance": {
"url": "https://cdn.example.com/mfe/finance/remoteEntry.js",
"apiUrl": "https://api.example.com/api/finance/v1",
"metaUrl": "https://api.example.com/api/finance/meta"
},
"inventory": {
"url": "https://cdn.example.com/mfe/inventory/remoteEntry.js",
"apiUrl": "https://api.example.com/api/inventory/v1",
"metaUrl": "https://api.example.com/api/inventory/meta"
}
}';
}
Dynamic "Macroservice" Discovery (Ingress)
In a true microservice environment, each service should define its own presence. You can use an Ingress Controller to merge paths, but for discovery, it is recommended to have a small "Gateway" service that aggregates these.
The Gateway Pattern
- Each microservice (e.g.,
finance-api) exposes its own discovery unit at/api/finance/discovery. - The
Gatewayservice fetches these and aggregates them into the final/api/gateway/remotesresponse.
Kubernetes / Nginx Ingress Fragment
Ensure your Ingress correctly routes the gateway:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: framework-m-gateway
spec:
rules:
- host: api.example.com
http:
paths:
- path: /api/gateway
pathType: Prefix
backend:
service:
name: gateway-service
port:
number: 80
Security & CORS
Since the Shell might load scripts from a CDN:
- Ensure your CDN serves
remoteEntry.jswithAccess-Control-Allow-Origin: *(or your shell's domain). - The discovery API
/api/gateway/remotesmust also be accessible by the Shell.