@vercel/edge-config
Read global configuration at sub-millisecond speed — no database round-trips for critical runtime data.
@vercel/edge-config
Node.jsRead global configuration at sub-millisecond speed — no database round-trips for critical runtime data.
Fit
Bundle (gzip)
3.4 kB
10.4 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Some data needs to be read on every request but changes rarely — feature flags, kill switches, maintenance mode toggles, allowed IP lists, A/B test configs. The typical approach is to:
- Store it in a database and add latency to every request
- Hard-code it in environment variables and redeploy every change
- Use Redis/Upstash which still adds a network round-trip
None of these are ideal when you need a change to take effect globally in under a second with near-zero read latency.
What It Does
Edge Config is a global, ultra-low-latency key-value data store. Reads happen in under 1ms because the data is stored at the edge — co-located with your serverless functions and edge middleware. Updates propagate globally in seconds. It's designed specifically for configuration data that's read often but written rarely.
Installation
npm install @vercel/edge-configUsage Example
Read a value
import { get } from "@vercel/edge-config";
export async function middleware(request: NextRequest) {
const isMaintenanceMode = await get("maintenance_mode");
if (isMaintenanceMode) {
return NextResponse.rewrite(new URL("/maintenance", request.url));
}
return NextResponse.next();
}Feature flag check in a route handler
import { get } from "@vercel/edge-config";
export async function GET() {
const newCheckoutEnabled = await get<boolean>("new_checkout");
return Response.json({ feature: newCheckoutEnabled ?? false });
}Read multiple values at once
import { getAll } from "@vercel/edge-config";
const config = await getAll(["feature_x", "feature_y", "rate_limit"]);
// { feature_x: true, feature_y: false, rate_limit: 100 }Check if a key exists
import { has } from "@vercel/edge-config";
const exists = await has("beta_users_list");Related packages
Role and attribute based access control (RBAC + ABAC) for Node.js with a fluent, readable API.
bcryptjsNode.jsPure JavaScript bcrypt password hashing — no native dependencies, same API as bcrypt, works anywhere Node.js runs.
bullmqNode.jsPremium message queue and job scheduler for Node.js backed by Redis — reliable background job processing with retries, priorities, and rate limiting.
casbinNode.jsA powerful authorization library that supports RBAC, ABAC, ACL and more via configurable policy models.
dotenvNode.jsLoad environment variables from a `.env` file into `process.env` — the standard way to manage configuration in Node.js apps.