Skip to main content

Convex CLI

The Convex command-line interface (CLI) is your interface for managing Convex projects 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 Quickstart Guide.

Manage Projects

All of these commands require logging in first with:

npx convex login

Create a new project

npx convex init

Create a new Convex project. This command creates:

  1. The convex/ directory: This is the home for your query and mutation functions.
  2. convex.json: This is the main configuration for your Convex project. It includes a randomly assigned URL for the project in production.

Recreate project configuration

npx convex reinit

Recreate convex.json if you lose it.

Write Code

Run the Convex dev server

npx convex dev

Watch the local filesystem. When your Convex functions change, push them to your dev deployment and update generated code.

Deploy Convex functions to production

npx convex deploy

This command will:

  1. Typecheck your Convex functions.
  2. Regenerate the generated code. This includes the production version of clientConfig.js.
  3. Bundle your Convex functions and their dependencies.
  4. Push your functions and indexes to production.

Once this command succeeds the new functions will be available immediately.

Update generated code

npx convex codegen

Update the generated code in convex/_generated without pushing. This is useful after adding or removing Convex functions or making schema changes.

Typecheck functions

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:

  • add
  • remove
  • list

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!

[Experimental] Import a file into Convex

npx convex import <tableName> <path>

Import a CSV or JSON file into a Convex table. CSV files must have a header, and each rows' entries are interpreted either as a (floating point) number or a string. JSON files must have a JSON object per line. Defaults to import into your dev deployment. Use --prod to import into your project in production.