Skip to content
archipelago
Open-source micro frontend boilerplate

Three apps. Three deploys. One page.

Archipelago composes independently built and deployed React apps at runtime with Module Federation 2.0. Clone it, rename it, replace the demo domains — and keep an architecture that already handles shared React, cross-app events, routing, failures and contracts.

npx degit juliocarneiro/archipelago-mfe my-platform
localhost:4000/catalog
archipelago
Cart 0
Catalog
  • Low-profile keyboard
    $149
  • Wireless mouse
    $79
  • 27" 4K monitor
    $549
A live model of the boilerplate. Everything here runs in your browser.
What it solves

The hard parts, already done

Most micro frontend tutorials stop at “the remote rendered”. These are the problems you hit the week after — and how the boilerplate answers each one.

Two copies of React on the page
Every shared dependency comes from one config package as a singleton with a real semver range. An E2E test fails if a second React ever appears.
One remote goes down and the page goes blank
loaded-first sharing plus an error boundary per app. Only the broken area shows an error with “Try again”; the rest keeps working. Covered by an E2E test.
Apps need to talk without knowing each other
A typed event bus on DOM CustomEvent with replay. Props go down, events go up, and each piece of state has exactly one owner.
Two routers fighting over one URL
The shell owns prefixes like /catalog/*, each app owns its sub-routes, and a tiny popstate sync keeps both aligned — back button included.
A deploy silently breaks another team
Contract-first types for props, events and exposed modules. Breaking a contract fails the typecheck of every consumer in CI.
CSS from one app restyles another
Tailwind v4 with one shared theme. Only the shell ships the global reset; remotes ship utilities only.
Testing a pull request’s remote against production
A runtime plugin points any remote at another URL from localStorage, behind a host allowlist. No shell rebuild.
Boundaries erode over time
ESLint blocks app-to-app imports, CODEOWNERS maps folders to teams, and the PR template carries a contract checklist.
How it works

What happens when the page loads

The order matters: shared dependencies are settled first, remotes are fetched only when used, and failures stay inside their island.

  1. 1

    The shell boots and provides shared dependencies

    Its entry only runs import("./bootstrap"), giving Module Federation time to set up one React, one design system and one contracts package for the whole page.

  2. 2

    A widget from another app renders in the header

    cart/CartBadge is a component-level remote loaded with React.lazy. It runs inside the shell’s React tree, which is why React must be a singleton.

  3. 3

    A route mounts a whole app

    Visiting /catalog loads catalog/App through the MF Bridge. The shell calls render() with basename and user; the catalog creates its own React root and router.

  4. 4

    Apps talk through events

    “Add to cart” publishes cart:add-requested. The catalog never imports the cart. The cart owns the state, updates it and publishes cart:updated.

  5. 5

    A failure stays local

    If a remote cannot be fetched or crashes while rendering, its error boundary shows a contained error. Header, session and the other apps are untouched.

  • shell :4000
    Owns
    Layout, top-level routes, session
    Exposes
    nothing — it consumes
  • catalog :4001
    Owns
    Product list and detail, /catalog/*
    Exposes
    ./App
  • cart :4002
    Owns
    Cart state, /cart/*, header badge
    Exposes
    ./App · ./CartBadge
Get started

From clone to running platform in five commands

You need Node.js 22+ and pnpm 11 (corepack picks the version for you). Ports 4000, 4001 and 4002 must be free.

Get the code

GitHub template — click “Use this template” on the repository, then clone yours.

degit — copy the files without the git history:

npx degit juliocarneiro/archipelago-mfe my-platform
  1. 01 Enable pnpm through corepack

    corepack enable
  2. 02 Install dependencies

    pnpm install
  3. 03 Give it your package scope and project name (add --dry-run to preview)

    pnpm init:project --scope @acme --name acme-web
  4. 04 Refresh the lockfile, then lint, typecheck, test and build

    pnpm install && pnpm verify
  5. 05 Start every app with hot reload

    pnpm dev

Then open

  • shell http://localhost:4000
    The composed product — open this one
  • catalog http://localhost:4001
    Standalone, with a fake signed-in user
  • cart http://localhost:4002
    Standalone, with a fake-catalog harness

Everyday scripts

pnpm --filter @acme/catalog dev
Work on one app alone
pnpm test
Unit and component tests (Vitest) in every package
pnpm e2e
Playwright against the production builds
pnpm verify
lint + typecheck + test + build, before every PR
pnpm screenshots
Regenerate the README images
Rules of the platform

Six conventions that keep the apps independent

The boilerplate is only half the job. These rules are what stop a micro frontend platform from turning back into a monolith.

Project structure

A monorepo with independent deploys

One repository for tooling and atomic contract changes; one build, bucket and rollback per app.


            apps/
            
          
            shell/
            host: layout, routes, session, boundaries
          
            catalog/
            remote: exposes ./App
          
            cart/
            remote: exposes ./App and ./CartBadge
          
            packages/
            
          
            contracts/
            types, events, props, event bus
          
            ui/
            Tailwind theme + components
          
            mf-config/
            shared deps, ports, URLs, CORS
          
            tsconfig/
            base TS configs
          
            e2e/
            tests that cross boundaries
          
            scripts/
            init-project.mjs
          
            docs/
            study guide + ADRs
          

Inside each app

src/index.ts
only import("./bootstrap") — async boundary
src/bootstrap.tsx
standalone entry, fakes the shell
src/export-app.tsx
createBridgeComponent({ rootComponent: App })
src/styles.css
federated CSS, no global reset
rsbuild.config.ts
name · exposes · shared · port
Deploy

Each app is a static site

Build each one separately and publish it to its own CDN. The shell learns where the remotes live from two environment variables.

pnpm --filter @acme/catalog build   # → apps/catalog/dist
pnpm --filter @acme/cart build      # → apps/cart/dist

PUBLIC_CATALOG_URL=https://catalog.example.com \
PUBLIC_CART_URL=https://cart.example.com \
pnpm --filter @acme/shell build     # → apps/shell/dist
Cache
mf-manifest.json and the shell’s index.html with no-cache; hashed files with max-age=31536000, immutable.
CORS
Each remote’s host must allow the shell’s origin.
SPA fallback
The shell’s host serves index.html for unknown paths so deep links work.
Rollback
Republish the previous mf-manifest.json. Assets are immutable, so it takes seconds.
Stack

Current, boring where it should be

Module Federation
2.0 · manifest, bridge, runtime plugins
Rsbuild
Rspack-based, builds in milliseconds
React
19 · app-level and component-level remotes
TypeScript
strict, contract-first types
Tailwind CSS
v4 · one shared @theme
pnpm + Turborepo
workspaces, cached tasks
Vitest
unit, component and contract tests
Playwright
E2E against production builds

Start your platform from a working one.

MIT licensed. Issues and pull requests are welcome.