Micro-frontend delivery
Resource map updater
Only download what changed
Each release gets its own URL, and one small import map lists the current release of every app, so users download only the apps that changed.
The problem
The platform's frontend is made of many single-spa micro-frontends, each released on its own schedule. When the app starts, it requests an import map: one file that tells SystemJS where to find each micro-frontend’s bundle.
Many of those apps release infrequently, so most of what a returning user needs hasn’t changed since their last visit. The goal was for users to download only what had.
My role
I led and owned the project, building the resource map updater from a design by my engineering manager, with guidance from a senior engineer.
How it works
- Every release gets its own URL. Each build is published to a new versioned path, and a published bundle never changes, so it can be cached safely.
- Only the import map changes. After a build, a shared GitHub Actions workflow calls the resource map updater, a Lambda function. It reads the current map from S3, replaces that one app’s entry, and writes the merged map back.
- The app reads the map when it starts. Entries for apps that didn’t change still point to bundles the browser already has. Only an updated app has a new URL to fetch.
- Same stack as the app. The bundles were already served from CloudFront, so the updater was built on S3, Lambda and GitHub Actions rather than a separate deployment service.
The tradeoff
Every app’s release writes to the same file, so two releases landing at once could overwrite each other’s change. The updater runs one update at a time and retries on conflict, so simultaneous releases are applied in turn instead of racing. Releases occasionally wait on each other; in exchange, they can’t overwrite each other’s entries.
Safeguards
- Registration check. The workflow blocks the release of any app that isn’t registered with the updater, so a typo or an unregistered app can’t add an entry to production’s map.
- Rollback without a rebuild. Old releases stay at their own paths. If a client broke, an engineer could point its entry in the map back to the last good bundle.