Tags: web-dev experimentation platform
Vercel
Checked: 2026-10-29
A hosting platform where every push becomes an immutable, addressable deployment and “going live” means pointing a domain at one. Your framework’s build output is translated into Vercel’s own primitives — static files, functions, routes, caches — so the infrastructure is whatever your code implies, not something you configure.
§0 The one idea
A deployment is a frozen artefact; a domain is a pointer to one.
Nothing is ever deployed onto anything. Each push produces a new, complete, never-modified copy of the site with its own URL. Production is just the deployment that the production domain currently points at. Release, rollback and staging are all the same operation — moving the pointer.
vs a VPS or long-running server: there you have one box, one /var/www, one process. Deploying overwrites files and restarts the process in place, so “the site” is whatever is on the box right now, and rolling back means rebuilding the old version. There’s also a server you can SSH (secure shell) into, run cron on, hold a WebSocket open on, keep state in memory on.
VPS / LONG-RUNNING SERVER VERCEL
git pull → build → restart git push → build → dpl_A (frozen)
one box, mutated in place git push → build → dpl_B (frozen)
git push → build → dpl_C (frozen)
example.com ──► the box
example.com ──► dpl_C
rollback = rebuild old commit rollback = example.com ──► dpl_B
staging = a second box staging = any dpl_ with its own URL
state = in memory, on disk state = somewhere else, always
The second half of the idea: you don’t describe infrastructure, your framework does. Vercel calls it framework-defined infrastructure — a Next.js page with revalidate becomes a cached prerender function; a route handler becomes a function; next.config.js redirects become routes on the CDN (content delivery network). There’s no server to provision because there’s no server in the model at all.
At a glance
| Unit of release | The deployment — immutable, ID dpl_…, own URL |
| Going live | Aliasing production domains to a deployment. No rebuild |
| Rollback | Instant — re-point the alias. Turns off auto-promotion until undone |
| Previews | Every push to a non-production branch, every PR (pull request) |
| Compute | Vercel Functions on Fluid compute. Node.js by default |
| Edge runtime | Still exists, Vercel now recommends migrating off it |
| Default function region | iad1 (Washington DC). London is lhr1 — set it |
| Middleware | Routing Middleware — runs before the cache, on every matched request |
| Caches | CDN cache · ISR (Incremental Static Regeneration) cache · Runtime Cache. Three layers, three invalidation rules |
| Runtime config | Global Config — renamed from Edge Config. 1 MB, writes propagate ≤10 s |
| Flags | Flags SDK (software development kit, open source) + Vercel Flags (first-party provider) |
| Env vars | Per environment. Only apply to new deployments |
| Config file | vercel.json (or vercel.ts); framework config wins where it overlaps |
| Billing | Seats + metered usage across ~a dozen axes. See Pricing |
Naming churn worth knowing, because old articles use the old words:
| Old name | Current name |
|---|---|
| Serverless Functions / Edge Functions | Vercel Functions, with a Node.js, Python, Bun… or Edge runtime |
| Edge Middleware | Routing Middleware |
| Edge Config | Global Config (@vercel/global-config) |
| Data Cache | Still exists for Next.js fetch; general version is Runtime Cache |
| Edge Requests | CDN Requests (billing line) |
middleware.ts (Next.js) | proxy.ts from Next.js 16 |
The Platforms MOC gloss “edge functions” is the old vocabulary: the platform has moved its compute story to regional functions with Fluid compute, and the edge is now mostly where the CDN and middleware live — Edge Computing.
The entity model
Team (scope — billing, members, roles)
├─ Project ← one repo, or one app in a monorepo
│ ├─ Environments
│ │ Production · Preview · Development · custom (staging, qa…)
│ ├─ Environment variables (scoped per environment / branch)
│ ├─ Domains ──► assigned to Production, an environment, or a branch
│ ├─ Settings — framework, build command, region, protection
│ └─ Deployment dpl_abc123 (immutable)
│ ├─ static files
│ ├─ functions (+ their region, memory, duration)
│ ├─ routes (redirects · rewrites · headers)
│ ├─ prerenders (ISR) + their own ISR cache
│ └─ generated URLs + aliases
├─ Global Config stores ─┐
├─ Blob stores ├─ team-level, connected to projects
└─ Marketplace resources ─┘ (Neon, Upstash, Supabase…)
Things that catch people:
- Env vars live on the project, but are baked into each deployment at build. Change one, and nothing running changes until you redeploy
- Domains belong to the project, aliases belong to deployments. Moving an alias is the whole release mechanism
- A deployment carries its own ISR cache. A new deployment starts cold — see Caching
- Stores are team-level and shared. One Global Config can feed several projects — the shape for one flag config across storefront and marketing site
The deployment model
The pipeline
git push (branch: feature/pdp-gallery)
│
├─ Vercel detects framework → install → build
│ ↓
│ framework emits .vercel/output/ ← Build Output API
│ ↓
│ upload → deployment dpl_7f3k… (immutable from here)
│ ↓
├─ URLs generated
│ commit: shop-7f3k2m9xq-acme.vercel.app ← this exact build
│ branch: shop-git-feature-pdp-gallery-acme.vercel.app
│ ← latest on branch
│
└─ production branch?
no → it's a Preview. Done. PR gets a comment with links
yes → auto-assign production domains?
yes → example.com ──► dpl_7f3k ("Current")
no → "Staged". Waits for a manual promote
- Production branch is usually
main. Anything else, any PR, orvercelwithout--prodfrom the CLI (command-line interface), makes a Preview - Build Output API — API (application programming interface) here means a directory format the build must produce, not a web endpoint. See Framework-defined infrastructure
- The first deployment of a new project is always Production, whatever branch it came from — and it builds with Production env vars
- Build limit: 45 minutes per build. Routes created per deployment: 2,048 (each
vercel.jsonrewrite, redirect or header counts, and frameworks generate their own)
Three ways to change what production serves
| Rebuild? | Env vars used | When | |
|---|---|---|---|
| Promote a staged production build | No | Production (already baked) | Release gate: verify on the generated URL, then promote |
| Promote a Preview to production | Yes | Switches to Production vars | Shipping from a non-production branch |
| Instant Rollback | No | Whatever that old build had | Incident. Pro/Enterprise: any deployment that was ever production. Hobby: the previous one only |
The rollback quirk: after an Instant Rollback, Vercel turns off auto-assignment of production domains. Merges to main keep building but don’t go live until someone undoes the rollback (promote any deployment, or vercel promote). Easy to forget mid-incident, then wonder why the fix isn’t live — Rollback and Forward Fix.
Rollback doesn’t roll back the world. The old build has the old code and the old env vars, but talks to today’s database and today’s APIs — Database Migrations.
Rolling Releases
Gradual promotion: a new production deployment gets a fraction of traffic (say 5%), the previous one keeps the rest, then stages step up to 100% — Progressive Delivery, Blue-Green and Rolling Deployments.
- Pro: one project. Enterprise: custom
- Assignment: a random bucket per client, stored in a
_vcrr_<hash>cookie, seeded from client-identifying data including IP so the same device lands the same way even in a private window - Forcing a side:
?vcrrForceCanary=true/?vcrrForceStable=true. Anyone can do this — a 0% canary is not hidden, just unadvertised - Comparison: the Observability tab shows Vercel’s own metrics (Speed Insights among them) split base vs canary. To compare in your own tools, propagate the deployment ID into them
- Needs Skew Protection, or users served the canary page can hit the base deployment’s API
It’s a release mechanism, not an A/B test. Assignment is real, random and sticky, so it can be read as an experiment on the release — Rollouts as Experiments — but the split is between whole deployments, nothing logs exposure to your analytics, and the stages move users across arms mid-flight. Use it to catch regressions, not to measure a feature’s effect.
Skew Protection
Version skew is the client and server running different deployments: the browser loaded dpl_B’s JavaScript, dpl_C went live, and the next client-side fetch hits dpl_C’s server, which expects a different payload.
Vercel’s fix exploits the immutable-deployment model: the old deployment still exists, so route the old client back to it.
browser loaded page from dpl_B
│
├─ GET /_next/static/chunk.js?dpl=dpl_B → served by dpl_B
├─ POST server action x-deployment-id: dpl_B → served by dpl_B
│
└─ full page navigation (no pin) → current: dpl_C
client sees mismatch,
hard reloads
- Pro and Enterprise. On by default for projects created after November 2024 on supported frameworks (Next.js, SvelteKit, Nuxt, Astro, Qwik)
- Max age defaults to one day, configurable up to the deployment retention limit. Googlebot and Bingbot get 60 days automatically, to cover the gap between crawl and render
- Your own
fetch()calls aren’t pinned — only framework-managed requests. Pin manually with thedplquery parameter orx-deployment-idheader __vdplcookie pins full navigations too — for long checkouts or multi-step forms where a mid-flow reload loses state
The request lifecycle
What happens to GET https://example.com/products/blue-hoodie. DDoS is distributed denial of service; the WAF is the web application firewall, Vercel’s configurable rules layer:
browser
│ anycast → nearest PoP (point of presence)
↓
FIREWALL
├─ DDoS mitigation platform-wide, all plans
├─ WAF IP blocking
├─ WAF custom rules yours, ordered
└─ WAF managed rulesets
↓
DE-ALIAS example.com → dpl_C request now carries deployment context
↓
ROUTING
├─ static routes: redirects · rewrites · headers (vercel.json / framework)
└─ Routing Middleware (if matcher hits)
can redirect, rewrite, set headers, return early
↓
CDN CACHE (this region)
├─ HIT → serve. Done. No function ran
└─ MISS ↓
ISR CACHE (durable, in the function region — prerendered routes only)
├─ HIT → serve, replicate back to CDN
└─ MISS ↓ concurrent misses collapsed into one invocation
FUNCTION (default iad1)
├─ Runtime Cache / Data Cache regional, survives deploys
├─ your database / APIs
└─ response → ISR cache / CDN cache per its headers
What to notice:
- Middleware sits in front of the cache. It runs on every request its matcher covers, including cache hits. That’s what makes it able to personalise static pages — and why an unscoped matcher puts compute on every image and font request
- The function is in one region by default, and it’s Washington. For a UK shop with a database in
eu-west-2, every cache miss crosses the Atlantic twice unless you set the region tolhr1— Time to First Byte - The ISR cache is in the function region, not at the edge. A CDN miss in Sydney for a page last cached in London fetches from London, not from the origin
- Exact ordering of static rewrites versus middleware is framework-dependent (Next.js has its own documented sequence) — [CHECK: Vercel-level ordering of vercel.json routes relative to Routing Middleware for non-Next.js projects]
Functions
Fluid compute
Fluid compute is the execution model behind Vercel Functions, on by default for new projects since April 2025. It’s Vercel’s answer to the classic serverless trade-off.
CLASSIC SERVERLESS (one request per instance)
req1 ──► [instance A ██░░░░░░░░██] ░ = waiting on DB / API
req2 ──► [instance B ██░░░░░░░░██] each wait is a whole instance
req3 ──► [instance C ██░░░░░░░░██] idle, billed, and each one
a potential cold start
FLUID (concurrency inside an instance)
req1 ──► [instance A ██░░░░░░░░██
req2 ──► ·██░░░░░░░░██
req3 ──► ··██░░░░░░░░██] one instance, waits overlap
- Optimised concurrency — multiple invocations share one instance (Node.js and Python). An I/O-bound (input/output — mostly waiting) function — calling a payment API, a CMS (content management system), a model — stops paying for idle instances
- Consequence for code: module-level state is now shared between concurrent requests. A global variable that was “per request” on classic serverless is now a Race Conditions waiting to happen
- Unhandled errors don’t kill sibling requests; the process finishes in-flight work before stopping
- Bytecode caching (Node.js 20+, production only) and pre-warming reduce Cold Starts
waitUntil— keep working after the response is sent: logging, analytics, cache warming
Active CPU billing: you pay CPU only while code is executing, not while it’s awaiting I/O. Provisioned memory is still billed for wall-clock time the instance is alive. So a function that waits 3 s on a slow API costs memory-time, not CPU-time.
Runtimes
- Node.js — default, full Node API, the recommended choice
- Python, Bun, Go, Rust, Ruby — first-class or community, varies [CHECK: which runtimes are GA vs beta]
- Edge runtime — V8 isolates, Web APIs only, no filesystem, no
eval, small bundle limit. Vercel’s docs now say to migrate from Edge to Node.js, and Next.js listsruntime = 'edge'as deprecated (still accepted with a warning; unsupported with Cache Components on) — Reference - Next.js. Both run on Fluid compute with Active CPU pricing anyway, so the old reason to choose Edge (cheap, global, no cold start) has mostly gone
What a function looks like
The current recommended signature is a Web-standard fetch handler — the same shape as a Cloudflare Worker.
// api/stock.js — becomes a function at /api/stock
import { waitUntil } from '@vercel/functions';
export default {
async fetch(request) {
const sku = new URL(request.url).searchParams.get('sku');
const stock = await getStock(sku); // I/O wait: no Active CPU billed
waitUntil(logLookup(sku)); // runs after the response is sent
return Response.json(stock, {
headers: {
// s-maxage → Vercel CDN caches 30 s; then serves stale ≤60 s while refreshing
'Cache-Control': 'public, s-maxage=30, stale-while-revalidate=60',
},
});
},
};In Next.js the same thing is a Route Handler (app/api/stock/route.js exporting GET).
Limits (Fluid compute)
| Hobby | Pro / Enterprise | |
|---|---|---|
| Duration — default / max | 300 s / 300 s | 300 s / 800 s (1,800 s in beta) |
| Memory / CPU | 2 GB / 1 vCPU | 2 GB default, up to 4 GB / 2 vCPU |
| Request or response body | 4.5 MB | 4.5 MB |
| Bundle (uncompressed) | 250 MB (500 MB Python) | same; “large functions” to 5 GB in beta |
| Regions | 1 | Pro up to 3, Enterprise all |
| File descriptors | 1,024 shared across concurrent requests | same |
- 4.5 MB body is the one that bites: file uploads go direct to Blob storage, not through a function
- Timeout returns
504 FUNCTION_INVOCATION_TIMEOUT. Work that genuinely runs long goes to Vercel Workflows or a queue, not a biggermaxDuration - No persistent processes. Scheduled work uses Vercel Cron Jobs, which are just HTTP calls to a path on the production deployment
Routing Middleware
Routing Middleware is code that runs before the cache and before routing completes, for requests matching a path pattern. It can redirect, rewrite to another path, add request or response headers, or return a response directly.
- Runtime: Node.js by default (it moved off the Edge runtime), Bun or Python available. Must match the app’s runtime — JavaScript Runtimes
- Where it lives: in a framework that owns middleware, the framework’s file — Next.js 16+
proxy.ts, earliermiddleware.ts. Otherwise pointvercel.json"proxy"at an entrypoint - Request limits: URL 14 KB, body 4 MB, 64 headers, 16 KB of headers
- Geolocation arrives as headers —
x-vercel-ip-country,x-vercel-ip-city— or viageolocation(request)from@vercel/functions - Billed as Fluid compute — every matched request is an invocation, cache hits included
Use static config first. Redirects, rewrites, headers, and branching on a header, cookie, query or host all work in vercel.json with has / missing and run on the CDN without invoking code. Middleware earns its place when the decision needs logic: verifying a session token, reading Global Config, assigning a visitor to a test.
Caching
Three server-side layers, each with a different scope and a different thing that clears it — HTTP Caching, CDN Caching.
| CDN cache | ISR cache | Runtime Cache | |
|---|---|---|---|
| Stores | Whole HTTP responses | Prerendered pages + data payloads | Data: fetch results, query results |
| Where | Every CDN region, separately | Function region, durable | Function region, ephemeral |
| Set by | Cache-Control headers | Framework (revalidate, prerender config) | getCache(), fetch force-cache, use cache: remote |
| Scoped to | Deployment | One deployment | Project + environment — survives deploys |
| Cleared by | TTL (time to live), purge, tag invalidation | TTL, on-demand revalidate (≤300 ms globally), 31 days unread | TTL, tag expiry, least-recently-used eviction |
| Size limit | 10 MB response (20 MB streamed) | — | 2 MB per item |
CDN cache — the header rules
Cache-Control: public, s-maxage=60, stale-while-revalidate=300
│ │ └─ serve stale while refreshing in background
│ └─ shared caches (Vercel's CDN) keep it 60 s
└─ cacheable by shared caches
CDN-Cache-Control: Vercel + any downstream CDN, not the browser
Vercel-CDN-Cache-Control: Vercel only. Not forwarded anywhere
Response is NOT cached if any of:
- method isn’t
GET/HEAD, or request hasAuthorizationorRange - response has
set-cookie Cache-Controlhasprivate,no-cacheorno-storeVary: *, orVary: Cookie— Vercel refuses it outright, since every visitor’s cookie string differs. Logged as “Vary key denied”- status outside 200, 301, 302, 307, 308, 404, 410
The Vary: Cookie rule is the one that matters for experimentation — see below. Check what happened with the x-vercel-cache response header (HIT, MISS, STALE…).
ISR cache — the deploy gotcha
Static Generation and Revalidation is the concept; on Vercel the prerender cache is per deployment. A new deployment starts with an empty ISR cache, so every deploy produces a burst of regeneration against your CMS and database. Rollbacks are fast precisely because the old deployment’s cache is still there.
On failure (timeout, 5xx), Vercel keeps serving the stale page and retries in 30 s — a CMS outage degrades to stale content, not errors.
Runtime Cache — the opposite gotcha
Runtime Cache entries outlive deployments — unless written with Next.js 16’s use cache: remote, which keys by build ID and so starts empty each deploy. Production and Preview never share a cache. On Hobby, all projects in the team share one cache and can evict each other.
Experimentation on Vercel
Why this platform keeps coming up in experimentation: middleware sits in front of the cache, so assignment can happen server-side, before anything is rendered, without giving up static-page speed. That kills the client-side tool’s two signature costs — Flicker and Flash of Original Content and the render-blocking snippet — Client-Side vs Server-Side Testing.
The naive version, and why it fails
// proxy.ts (Next.js 16) — naive cookie bucketing
import { NextResponse } from 'next/server';
export const config = { matcher: ['/products/:path*'] }; // scope it!
export function proxy(request) {
let bucket = request.cookies.get('exp_pdp')?.value;
if (!bucket) bucket = Math.random() < 0.5 ? 'control' : 'gallery';
const url = request.nextUrl.clone();
url.pathname = `/_variants/${bucket}${url.pathname}`; // internal rewrite
const res = NextResponse.rewrite(url);
res.cookies.set('exp_pdp', bucket, { maxAge: 60 * 60 * 24 * 30 });
return res;
}This works: no flicker, sticky via cookie, variants are separate static paths. Its weaknesses are the general ones — Math.random() instead of a hash, so assignment can’t be recomputed from an ID (Assignment and Bucketing); and every page that reads the cookie during render, or sends Vary: Cookie, becomes uncacheable. [CHECK: whether a Set-Cookie added by middleware to a rewritten response prevents the CDN from caching the rewrite target]
The precompute pattern
The Flags SDK’s answer to “vary by cookie without killing the cache”: encode the flag values into a path segment, rewrite to it internally, and let each combination cache as its own URL.
VISITOR SEES MIDDLEWARE REWRITES TO CDN CACHE KEY
/products/blue-hoodie → /x9Kq/products/blue-hoodie → one entry per code
│
└─ code = signed encoding of
{ pdp-layout: treatment,
free-delivery-banner: off }
2 flags × 2 options = 4 codes = 4 cacheable variants of every product page
// flags.ts
import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const pdpLayout = flag<'control' | 'treatment'>({
key: 'pdp-layout',
options: [{ value: 'control' }, { value: 'treatment' }],
adapter: vercelAdapter(), // assignment rules live in Vercel Flags
});
export const productFlags = [pdpLayout] as const;// proxy.ts — evaluate once, encode, rewrite
import { NextResponse } from 'next/server';
import { precompute } from 'flags/next';
import { productFlags } from './flags';
export const config = { matcher: ['/products/:path*'] };
export async function proxy(request) {
const code = await precompute(productFlags); // e.g. "x9Kq"
const url = new URL(`/${code}${request.nextUrl.pathname}${request.nextUrl.search}`, request.url);
return NextResponse.rewrite(url, { request });
}// app/[code]/products/[slug]/page.tsx — static, reads the decision from the URL
export default async function Page({ params }) {
const { code } = await params;
const layout = await pdpLayout(code, productFlags); // no re-evaluation
return layout === 'treatment' ? <NewPdp /> : <CurrentPdp />;
}- Prebuild or lazily build:
generatePermutations()insidegenerateStaticParamsbuilds every combination at build time; returning[]builds each on first request via ISR - Combinatorial explosion is the cost. Every flag in the group multiplies variants of every page in scope. Keep site-wide flags and page flags in separate groups, and keep demo flags out
- The encoded URL must stay under 1,024 characters, which caps how much a group can hold
- Speed Insights gets per-variant Core Web Vitals for free — each variant is its own path, so the path breakdown splits them. (Individual metrics need Speed Insights Plus)
Assignment, exposure, analysis
- Assignment (Vercel Flags adapter): a deterministic xxHash32 of the entity — a stable ID from a cookie, or a user ID — seeded per flag, so assignments in different tests are independent — Assignment and Bucketing, Randomisation Unit, Interaction Effects
- Bots: middleware sees the user agent, so crawlers can be kept out of tests before assignment — Bot and Internal Traffic
- Exposure: emit flag values into the DOM and Web Analytics annotates page views and events with them;
reportValuedoes the same server-side for Runtime Logs. For any analysis outside Vercel, log exposure to your own analytics at render, not at assignment — Experiment Assignment Tracking - Why render, not assignment: middleware runs on every matched request, including framework prefetches of pages the user never opens. Counting assignments counts prefetches. Worth checking against your own traffic before trusting either count — Sample Ratio Mismatch
- Analysis: Web Analytics will show conversion events by flag value. It identifies visitors by a hash of the request that is discarded after 24 hours, so there is no user-level view across days — fine for a sense-check, not a test readout. [CHECK: whether Vercel Web Analytics or Vercel Flags offers any significance testing or experiment results view]
Marketplace providers
LaunchDarkly, Statsig, GrowthBook, Hypertune, ConfigCat and others plug in as Flags SDK adapters and Marketplace integrations, so the precompute pattern works with a dedicated experimentation tool doing the assignment and the stats — Statsig. The SDK is for Next.js and SvelteKit.
QA
- Flags Explorer (in the Vercel Toolbar) overrides flags per browser via an encrypted
vercel-flag-overridescookie — force yourself into each arm on a Preview or on production. A paid Pro add-on — Experiment QA - Preview deployments give each variant branch its own URL for design and stakeholder review — Preview Environments
Global Config (formerly Edge Config)
A small, globally replicated key-value document, read in-region with no network hop. Built for config that is read on every request and changes rarely: flag rules, emergency redirects, blocked IPs, a kill switch.
import { get } from '@vercel/global-config'; // reads env GLOBAL_CONFIG
const killSwitch = await get('checkout-banner-off'); // typically < 1 ms| Store size | 1 MB per store, all plans |
| Stores | Hobby 1; Pro/Enterprise unlimited, max 3 connected per project |
| Write propagation | Up to 10 s globally |
| Reads | Counted per call — getAll() once beats several get()s |
| Writes | REST API or dashboard only; the SDK is read-only |
| Backups | 7 days Hobby, 90 Pro, 365 Enterprise |
vs env vars: an env var change needs a redeploy; a Global Config change is live everywhere in ~10 s. vs a database: Global Config can’t take frequent writes — anything written often belongs in Redis via the Marketplace.
Environments and environment variables
Production production branch pushes, vercel --prod
Preview every other branch and PR
└─ per-branch overrides (staging branch gets staging DB)
Development vercel dev / vercel env pull → .env.local
Custom staging, qa… with own branch tracking + domain (Pro: 1 included)
- Changes apply only to new deployments. The most common “it’s not working” on the platform — Environment Configuration
- 64 KB total per deployment (5 KB per variable on the Edge runtime)
- Config vs Secret type: Config stays readable to the team; Secret is write-only after saving — Secrets Management
- Framework-prefixed variables are inlined into the client bundle at build —
NEXT_PUBLIC_*in Next.js. Anything with that prefix is public, and is frozen into that deployment - System variables:
VERCEL_ENV(production / preview / development),VERCEL_URL,VERCEL_DEPLOYMENT_ID,VERCEL_GIT_COMMIT_SHAand others.VERCEL_ENVis how code knows not to fire production analytics from a Preview
Preview deployments, protected
- Preview URLs are public by default unless Deployment Protection is on. Standard Protection covers everything except production domains; the method is Vercel Authentication (a Vercel login with project access), Password Protection (paid add-on on Pro), or on Enterprise, trusted IPs or your own identity provider. [CHECK: whether Standard Protection with Vercel Authentication is the default for new projects]
- The stakeholder problem: Vercel Authentication means a merchandiser without a Vercel account can’t open the link. Shareable links or a password are the workarounds
- Automated tests use Protection Bypass for Automation — a secret sent as a header — End-to-End Testing, Visual Regression Testing
- Previews send
X-Robots-Tag: noindex, as do superseded production deployments. A custom domain assigned to a preview branch is the exception worth checking - Speed Insights and analytics record Preview traffic too. Filter by environment, or QA sessions leak into the numbers — Bot and Internal Traffic
Observability
| Product | What | Notes |
|---|---|---|
| Speed Insights | Real User Monitoring of Core Web Vitals | Free tier shows Real Experience Score (RES) and a subset; individual metrics, per-element and map views need Speed Insights Plus. P75 (75th percentile) by default — Percentiles in Performance |
| Web Analytics | Page views + custom events | No cookies: visitor = hash of request data, discarded after 24 h. Custom events need Pro. @vercel/analytics, track() |
| Observability | Function invocations, errors, CPU, cache hit rates, middleware actions | Observability Plus adds longer retention and a query builder |
| Logs | Build and runtime logs | Runtime logs kept 1 hour on Hobby, 1 day on Pro, 30 days with Observability Plus. Ship them out with Drains |
| Drains | Export logs, traces, analytics, Speed Insights data | The route into a warehouse or a SIEM (security information and event management) tool |
Field data only — Speed Insights measures real visits, so a low-traffic route has too few data points to read — Field vs Lab Data.
Cookieless isn’t consent-free by itself. UK consent rules turn on storing or reading information on the device, and a request hash may or may not count — Consent Management. [CHECK: whether Vercel Web Analytics’ hashing approach is treated as exempt from consent under UK PECR (Privacy and Electronic Communications Regulations)]
Storage
First-party storage is now two products; databases come through the Marketplace.
- Vercel Blob — files, uploads, images, video. Public or private stores. Where uploads go to dodge the 4.5 MB function body limit
- Global Config — above
- Marketplace — Postgres (Neon, Supabase), Redis (Upstash), others.
vercel install neonprovisions it, connects it, and injects credentials as env vars per environment. Billing goes through Vercel; the database lives with the provider
Put the database in the function’s region. The platform makes compute placement a setting; it doesn’t make your data global.
Framework-defined infrastructure
The Build Output API is the contract between a framework and Vercel: a directory layout that is the deployment. Any framework that writes it gets every platform feature; Next.js, SvelteKit, Nuxt, Astro and others ship adapters that do.
.vercel/output/
├─ config.json routes (redirects, rewrites, headers),
│ overrides, deploymentId
├─ static/ served by the CDN, as-is, at /
│ ├─ favicon.png
│ └─ _vercel/immutable/… content-hashed, shared across deploys
└─ functions/
├─ api/stock.func/ → a function at /api/stock
│ ├─ .vc-config.json runtime, handler, memory, maxDuration, regions
│ └─ index.js
├─ blog.func/ → a function at /blog …
├─ blog.prerender-config.json … that is cached like a static file (ISR)
└─ blog.prerender-fallback.html
blog.prerender-config.json — roughly what export const revalidate = 60 on a Next.js page compiles to:
{
"expiration": 60,
"allowQuery": ["page"],
"fallback": "blog.prerender-fallback.html"
}How a Next.js app maps onto it:
| You write | Vercel gets |
|---|---|
| Static page | file in static/ |
Page with revalidate | function + prerender config (ISR) |
| Dynamic page / Route Handler | function |
next.config.js redirects, rewrites, headers | routes in config.json |
proxy.ts / middleware.ts | Routing Middleware |
next/image | Image Optimization |
This is also the lock-in. Nothing stops Next.js running elsewhere — but features like ISR with global purge, Skew Protection and image optimisation are implemented by the platform reading this output. Elsewhere you reimplement them or go without. The coupling is with the platform’s interpretation of your framework, not with an API you call — Reference - Next.js, Rendering Strategies.
Configuration
vercel.json at the project root. For Next.js, prefer next.config.js for redirects, rewrites and headers — the framework’s routes and Vercel’s merge, and the framework’s are the ones it knows about.
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"regions": ["lhr1"],
"redirects": [
{ "source": "/sale", "destination": "/collections/sale", "permanent": false }
],
"rewrites": [
{
"source": "/:path((?!uk/).*)",
"has": [{ "type": "header", "key": "x-vercel-ip-country", "value": "GB" }],
"destination": "/uk/:path*"
}
],
"headers": [
{
"source": "/api/catalogue",
"headers": [{ "key": "Cache-Control", "value": "public, s-maxage=300" }]
}
],
"functions": {
"api/*.js": { "maxDuration": 30 }
},
"crons": [
{ "path": "/api/reindex", "schedule": "0 3 * * *" }
]
}Line by line:
regions— the default function region. The first thing to set for a UK projectredirects—permanent: falseis a 307,truea 308. Max 2,048 in the array; beyond that, bulk redirects (a CSV or JSON file) or middleware reading Global Config — Redirects and Link Equityrewriteswithhas— conditional routing on header, cookie, query or host, entirely on the CDN.missingis the inverseheaders— the static way to set caching. ACache-Controlset in the function’s own response overrides thisfunctions— glob → per-function settingscrons— runs against the production deployment only
vercel.ts (via @vercel/config) is the typed alternative for anyone who’d rather generate config than write JSON.
Pricing model
Figures change and are regional; the axes are what to hold. [CHECK: current rates on vercel.com/pricing before any estimate]
- Hobby — free, non-commercial personal use only. A client project on Hobby breaks the terms
- Pro — per paid seat, plus a monthly usage credit, then on-demand per unit
- Enterprise — negotiated
What gets metered:
| Area | Billed on |
|---|---|
| CDN | Fast Data Transfer (CDN → user), Fast Origin Transfer (function region → CDN), CDN Requests, CDN Request CPU duration. Or Flat Rate CDN, a fixed capacity tier |
| Functions + middleware | Active CPU time, Provisioned Memory time, invocations. Regional rates |
| ISR | Reads and writes to the ISR cache |
| Runtime Cache | Usage, regional |
| Image Optimization | Transformations, cache reads, cache writes |
| Global Config | Reads, writes |
| Web Analytics / Speed Insights | Events |
| Observability Plus | Events |
| Blob | Storage, operations, transfer |
| Builds | CPU-minutes by machine type |
| Add-ons (flat monthly) | Flags Explorer, Password Protection, Speed Insights Plus, Web Analytics Plus, extra custom environments, single sign-on, static IPs… |
Where bills surprise:
- Middleware with a broad matcher — an invocation per asset request
- Uncacheable pages — a
Vary: Cookieor a strayset-cookieturns CDN hits into function invocations - ISR revalidating too often — every regeneration is an invocation plus a write; on-demand revalidation by tag usually beats a short
revalidate - Every deploy re-warms ISR — frequent deploys on a large catalogue mean frequent regeneration storms
- Image Optimization on a large, changing catalogue — every new size × format × image is a transformation
Where it hurts
- The default region is Washington. UK projects that never change it pay latency on every cache miss
- Rollback silently pauses releases until undone
- Env var changes need a redeploy, and rollbacks keep the old values
- No long-running process. WebSockets are in public beta, background work goes through
waitUntil, Workflows or a queue, and anything stateful lives in a Marketplace service - Fluid concurrency changes the meaning of module scope. Code written for one-request-per-instance can leak state between users
- Cost is spread across a dozen meters, and the expensive one is rarely the one you were watching
- Framework coupling. Next.js on Vercel is the path of least resistance and the path of most lock-in; the Build Output API is open, but the behaviour behind it isn’t portable
- The checkout isn’t here. A headless storefront on Vercel still hands off to the commerce platform’s checkout, and edge testing stops at that boundary — Headless Architecture, Shopify
Names to recognise: Netlify (the closest like-for-like), Cloudflare Pages and Workers (the edge-first alternative — Cloudflare), AWS Amplify, Render.
Related
- Edge Computing · CDN Caching · Static Generation and Revalidation — the concepts this platform productises
- Preview Environments · Continuous Deployment · Progressive Delivery — the release model
- Feature Flags · Client-Side vs Server-Side Testing · Assignment and Bucketing — the experimentation side
- Reference - Next.js — the framework it’s built around