# Sync projects with @vercel/related-projects

By Steven Van · 2025-02-20

Related Projects links up to three projects in one repository, so preview frontends call matching preview backends without hardcoded URLs.

Separate [Vercel](<https://creatorstoolbox.com/tools/vercel>) projects can now find each other's deployment URLs automatically. The new @vercel/related-projects package, [documented under monorepos](<https://vercel.com/docs/monorepos#how-to-link-projects-together-in-a-monorepo>), keeps that data current at both build and runtime. Before this, developers entered deployment URLs by hand, managed connection strings, or used environment variables.

The vendor's example is a monorepo with a Next.js frontend that fetches from an Express.js API. Each preview deployment of the frontend references the matching preview deployment of the backend, so changes that span both projects can be tested without hardcoded values.

Setup works like this:

- List the related project IDs in a vercel.json at the root of the app. The ID is on the project Settings page in the dashboard.

- The next deployment gets a VERCEL\_RELATED\_PROJECTS environment variable holding the related projects' URLs. With Turborepo Strict Mode, add that variable to turbo.json.

- In code, withRelatedProject returns a related project's host, with an optional defaultHost as a fallback if the data is missing. relatedProjects() returns the typed project data.

There are limits. An app can link **up to 3** projects, they must be in the same repository, and CLI deployments are not supported.

![Vercel](<https://www.google.com/s2/favicons?domain=vercel.com&sz=128>)

Vercel

The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.

[View Vercel →](<https://creatorstoolbox.com/tools/vercel>)

[Original source](<https://vercel.com/docs/monorepos#how-to-link-projects-together-in-a-monorepo>)

[Read Sync projects with @vercel/related-projects on Creators Toolbox](<https://creatorstoolbox.com/blog/vercel-sync-projects-with-vercel-related-projects>)

---
Canonical source: https://creatorstoolbox.com/blog/vercel-sync-projects-with-vercel-related-projects
