Table of Contents

React shell architecture

How the stock MIB React shell (MibFrontEnd) is put together: what is a published package vs baked into the image, how it boots, and how it discovers and loads federated remotes. Grounded on MibFrontEnd@master d73f51e84 (cms 2.48.0, @agilecontent/mib-modules 1.40.0).

Monorepo layout — who owns what

Path Package Published? Role
apps/cms cms 2.48.0 image only (nginx, tag family cms-X.Y.Z) bootstrap, federation loading, routing, auth, root providers
packages/modules @agilecontent/mib-modules 1.40.0 npm (GitHub Packages) the shared seam package: Decorators types, ComponentsContextProvider/useDecorators, useContentContext, content-edition module
packages/core-components core-components 1.0.0, private: true never — bundled into apps/cms the stock renderers (RelatedList, List, AsyncRelatedList, …) — the implementations behind the core viewType map
packages/api-connector @agilecontent/mib-api-connector npm typed BFF/API services + DTOs
packages/ui @agilecontent/ui npm the antd-wrapping UI kit remotes must import instead of antd

The published set is exactly [@agilecontent/ui, @agilecontent/mib-modules, @agilecontent/mib-api-connector] (.github/workflows/publish-packages.yml:127-131). Consequence: stock-renderer behavior (including which decorator seams exist) is a property of the deployed image version, not of any package a remote installs.

Boot sequence

main.tsx renders a static spinner, then (bootstrap.tsx:6-15):

await Promise.all([loadBaseStyles(), initFederation().then(() => serverSetUp())]);
const { default: App } = await import('./pages/App');

Every remote is fully loaded and merged before the React tree mounts — nothing "arrives late." The flip side: a hanging remoteEntry.js blocks the entire CMS boot (no timeout; only rejection is caught).

Runtime config and remote discovery

start.sh writes config.json from env at container boot: API_URL, AUTH_URL, CUSTOM_COMPONENTS_URL, CUSTOM_COMPONENTS_2_URL, CUSTOM_COMPONENTS_3_URL, … The federation plugin resolves each remote URL by fetching <base>config.json at runtime (externalType: 'promise', apps/cms/vite.config.ts:55-81); the build-time VITE_* fallback is empty in the stock image. window.cms plays no part in discovery — it carries {instance, env} (the shared axios instance remotes reuse to inherit auth).

There are exactly three remote slots, hard-coded (federation.ts:91-107):

import('customComponents/all').catch(() => null)   // ← CUSTOM_COMPONENTS_URL
import('customComponents2/all').catch(() => null)  // ← CUSTOM_COMPONENTS_2_URL
import('customComponents3/all').catch(() => null)  // ← CUSTOM_COMPONENTS_3_URL

A 404/broken remote silently disappears (.catch(() => null) + filter(Boolean)); an unset URL means the slot is never attempted.

Merge semantics — per export, and they differ

mergeConfig (federation.ts:44-62) reduces the loaded slots in order:

  • components / skeletons / suspenseSkeletons / renderTypes / variants / translations — merged per key, last slot wins per key.
  • decorators — merged at the Decorators root: kind-level clobber; the later slot's whole relatedList replaces the earlier one's (see frontend-decorators).
  • useFormChange — the one additive export: every slot's hook runs in order (federation.ts:212-218). This also makes it a hooks-rules hazard — a remote whose useFormChange calls hooks conditionally breaks the host.

Root context wiring

Providers (application/context/Context.tsx:35-55): SWRConfig → ComponentsContextProvider {buildComponents, useFormChange, buildDecorators} → Translations → ThemeContext → PageProvider. i18n namespaces (Context.tsx:23-29): ui, modules, core-c, cms, cc (= the remotes' merged translations export; values may be dict:<dictionary/key> indirections resolved against the CMS dictionary).

setup.yaml mapping

frontend.shell pins the image; frontend.remotes[] feed the CUSTOM_COMPONENTS_*_URL envs (first remote → CUSTOM_COMPONENTS_URL). The shell repo is tagged cms-X.Y.Z matching image X.Y.Z; its package.json version (1.0.0) is legacy noise.

See also: remote-anatomy · frontend-decorators · viewtype-resolution.