The Convex command-line interface (CLI) is your interface for managing Convex deployments and Convex functions.
To install the CLI, run:
npm install convex
You can view the full list of commands with:
npx convex -h
A cheat sheet of commands is available in the Quick Start Guide.
All of these commands require logging in first with:
npx convex login
Create a new deployment
npx convex init
Create a new deployment for the current project. This command creates:
convex/directory: This is the home for your query and mutation functions.
convex.json: This is the main configuration for your Convex deployment. It includes a randomly assigned deployment URL.
.env.local: This contains an admin key that authorizes your to manage your deployment.
Deactivate a deployment
npx convex deactivate
This command will stop the running deployment, and its data will no longer be
accessible. Deactivating a deployment will give you back a credit that you can
use to provision a new deployment with
npx convex init.
Recreate deployment configuration files
npx convex reinit --deployment-name <name>
.env.local files if you lose them. You can find
the deployment name by viewing the dashboard.
Push Convex functions
npx convex push
This command will:
- Typecheck your Convex functions.
- Regenerate the generated code.
- Bundle your Convex functions and their dependencies.
- Push your functions to your Convex deployment.
Once this command succeeds the new functions will be available immediately. You should run this command anytime you create or modify your Convex functions.
Update generated code
npx convex codegen
Update the generated code in
pushing. This is useful after adding or removing Convex functions or making
npx convex typecheck
Run TypeScript over all of your functions without pushing.
Modify authentication settings
npx convex auth <subcommand>
Update the authentication settings for your application. The possible subcommands are:
To learn more about adding authentication to your app, see the Users and Auth Tutorial.
Open the dashboard
npx convex dashboard
Open the Convex dashboard.
Open the docs
npx convex docs
Open these docs!