DEV Community

Cover image for Zero-Cost Feature Flags Using Vercel Edge Config (No SaaS Needed)
HexShift
HexShift

Posted on

1

Zero-Cost Feature Flags Using Vercel Edge Config (No SaaS Needed)

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:
    • new_dashboard_enabled: true
    • beta_user_access: ["user1@example.com", "user2@example.com"]

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 (
    <div>
      {dashboardEnabled ? (
        <NewDashboard />
      ) : (
        <OldDashboard />
      )}
    </div>
  );
}

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": {
    "user1@example.com": ["new_dashboard", "beta_profile"],
    "user2@example.com": ["new_dashboard"]
  }
}
Enter fullscreen mode Exit fullscreen mode

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

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

ACI image

ACI.dev: Best Open-Source Composio Alternative (AI Agent Tooling)

100% open-source tool-use platform (backend, dev portal, integration library, SDK/MCP) that connects your AI agents to 600+ tools with multi-tenant auth, granular permissions, and access through direct function calling or a unified MCP server.

Star our GitHub!

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay