Deployment Configuration

Build provides three deployment targets: preview (automatic on every change), staging (manual promotion), and production (manual promotion with review).

Preview Deployments

Every change triggers an automatic preview deployment. Preview URLs follow the pattern {"{project}"}-{"{branch}"}-{"{commit}"}.preview.build.poly.inc. Previews are ephemeral and expire after 7 days of inactivity.

Deployment Targets

build.json
json
{
"deployment": {
"staging": {
"branch": "develop",
"autoDeploy": true,
"env": {
"NODE_ENV": "staging"
}
},
"production": {
"branch": "main",
"autoDeploy": false,
"requireApproval": true,
"env": {
"NODE_ENV": "production"
}
}
}
}
branchstring(required)Branch that triggers deploymentautoDeploybooleanfalseDeploy automatically on push to branchrequireApprovalbooleanfalseRequire team approval before deployingenvobject{}Environment overrides for this target

Build Settings

Fine-tune the build process for production deployments:

build.json
json
{
"build": {
"command": "npm run build",
"outputDirectory": ".next",
"nodeVersion": "20",
"cache": true,
"optimization": {
"minify": true,
"sourceMaps": false,
"compress": true
}
}
}
commandstringautoBuild command for productionoutputDirectorystringautoDirectory containing build outputnodeVersionstring20Node.js version for buildcachebooleantrueCache node_modules between buildsoptimization.minifybooleantrueMinify JavaScript and CSSoptimization.sourceMapsbooleanfalseInclude source mapsoptimization.compressbooleantrueGzip compress static assets

Custom Domains

Map custom domains to production deployments in Project Settings. Build provisions SSL certificates automatically via Let's Encrypt.

PreviousEnvironmentNextAbout