BUILD.md
You will need to first install the following dependencies if you don't already have them on your machine:
To use the scripts set up in this repo:
Just
Justfile.cargo install just or brew install justTo run the Convex CLI:
.nvmrcnvm use from the root of the repo.To build the backend from source:
rust-toolchain
rustup, this will install
automatically.npm clean-install --prefix scriptsjust rush installBuild and run the local backend from the source in this repo:
just run-local-backend
This example will go through running the backend with the included demo project.
1. Start the backend
If this fails with an error "persisted db metadata ..." you might need to erase
the local database, in root directory run rm convex_local_backend.sqlite3.
2. Develop against the backend
The Convex CLI watches for changes in the application source code and pushes the code to backend.
To make the local backend run the included demo project, do:
cd npm-packages/demos/tutorial
npm i
just convex dev
The convex script in Justfile automatically adds appropriate --url and
--admin-key flags to point the CLI to the local backend.
To run the client web application you can run the demo Vite server via:
npm run dev:frontend
Note that unlike the hosted Convex workflow, we don't want to run the
dev:backend command since convex dev is already running.
The following CLI commands may be useful when interacting with your backend:
just convex data - Lists tables in your Convex deploymentjust convex env - Allows you to list/set/update/delete environment variablesjust convex logs - Streams out log lines to the terminal (it includes all
successful executions if --success is passed in)just convex import - Allows you to import tablesjust convex export - Allows you to export tablesIf you're using both the local backend and the hosted cloud platform, make sure
to run npx convex dev or just convex dev before you start testing your
client. The dev command will take care of updating your .env.local file with
the correct CONVEX_URL.