Static Configuration with vercel.toml
The vercel.toml file lets you configure your Vercel project with TOML. In addition to supporting the same configuration properties as vercel.json, it supports comments and has a flatter structure.
You may wish to use TOML when you have a large or complex configuration, such as if you need to configure many Rewrites or are using Services to deploy multiple applications within one Vercel project.
Create vercel.toml in your project root and commit it with your code. Use only one project configuration file: vercel.toml, vercel.json, or vercel.ts.
Set top-level properties using TOML key-value pairs. This example configures the build command, output directory, and clean URLs:
"$schema" = "https://openapi.vercel.sh/vercel.json"
buildCommand = "pnpm run build"
outputDirectory = "dist"
cleanUrls = true{
"$schema": "https://openapi.vercel.sh/vercel.json",
"buildCommand": "pnpm run build",
"outputDirectory": "dist",
"cleanUrls": true
}TOML is a good fit for configuring Services, which let you deploy multiple applications within one Vercel project. This example deploys a frontend and backend service, routing /api requests to the backend and all other requests to the frontend:
"$schema" = "https://openapi.vercel.sh/vercel.json"
# Next.js frontend
[services.frontend]
root = "frontend/"
# FastAPI backend
[services.backend]
root = "backend/"
entrypoint = "main:app"
[[rewrites]]
source = "/api/(.*)"
destination = { service = "backend" }
[[rewrites]]
source = "/(.*)"
destination = { service = "frontend" }{
"$schema": "https://openapi.vercel.sh/vercel.json",
"services": {
"frontend": {
"root": "frontend/"
},
"backend": {
"root": "backend/",
"entrypoint": "main:app"
}
},
"rewrites": [
{
"source": "/api/(.*)",
"destination": { "service": "backend" }
},
{
"source": "/(.*)",
"destination": { "service": "frontend" }
}
]
}vercel.toml supports all the same configuration fields as vercel.json.
Was this helpful?