By default, a Vercel project evaluates only the Vercel Flags owned by that project. To evaluate flags from another project, add an SDK Key from the source project to the consumer project and connect your SDK client to that key.
Cross-project flag evaluation is useful for microfrontend architectures, shared services, or feature flags that control behavior across multiple Vercel projects.
Before you start, make sure you have:
- Two or more Vercel projects
- Feature flags created in the source project
- The Flags SDK, OpenFeature SDK, or
@vercel/flags-coreinstalled in the consumer project
Cross-project flag evaluation uses a source project and a consumer project.
- Source project: The Vercel project where the feature flags are defined and managed. For example, Project A.
- Consumer project: The Vercel project that needs to evaluate flags from the source project. For example, Project B.
- SDK Key: A secret, environment-scoped key that grants read-only access to one project's flag configuration.
SDK Keys are scoped to a single project and environment. A Production SDK Key reads the Production flag configuration, a Preview SDK Key reads the Preview flag configuration, and a Development SDK Key reads the Development flag configuration.
SDK Keys are secrets. Each SDK Key grants read-only access to the full flag configuration for its environment, including data used in targeting rules, such as email addresses. Never expose SDK Keys in client-side code or commit them to version control.
- Navigate to the source project (Project A) in the Vercel Dashboard.
- Open Flags in the sidebar.
- Select SDK Keys.
- Click Create SDK Key.
Create one SDK Key for each environment the consumer project needs to evaluate.
For example:
- Create a Development SDK Key for local or development usage.
- Create a Preview SDK Key for preview deployments.
- Create a Production SDK Key for production deployments.
Label each key with the consumer project's name and environment.
For example, use labels such as
Project B - ProductionorProject B - Preview. Labels help you identify which consumers depend on each key.
- Navigate to the consumer project (Project B) in the Vercel Dashboard.
- Go to Settings > Environment Variables.
Create an environment variable for the source project's SDK Key.
For example, create
PROJECT_A_FLAGS_KEY.Set the value for each environment to the matching SDK Key from the source project.
For example:
- Set the Development value to Project A's Development SDK Key.
- Set the Preview value to Project A's Preview SDK Key.
- Set the Production value to Project A's Production SDK Key.
- Redeploy the consumer project if you added or changed the environment variable for an existing deployment.
In the consumer project, create an adapter or client that reads from the new environment variable instead of the default FLAGS variable.
The default FLAGS variable points to the current project. A custom SDK Key points to the source project.
Use createVercelAdapter from @flags-sdk/vercel to connect a flag to the source project's SDK Key.
In this example, sharedFlag is defined in Project A and evaluated from Project B.
Pass the source project's SDK Key to VercelProvider.
Pass the source project's SDK Key to createClient.
A consumer project can evaluate its own flags and source-project flags in the same codebase.
Use vercelAdapter() for flags owned by the current project. Use createVercelAdapter() with the source project's SDK Key for cross-project flags.
In this example, ownFlag reads from the current project's FLAGS environment variable. sharedFlag reads from PROJECT_A_FLAGS_KEY, which points to Project A.
The consumer project might be missing the SDK Key, using the wrong environment value, or evaluating a flag key that does not exist in the source project.
Check that:
- The environment variable is set in the consumer project.
- Each Vercel environment uses the matching SDK Key from the source project.
- The flag key in code matches the flag key in the source project.
- The deployment was redeployed after adding or changing the environment variable.
The SDK Key might be invalid, deleted, or rotated.
Confirm that the key stored in the consumer project's environment variable matches an active SDK Key in the source project's SDK Keys page. If the key was rotated, update the environment variable and redeploy the consumer project.
The consumer project might be reading from a different project or environment than expected.
Check that the consumer project's environment variable points to the correct source project SDK Key for the current Vercel environment. If you changed the SDK Key environment variable, redeploy the consumer project so the deployment receives the new value.
Treat cross-project SDK Keys the same way you treat other production secrets.
- Store SDK Keys as environment variables.
- Never expose SDK Keys in client-side code.
- Never commit SDK Keys to version control.
- Create separate SDK Keys for each consumer project.
- Label SDK Keys with the consumer project and environment.
- Rotate a key if it is exposed or no longer needed.
If a key is exposed, follow the SDK Key rotation process:
- Create a new key
- Update the consumer project's environment variable
- Redeploy the consumer project
- Delete the old key.