Micro-frontends concept page demonstrating runtime composition via Module Federation. Shell host app loads independently-deployed remote MFEs (Search/Product/Checkout) from per-team CDN bundles, each with its own BFF backend and CI/CD pipeline. Shows shared design system as singleton via shared scope, cross-MFE communication through window CustomEvents bus, and React error boundaries for failure isolation. Four scenarios: initial load with Module Federation runtime, independent deploy by Checkout team without redeploying others, cross-MFE event from Search to Checkout via event bus, and failure isolation when one MFE bundle fails to load. Includes ADR on when MFE worth the complexity (Spotify/IKEA/Zalando scale: 100+ engineers, 5+ teams) vs anti-pattern for small teams.
Micro-frontends разделяют frontend по business/ownership boundaries и позволяют отдельным builds выпускаться независимо. Эта независимость условна: shell, route contract, shared dependencies, design tokens, telemetry и browser security policy остаются общими интеграционными поверхностями.
Module Federation загружает remote module асинхронно и затем выполняет его в общем JavaScript realm. Это композиция, не security sandbox: скомпрометированный remote обычно получает те же DOM и origin privileges, что host.
| Компонент | Роль в модели |
|---|---|
| Browser | load shell |
| Versioned Host Shell | load shell; resolve pinned versions; load checkout module; load account module; release and error context; route containment |
| Signed Release Manifest | resolve pinned versions |
| Checkout Remote | load checkout module; consume compatible contract |
| Account Remote | load account module; consume compatible contract |
| Shared Contracts and Design Tokens | consume compatible contract; consume compatible contract |
| Cross-build Observability | release and error context |
| Route Fallback and Rollback | route containment |
The shell reads an environment-specific release manifest, verifies allowed origin/integrity metadata and loads exact checkout and account versions compatible with its contract range.
Проверяемый исход: A user session is reproducible from shell and remote release IDs; refresh does not silently select an unreviewed latest build.
Checkout fails integrity, timeout or initialization checks. The shell records the release context and mounts a tested route fallback without corrupting account navigation.
Проверяемый исход: Failure stays inside an explicit boundary, the user receives an accessible recovery action, and rollback remains selectable.
A design-system or routing contract adds an optional capability. Consumers pass contract tests before the shell raises its minimum supported version and later removes the old path.
Проверяемый исход: Producer and consumer deploy order is safe, and shared-library deduplication is separate from API compatibility.
The shell accepts modules only from an allowlisted origin and immutable path with enforced integrity/CSP policy. A mutable or unexpected artifact is rejected before evaluation.
Проверяемый исход: Supply-chain controls fail closed and telemetry identifies the manifest, URL and policy result without executing untrusted code.
initial_transfer = host_bytes + Σ critical_remote_bytes + shared_bytes_not_deduplicated; compare compressed transfer and parse/execute CPU separately.release_combinations = Π supported_versions_i is an upper bound if every remote can vary independently; pinning tested sets deliberately collapses this state space.remote_error_rate = failed_mounts / attempted_mounts must be segmented by host version, remote version, route and browser.Числа и bounds выше действуют только при названных units, population и assumptions. Ни паттерн, ни browser API сами по себе не задают SLA, capacity или correctness.
Диаграмма использует Module Federation как один runtime example. Она не утверждает, что micro-frontends требуют webpack, что shared singleton безопасен или что независимый repository автоматически даёт независимый deploy.
Введите числа или выберите пресет