Reference
Configuration (vercel.json)
The vercel.json project configuration file — build settings, rewrites, redirects, headers, function config, and crons.
Most projects deploy with zero configuration because Vercel detects your framework. When you need to override defaults, you add a vercel.json file at the root of your project. Settings defined in the dashboard and in vercel.json are merged; vercel.json is version-controlled, which makes it the better place for anything you want reviewed alongside code.
A representative example
{
"buildCommand": "next build",
"outputDirectory": ".next",
"framework": "nextjs",
"redirects": [
{ "source": "/old", "destination": "/new", "permanent": true }
],
"rewrites": [
{ "source": "/api/:path*", "destination": "https://backend.example.com/:path*" }
],
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "X-Frame-Options", "value": "DENY" }
]
}
],
"functions": {
"api/heavy.ts": { "memory": 3008, "maxDuration": 60 }
},
"crons": [
{ "path": "/api/cron/cleanup", "schedule": "0 3 * * *" }
]
}Common fields
| Field | What it does |
|---|---|
buildCommand | Override the detected build command |
outputDirectory | Where build artifacts are written |
installCommand | Override how dependencies are installed |
framework | Force a framework preset |
redirects | Server-side redirects (301/302 via permanent) |
rewrites | Proxy a path to another path or external URL without changing the URL |
headers | Attach response headers by path pattern |
functions | Per-function memory, maxDuration, and runtime settings |
crons | Scheduled function invocations |
regions | Which region(s) functions run in |
Redirects vs rewrites
- A redirect sends the browser to a new URL (the address bar changes).
- A rewrite serves content from a different path or origin while the URL stays the same — useful for proxying an API or composing apps.
Function configuration
The functions object tunes individual functions — for example raising memory or maxDuration for a heavy endpoint. To enable Fluid Compute for specific environments programmatically, use the fluid property.
Precedence and validation
vercel.jsonsettings generally take precedence over dashboard settings where they overlap.- The CLI validates the file during
vercel build/vercel deploy; a malformedvercel.jsonfails the build with an error. vercel pullbrings the effective project settings down into.vercel/so localvercel dev/vercel buildmatch the cloud.