Vercel now supports monorepos for improved flexibility at scale. From the same Git repository, you can set up multiple projects to be built and deployed in parallel.
Monorepos let your team use multiple programming languages and frameworks, collaborate better, and leverage micro frontend architectures.
The architecture of a monorepo deployed to Vercel.
To connect multiple Vercel projects with the same Git repository, create a new project for each of the directories within the Git repository:
Creating a new Vercel project for a directory within a monorepo.
Repeat this process for each app you want to set up. Your plan determines how many Vercel projects can be connected with the same Git repository:
- 3 for Hobby (Personal Accounts)
- 10 for Pro (Teams)
- Custom for Enterprise (Teams) – Contact Sales
If needed, you can even use the same Root Directory for multiple projects.
Once your monorepo is set up, push changes to your Git repository as usual and you'll see the commits deployed to the Vercel projects you've connected.
For the best performance, Deployments are built in parallel.
An example of Deployment URLs provided by a Git Integration.
Pushing a commit to your monorepo will create a Deployment for each of the connected projects.
If you want to abort the Build Step for certain projects if their files didn't change, you can now do so with the Ignored Build Step section in Git Integration page of the project settings:
Setting a command for ignoring the Build Step.
Learn more about ignoring the Build Step in the documentation.
Whether or not your Deployments are queued depends on the amount of Concurrent Builds you have available. Personal accounts are limited to 1 Concurrent Build, while teams can customize the amount on the "Billing" page in the team settings.
Learn more about how to adjust your Concurrent Builds here.
After having set up your monorepo as described above, each of the directories will be a separate Vercel project, and therefore be available on a separate domain.
If you'd like to host multiple projects under a single domain, you can create a new project, assign the domain in the project settings, and proxy requests to the other upstream projects. The proxy can be implemented using a `vercel.json` file with the rewrites property, where each `source` is the path under the main domain and each `destination` is the upstream project domain.
Pushing a commit to a Git repository that is connected with multiple Vercel projects will result in multiple Deployments being created and built in parallel for each.
To access source files outside the Root Directory (which enables Yarn & Lerna Workspaces), enable the "Include source files outside of the Root Directory in the Build Step" option in the Root Directory section within the project settings.
Vercel projects created after August 27th 2020 23:50 UTC have this option enabled by default.
If you're using Vercel CLI, at least version 20.1.0 is required.
Because Vercel CLI only allows for linking a single Vercel project, you currently need to clone your Git repository multiple times (once per directory you want to deploy or develop) and then link a project for each.
Use Vercel CLI 20.1.0 or later to ensure you can take advantage of the option for accessing source files outside the Root Directory (mentioned in a section above).
We will continue to expand our monorepo support with more options and capabilities. Let us know your feedback and what you'd like to see next.