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
Create a new project
The first time you run
npx convex dev
it will ask you to log in your device and create a new Convex project. It will then create:
- The
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
Run
npx convex dev
in a project directory without a convex.json
to recreate it and configure a
new or existing project.
Write Code
Run the Convex dev server
npx convex dev
Watches the local filesystem. When you change a function
or the schema, the new versions are pushed to your
dev deployment and the generated types in convex/_generated
are updated.
Deploy Convex functions to production
npx convex deploy
This command will:
- Typecheck your Convex functions.
- Regenerate the generated code in the
convex/_generated
directory. - Bundle your Convex functions and their dependencies.
- Push your functions, indexes, and schema to production.
Once this command succeeds the new functions will be available immediately.
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 Authentication.
Misc
Import data from a file into a table
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..jsonl
files must have a JSON object per line.
Imports into a table with existing data will fail by default, but you can
specify --append
to append the imported rows to the table or --replace
to
replace existing data in the table with your import.
The default is to import into your dev deployment. Use --prod
to import to
your production deployment
Limitations
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
run 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!
Update generated code
npx convex codegen
Update the generated code in convex/_generated
without
pushing. This can be useful for orchestrating build steps in CI.
Open the dashboard
npx convex dashboard
Open the Convex dashboard.
Open the docs
npx convex docs
Get back to these docs!