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
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:
convex/directory: This is the home for your query and mutation functions.
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
convex.json if you lose it.
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:
- Typecheck your Convex functions.
- Regenerate the generated code in the
- Bundle your Convex functions and their dependencies.
- 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
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 Authentication.
Open the dashboard
npx convex dashboard
Open the Convex dashboard.
Open the docs
npx convex docs
Open these docs!
Import a file into Convex
npx convex import <tableName> <path>
Import a CSV, JSON, or JSONLines file into a Convex table.
- CSV files must have a header, and each row's entries are interpreted either as a (floating point) number or a string.
- JSON files must be an array of JSON objects.
- JSONLines files must have a JSON object per line.
The default is to import into your dev deployment. Use
--prod to import into
your project in production. Imports into a table with existing data will fail by
default, but you can specify
--append to append the imported rows to the table
--replace to replace existing data in the table with your import.
Currently Convex only supports imports of up to 8192 rows and 8MiB in size. To
work around this, you can split your large import file into smaller files and
npx convex import --append for each one. Feel free to ping us in the
community Discord if you would like better
support for large imports!