Feature flags usually mean spinning up LaunchDarkly, Split.io, or building your own toggle system — which quickly gets complicated and expensive.

But if you're on Vercel, you can use their Edge Config product to implement feature flags for free, with instant global reads at the edge.

Here’s how to build it.


Step 1: Set Up Vercel Edge Config

First, in the Vercel dashboard:

  • Go to Storage → Edge Config → Create Config
  • Name it something like feature-flags
  • Add a simple key/value pair:

Edge Config acts like a super-fast, globally distributed key/value store.


Step 2: Install the Edge Config SDK

In your Next.js app (or any frontend served via Vercel), install:

npm install @vercel/edge-config

Then pull flags easily:

import { get } from "@vercel/edge-config";

export async function isNewDashboardEnabled() {
  const flag = await get("new_dashboard_enabled");
  return flag === true;
}

Because Edge Config is replicated worldwide, reads are sub-millisecond from almost anywhere.


Step 3: Conditional Feature Loads in Your App

Now you can lazy-load features based on flags:

import { isNewDashboardEnabled } from "./featureFlags";

export default async function Page() {
  const dashboardEnabled = await isNewDashboardEnabled();

  return (
    
{dashboardEnabled ? ( ) : ( )}
); }

This works perfectly in Next.js Server Components and Edge Functions.


Step 4: Per-User Feature Flags (Bonus)

Want flags per user or cohort?

Add user-specific settings:

{
  "feature_flags": {
    "[email protected]": ["new_dashboard", "beta_profile"],
    "[email protected]": ["new_dashboard"]
  }
}

Then in code:

export async function hasFeature(userEmail, feature) {
  const flags = await get(\`feature_flags.\${userEmail}\`);
  return flags?.includes(feature);
}

This gives you SaaS-level segmentation — instantly.


Pros:

  • 🔥 Instant global reads (edge-optimized)
  • 🆓 Free — included in Vercel's generous Edge Config limits
  • ✨ No cold starts, no extra infrastructure
  • 🚀 Works seamlessly with SSR, Edge Middleware, and Server Components

⚠️ Cons:

  • Hardcoded keys; no built-in targeting rules like LaunchDarkly
  • Manual management unless you build an admin UI
  • Only works inside the Vercel ecosystem (not portable to non-Vercel hosts)

Summary

With Vercel Edge Config, you can create powerful feature flag systems without a SaaS subscription, cold start latency, or even a database.

It’s perfect for startups, indie devs, or internal apps that need instant rollouts, staged launches, or A/B testing — with global reads and zero complexity. If you're already on Vercel, you're just leaving free power on the table.


If this was helpful, you can support me here: Buy Me a Coffee