microfrontends
AGENTS.md45 starsChanged 7 months agoMITView on GitHub
This is a monorepo for @vercel/microfrontends, a library that enables splitting large applications into independently developed and deployed microfrontends on Vercel. The package provides generic platform support for microfrontends in multiple frameworks, such as Next.js, SvelteKit, React Router, Vite, and React. When running commands for a specific application, do not cd into the directory. Run commands from the root. The above commands can be run for a particular package by using a filter option: pnpm checks -F <package name>. Use…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- vercel-microfrontendsSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Use pnpm for package management
- Very specific: line 20
Follow Vercel style guide (configured via @vercel/style-guide)
- Very specific: line 32
When running commands for a specific application, do not cd into the directory.
- Very specific: line 34
Make sure that pnpm checks is successful for the entire repository when verifying a change.
- Distinctive: line 44
When testing a change, make sure that these dev commands all start up the server successfully.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a monorepo for @vercel/microfrontends, a library that enables splitting large applications into independently developed and deployed microfrontends on Vercel. The package provides generic platform support for microfrontends in multiple frameworks, such as Next.js, SvelteKit, React Router, Vite, and React.
Repository Structure
packages/microfrontends/- The main@vercel/microfrontendspackage (the only publishable package)examples/- Working examples of microfrontend implementations (nextjs-app, nextjs-pages, react-router, single-spa, sveltekit, etc.)
Technologies
- This is a TypeScript codebase
- Use pnpm for package management
- Turbo manages the monorepo build pipeline
- The package uses dual ESM/CJS exports via tsup
- Follow Vercel style guide (configured via
@vercel/style-guide) - Be familiar with Module Federation, single-spa, and Next.js Multi-Zones
Common Commands
pnpm build- Build all packages using Turbopnpm test- Run unit tests for all packagespnpm lint- Run ESLint on all packagespnpm format- Format all files with Prettierpnpm typecheck- Run TypeScript type checkingpnpm checks- Run build, lint, test, and typecheck on all packages (run before submitting PRs)
When running commands for a specific application, do not cd into the directory. Run commands from the root. The above commands can be run for a particular package by using a filter option: pnpm checks -F <package name>. Use this.
Make sure that pnpm checks is successful for the entire repository when verifying a change.
Dev examples
pnpm dev:nextjs-app- Run the Next.js App Router examplepnpm dev:nextjs-pages- Run the Next.js Pages Router examplepnpm dev:react-router- Run the React Router examplepnpm dev:single-spa- Run the single-spa examplepnpm dev:sveltekit- Run the SvelteKit example
When testing a change, make sure that these dev commands all start up the server successfully. If the server is running and there are no errors after 30 seconds, consider that successful.
NPM Package Management
pnpm changeset- Create a changeset for releasingpnpm version-packages- Version packages based on changesets
Architecture
Configuration
The microfrontends configuration is defined in microfrontends.json (or .jsonc) files that live in each application. The schema is at packages/microfrontends/schema/schema.json.
Key configuration concepts:
- Applications: Named microfrontends that map to Vercel project names
- Routing: Path patterns that determine which microfrontend handles which routes
- Development: Local and fallback URLs for development
- Asset Prefix: Unique identifiers for static assets per microfrontend
- Flags: Feature flags that conditionally route requests to different microfrontends
Core Components
Config Layer (
src/config/)microfrontends-config/- Configuration parsing and validationmicrofrontends/server/- Server-side configuration utilitiesoverrides/- Routing overrideswell-known/- Well-known endpoints for client-side
Next.js Integration (
src/next/)config/-withMicrofrontends()wrapper that transforms Next.js configmiddleware/- Routing middleware for Next.js that handles path matching and zone routing when using feature flagsclient/- Client-side utilities (Link component, prefetch)testing/- Testing utilities for Next.js microfrontends
Other Framework Support (
src/)sveltekit/- SvelteKit integrationvite/- Vite integration
- CLI & Local Proxy (
src/bin/)local-proxy.ts- HTTP proxy for local development that routes requests between locally running microfrontends or falls back to productionindex.ts- CLI commands (microfrontends proxy,microfrontends port)
Mirrored files
AGENTS.md and packages/microfrontends/README.md are copies of CLAUDE.md and README.md respectively, regenerated on pnpm install via the prepare script. Do not edit them directly — changes will be overwritten. Edit the source files instead:
- To update AI agent instructions: edit
CLAUDE.md - To update the README: edit the root
README.md(copied topackages/microfrontends/README.mdonpnpm install)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

