Skip to main content
The convex deploy command deploys your Convex functions to your production deployment. By default, it deploys to your prod deployment, but it can also create and deploy to preview deployments when using Preview Deploy Keys.

Usage

Options

boolean
Show full listing of changes and detailed output.
boolean
Print out the generated configuration without deploying to your Convex deployment.
boolean
Skip confirmation prompt when running locally.
string
default:"try"
Check TypeScript files with tsc --noEmit before deploying.Choices: enable, try, disable
boolean
default:false
Check TypeScript files within component implementations with tsc --noEmit.
string
default:"enable"
Regenerate code in convex/_generated/ before pushing.Choices: enable, disable
string
Command to run as part of deploying your app (e.g., vite build).This command can depend on the environment variables specified in --cmd-url-env-var-name being set.
string
Environment variable name to set Convex deployment URL when using --cmd.Example: VITE_CONVEX_URL
string
The name to associate with a newly created preview deployment.Defaults to the current Git branch name in Vercel, Netlify, and GitHub CI.Can only be used with a Preview Deploy Key (set via CONVEX_DEPLOY_KEY).Conflicts with --preview-name.
string
Function to run if deploying to a preview deployment.Ignored when deploying to a production deployment.

Environment variables

string
Deploy key for authentication. The type of key determines the deployment target:
  • Production Deploy Key - Deploys to production
  • Preview Deploy Key - Creates or updates a preview deployment
Generate deploy keys in the Convex dashboard under Settings > Deploy Keys.
string
Deployment name to deploy to (alternative to using deploy keys).

Examples

Deploy to production

Deploy to your production deployment:

Preview deployment (CI/CD)

Create or update a preview deployment in CI:

Deploy with build command

Run your frontend build after deploying Convex:

Dry run

Check what would be deployed without actually deploying:

Deploy and run a function

Deploy to preview and run a seed function:

Preview deployments

Preview deployments allow you to create temporary deployments for testing:
  1. Generate a Preview Deploy Key in your Convex dashboard
  2. Set CONVEX_DEPLOY_KEY to your Preview Deploy Key
  3. Run npx convex deploy --preview-create <name>
The CLI automatically detects the branch name from:
  • Vercel (VERCEL_GIT_COMMIT_REF)
  • Netlify (BRANCH)
  • GitHub Actions (GITHUB_HEAD_REF or GITHUB_REF_NAME)

Build environment checks

The CLI checks for non-production build environments (Vercel, Netlify, GitHub Actions) when deploying to production and warns if you might be deploying from the wrong environment. Disable this check with:

Exit codes

  • 0 - Deployment successful
  • 1 - Deployment failed or was cancelled