Engineering notes — ExplainersUsing Vercel Flags SDK without FLAGS_SECRET
How to migrate to Vercel Flags SDK 4.5.0 on Vercel without FLAGS_SECRET, clean up env vars, and handle precompute safely in multi-repo setups.
Vercel’s latest Flags SDK release, flags@4.5.0, removes the need for FLAGS_SECRET for projects deployed on Vercel when you’re using Flags Explorer and precompute. You can now rely on Vercel-managed signing and encryption instead of keeping a shared secret in sync across repos.
This post walks through how that works, what actually changes in your config, how precompute behaves with and without a secret, and a step-by-step migration you can do in under an hour without breaking existing flags. If you care about keeping your Vercel setup predictable, you might also find my write-up on usage-based Standard builds billing useful.
What changed in flags@4.5.0
From Vercel’s changelog:
"With flags@4.5.0, projects on Vercel can use Flags Explorer and precompute without FLAGS_SECRET. That cuts out a setup step for new projects and removes the need to keep a shared secret in sync across microfrontends."
The important parts:
New projects on Vercel don’t need
FLAGS_SECRETfor:- Flags Explorer
- Precompute
Vercel now handles trust for you:
- Vercel signs Flags Explorer discovery requests and overrides.
- The Flags SDK encrypts flag values shown in the Vercel Toolbar with Vercel’s public key.
Existing projects keep their current behavior:
- If
FLAGS_SECRETis set as an environment variable, or you pass a secret in code, the project continues using that secret. - Upgrading to
flags@4.5.0alone does not change how your flags work.
- If
To move an existing project to Vercel-managed keys you have to remove the environment variable and any explicit secret in code.
If your app runs on Vercel, this means one less piece of config to manage and one less shared secret to keep in sync across microfrontends.
How Vercel Flags works without FLAGS_SECRET
Vercel outlines two core mechanisms in the announcement: signed requests and encrypted toolbar values. Here is how they fit together in practice.
- Flags Explorer discovery and overrides are signed by Vercel
When your app uses Flags Explorer on Vercel, the discovery calls and any override actions used for debugging are now signed by Vercel itself instead of by your own FLAGS_SECRET.
Conceptually, you can think of it like this:
[Flags Explorer] -> signed request -> [Your app on Vercel]Before flags@4.5.0 you had to prove that these requests were legitimate using a shared secret. Now Vercel plays that role by signing requests at the platform level.
- Toolbar values are encrypted with Vercel’s public key
Vercel writes:
"Vercel signs Flags Explorer discovery requests and overrides, and the SDK encrypts flag values shown in the Vercel Toolbar with Vercel’s public key."
The Flags SDK now uses Vercel’s public key to encrypt the values it shows in the Vercel Toolbar. That replaces the need for your own shared secret when debugging feature flags from the toolbar.
- Existing projects stay on secrets until you remove them
The SDK doesn’t auto-migrate existing deployments. It checks whether:
FLAGS_SECRETis present as an environment variable, or- you pass a secret directly in code.
If either is true, it keeps using the secret-based behavior you already have. It only switches to the Vercel-managed keys once the secret is removed from both env vars and code.
For local development, Vercel recommends:
- "For local development, run
vercel env pull."
That keeps your local environment in sync with whatever you’ve configured in the Vercel dashboard.
Before vs after: env and config cleanup
There is no breaking change as long as you don’t touch your secrets. The migration is you choosing to remove the secret, not the SDK changing under you.
Here is an illustrative example of how your environment variables might look before and after.
Before (secret-based setup)
# .env / Vercel project env
FLAGS_SECRET=<shared-flags-secret>
FLAGS_PRECOMPUTE_SECRET=<optional-precompute-secret>In this model:
FLAGS_SECRETis used for Flags Explorer and toolbar-related behavior.FLAGS_PRECOMPUTE_SECRETis only needed if you chose to separate the secret for precompute.
After (Vercel-managed keys on Vercel)
Once you’re on flags@4.5.0 and remove your secret, your env can look like this:
# .env / Vercel project env
# FLAGS_SECRET removed
# FLAGS_PRECOMPUTE_SECRET optional, only if you need cross-deployment precomputeYou don’t add a replacement variable. The SDK automatically falls back to Vercel-managed keys when no secret is present.
If you still need precompute to work across deployments or builds, you can keep just FLAGS_PRECOMPUTE_SECRET and leave FLAGS_SECRET undefined. Vercel explains:
"Prebuilt deployments and codes that must work across deployments still need a secret; use FLAGS_PRECOMPUTE_SECRET if only precompute needs one."
That gives you a tighter scope, especially in multi-repo setups.
How precompute works now (and when you still need a secret)
Precompute is the one area where behavior changes depending on whether you use a secret.
Vercel gives three clear rules in the announcement.
- Precompute without a secret is deployment-bound
"Precomputed codes created without a secret work only in the deployment that created them."
If you don’t configure any secret, the codes you precompute are tied to the deployment that produced them. That is good for safety and avoids cross-deployment leakage, but it means you can’t expect a code created on one deployment to function in another.
- Precompute without a secret needs Vercel system env vars
"Precompute without a secret requires Vercel system environment variables, which are enabled by default."
On Vercel, system environment variables are already on by default, so for most projects there’s nothing to change. If those were disabled intentionally, precompute without a secret won’t work until they’re re-enabled.
- Cross-deployment or prebuilt flows still need a secret
"Prebuilt deployments and codes that must work across deployments still need a secret; use FLAGS_PRECOMPUTE_SECRET if only precompute needs one. If you use a build cache, see the precompute documentation for the required configuration."
Two implications:
- If you generate precomputed codes in a prebuild step, or they must work across deployments, you keep using a secret.
- You can tighten scope using
FLAGS_PRECOMPUTE_SECRETwhile droppingFLAGS_SECRETfor Explorer and toolbar.
The build cache detail is only mentioned at a high level in the changelog, so I’d read the precompute documentation before changing secrets in any project with non-trivial caching to avoid stale or invalid codes.
Step-by-step migration for a multi-repo or microfrontend setup
For a multi-repo or microfrontend setup on Vercel, the main benefit is dropping the shared secret you previously had to keep in sync.
Here is a concrete migration path you can use as a checklist.
1. Upgrade to flags@4.5.0
Upgrade your Flags SDK in each repo that uses it.
# example
npm install flags@4.5.0Use whatever package manager you already use. The key is that every microfrontend that relies on Vercel Flags should be on the same major behavior.
If you are also moving other platform integrations forward, my walkthrough of a Vercel Drives migration shows the same pattern of incremental, tested changes.
2. Confirm you’re actually on Vercel for the affected projects
The new behavior applies to projects on Vercel. If any part of your system runs outside Vercel, treat that part as still needing the old secret contract unless your own setup says otherwise.
3. Identify where FLAGS_SECRET is set
In each repo and Vercel project:
- Open the Vercel dashboard.
- Go to the project.
- Open Settings → Environment Variables.
- Look for
FLAGS_SECRET.
Also search the codebase for FLAGS_SECRET or any explicit secret passed to the Flags SDK. For example:
// Illustrative example, adjust to your actual API
const flagsClient = createFlagsClient({
// Remove this when migrating
secret: process.env.FLAGS_SECRET,
});If you see anything like this, you’ll need to remove it as part of the switch.
4. Decide your precompute strategy per project
For each Vercel project using Flags precompute, choose one of two modes:
Deployment-bound precompute without secrets
- You accept that precomputed codes only work in the deployment that created them.
- You’re not relying on prebuilt deployments or cross-deployment codes.
- You’ll rely on Vercel system environment variables instead of a secret.
Cross-deployment or prebuilt precompute with a secret
- You keep or introduce
FLAGS_PRECOMPUTE_SECRET. - You can remove
FLAGS_SECRETto reduce surface area if you only need the secret for precompute.
- You keep or introduce
This is where the microfrontend simplification happens. Instead of one shared FLAGS_SECRET copied to every repo, each project holds just the configuration it needs.
5. Remove FLAGS_SECRET from Vercel and code
For every project where you want to use Vercel-managed keys:
- In the Vercel dashboard, delete the
FLAGS_SECRETenvironment variable from all environments (Production, Preview, Development) where it’s set. - In your code, remove any explicit
secretparameters you pass into the Flags SDK.
Your flags behavior will now switch to:
- Vercel signing Flags Explorer discovery and overrides.
- SDK encrypting toolbar values with Vercel’s public key.
Existing flags and evaluations continue to work because the semantics of the flags themselves are not changed by this step.
6. Update local development with vercel env pull
Vercel recommends updating local environments using the CLI:
vercel env pullThat pulls your Vercel project’s environment variables into a local file, so your local .env matches whatever you configured after removing FLAGS_SECRET and adjusting any FLAGS_PRECOMPUTE_SECRET usage.
If you have multiple repos, run this once per Vercel project from the root of each repo that maps to that project.
7. Smoke test Flags Explorer and precompute
Once secrets are cleaned up:
- Use Flags Explorer on a new deployment and verify that discovery and overrides work.
- If you use precompute without a secret, check that the codes work in the deployment that created them.
- If you use
FLAGS_PRECOMPUTE_SECRET, test your prebuilt or cross-deployment flows.
This can usually fit into a single release cycle, especially if you stage the change per project.
When I wouldn’t remove FLAGS_SECRET yet
There are a few situations where I’d pause before removing your existing secret-based setup.
- You rely heavily on prebuilt deployments and cross-deployment precompute codes. Vercel is explicit that these still need a secret. This doesn’t stop you from dropping
FLAGS_SECRET, but you should be clear on howFLAGS_PRECOMPUTE_SECRETis configured. - You have a complex build cache strategy. Vercel says that if you use a build cache, you should check the precompute documentation for the required configuration. I’d line that up before touching secrets.
- Part of your feature flag usage runs outside Vercel. The
flags@4.5.0change is specifically about projects on Vercel. If you’re running the same code elsewhere, you’ll need a plan for that environment.
If any of those apply, cleanly separating FLAGS_PRECOMPUTE_SECRET and FLAGS_SECRET may be a better first step than removing secrets entirely.
What this simplifies for small teams
For a typical Vercel app, this change removes one secret, one sync problem and one class of misconfigurations. You no longer need to pass a secret into the Flags SDK just to use Flags Explorer or the Vercel Toolbar, and multi-repo setups don’t have to keep a shared FLAGS_SECRET in sync.
The main piece to think about is precompute. Decide whether your codes must work across deployments or prebuilds and configure FLAGS_PRECOMPUTE_SECRET only where that’s true. Then remove FLAGS_SECRET, pull envs locally with vercel env pull, and you’re done.
If you want a second set of eyes on a Vercel migration like this, especially in a Next.js codebase with multiple environments, I take on that kind of work as a Next.js developer.