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
Show full listing of changes and detailed output.
Print out the generated configuration without deploying to your Convex deployment.
Skip confirmation prompt when running locally.
Check TypeScript files with
tsc --noEmit before deploying.Choices: enable, try, disableCheck TypeScript files within component implementations with
tsc --noEmit.Regenerate code in
convex/_generated/ before pushing.Choices: enable, disableCommand 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.Environment variable name to set Convex deployment URL when using
--cmd.Example: VITE_CONVEX_URLThe 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.Function to run if deploying to a preview deployment.Ignored when deploying to a production deployment.
Environment variables
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
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:- Generate a Preview Deploy Key in your Convex dashboard
- Set
CONVEX_DEPLOY_KEYto your Preview Deploy Key - Run
npx convex deploy --preview-create <name>
- Vercel (
VERCEL_GIT_COMMIT_REF) - Netlify (
BRANCH) - GitHub Actions (
GITHUB_HEAD_REForGITHUB_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 successful1- Deployment failed or was cancelled