Rolling Out a New Feature
This workflow creates a feature flag, wires it into your application, and progressively enables it across environments.
vercel flags add redesigned-checkout --kind boolean \
--description "New checkout flow with streamlined steps"Creating a boolean flag to gate the new checkout experience.
Each project gets SDK keys automatically when you create your first flag. Confirm they're in place:
vercel flags sdk-keys lsThe FLAGS environment variable contains your SDK keys. Pull it into your local .env.local:
vercel env pullpnpm add flags @flags-sdk/vercelCreate a flag definition using the Flags SDK. The vercelAdapter reads the FLAGS environment variable automatically:
import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const redesignedCheckout = flag({
key: 'redesigned-checkout',
adapter: vercelAdapter(),
});The flag returns false until you enable it in the dashboard.
import { redesignedCheckout } from '../../flags';
export default async function CheckoutPage() {
const showRedesign = await redesignedCheckout();
return showRedesign ? <NewCheckout /> : <OldCheckout />;
}vercel deployVisit the preview URL to confirm the old checkout renders. The flag defaults to false since it hasn't been enabled yet.
Enable the flag progressively, starting with development:
vercel flags enable redesigned-checkout --environment developmentvercel flags enable redesigned-checkout --environment previewvercel flags enable redesigned-checkout --environment productionvercel deploy --prodVisit the production URL to confirm the new checkout is live.
Was this helpful?