-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: microfrontends #10982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
anthonyshew
wants to merge
111
commits into
main
Choose a base branch
from
shew/f7e3b
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: microfrontends #10982
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: docs
Improvements or additions to documentation
area: examples
Improvements or additions to examples
area: site
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Turborepo now natively supports microfrontends development, allowing you to run multiple frontend applications simultaneously with automatic routing between them. By adding a microfrontends.json configuration file to your workspace, you can define which applications handle specific URL paths (like /docs, /blog, or /dashboard) and Turborepo will automatically start a local proxy that routes requests to the correct development server.
The proxy handles both HTTP requests and WebSocket connections, ensuring features like hot module replacement work seamlessly. You can work entirely offline with Turborepo's built-in proxy, or integrate with @vercel/microfrontends when you're ready to deploy to production—using the same configuration file for both environments.
Sub-features include:
@vercel/microfrontends
Why
Modern web applications increasingly adopt microfrontends architectures where multiple independent applications compose a single user experience. Developing these locally requires a proxy server to route requests to appropriate development servers based on URL patterns.
Without native Turborepo support, teams face challenges manually managing multiple servers, configuring separate proxies, and ensuring WebSocket connections work for hot module replacement. This feature eliminates these pain points with first-class support that works standalone or integrates with @vercel/microfrontends for production deployments.
How
The implementation uses a trie-based router supporting exact matches, parameterized segments, and wildcards for efficient route matching. Built on Hyper, the proxy forwards HTTP requests with proper headers and handles WebSocket connections bidirectionally with graceful shutdown support (max 1000 concurrent connections).
During task graph construction, Turborepo scans for configuration files and automatically starts the proxy before executing development tasks. Smart mode detection determines whether to use Turborepo's built-in proxy or defer to Vercel's implementation when @vercel/microfrontends is present, enabling offline development while maintaining production compatibility.
Testing Instructions
There are many tests added as a part of this PR. Additionally, this has been hand-tested using:
create-turbo
with modifications that use a microfrontends configuration@vercel/microfrontends
package@vercel/micrfrontends
packageFuture work
We would be delighted to have more providers work with us on implementations that integrate with their production systems! Please reach out if you are an infrastructure provider and are interested!