Skip to main content
The Bijection command-line interface (CLI) is your interface for managing Bijection projects and Bijection functions. To install the CLI on macOS or Linux, run:
It installs ~/.bijection/bin/bijection and needs no Node.js: the CLI manages its own toolchain. See Install Bijection for PATH setup, supported platforms, upgrading with bijection upgrade and uninstalling. The available CLI commands are:

Configure

Create a new project

creates my-app/ with the bijection/ directory, the home for your query and mutation functions, holding a sample schema, query and mutation, plus bijection.json, .gitignore and a README. Without a directory argument it works in the current directory, so you can run it inside an existing app; it never overwrites existing files. --template chooses the template:
  • backend (default): the backend alone. It needs no Node.js or npm; the CLI writes node_modules/bijection for your editor’s types.
  • react-vite: also a React app built with Vite.
  • nextjs: also a Next.js app.
The react-vite and nextjs templates install the app’s dependencies with your package manager (pnpm, bun, yarn or npm).

Log in

logs this machine in to your Bijection account, once per machine, and stores the credential in ~/.bijection/config.json.
Bijection’s hosted service is not yet open for public sign-up, and the CLI has no default management service. Before running bijection login, set BIJECTION_MANAGEMENT_URL to the management service URL you were given, in your shell’s startup file so that every later bijection command sees it too:

Create a deployment

The first time you run
in a project, it creates a new Bijection project and your dev deployment. It then creates:
  1. .env.local with BIJECTION_DEPLOYMENT variable: This is the main configuration for your Bijection project. It is the name of your development deployment.
  2. bijection/_generated/: the typed API of your functions.

Recreate project configuration

Run
in a project directory without a set BIJECTION_DEPLOYMENT to configure a new or existing project.

Log out

Remove the existing Bijection credentials from your device, so subsequent commands like bijection dev can use a different Bijection account.

Develop

Run the Bijection dev server

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 bijection/_generated are updated. By default, logs from your dev deployment are displayed in the terminal. It’s also possible to run a Bijection deployment locally for development.

Open the console

Open the Bijection console.

Open the docs

Get back to these docs!

Run Bijection functions

Run a public or internal Bijection query, mutation, or action on your development deployment. Arguments are specified as a JSON object.
Add --watch to live update the results of a query. Add --push to push local code to the deployment before running the function. Use --prod to run functions in the production deployment for a project.

Run an inline query

You can also evaluate a readonly inline query on your deployment:
For multi-statement queries, use an explicit return:
If you need full control, you can pass a full module source that exports a default query:
The function call is also completely sandboxed, so it can only read data and cannot modify the database or access the network. Use --component <path> to run the inline query inside a mounted component. Use --prod to run the inline query on the production deployment for a project.

Tail deployment logs

You can choose how to pipe logs from your dev deployment to your console:
Use --prod with bijection logs to tail the prod deployment logs instead.

Import data from a file

See description and use-cases: data import.

Export data to a file

See description and use-cases: data export.

Display data from tables

Display a simple view of the console data page in the command line. The command supports --limit and --order flags to change data displayed. For more complex filters, use the console data page or write a query. The bijection data <table> command works with system tables, such as _storage, in addition to your own tables.

Show deployment health insights

Show health insights for a Bijection deployment over the last 72 hours. Reports OCC (Optimistic Concurrency Control) conflicts and resource limit issues that may indicate performance problems. Add --details to include recent events for each insight. Use --prod to check the production deployment, --preview-name <name> for a preview deployment, or --deployment-name <name> for a specific deployment.

Read and write environment variables

See and update the deployment environment variables. You can alternatively use the settings page on the console. Tip: to avoid secrets from ending up in your terminal shell history, you can pass the value via stdin, from a file, or interactively. Useful commands:
Note: to set variables on your production deployment, pass --prod.

Deploy

Deploy Bijection functions to production

The target deployment to push to is determined like this:
  1. If the BIJECTION_DEPLOY_KEY environment variable is set (typical in CI), then it is the deployment associated with that key.
  2. If the BIJECTION_DEPLOYMENT environment variable is set (typical during local development), then the target deployment is the production deployment of the project that the deployment specified by BIJECTION_DEPLOYMENT belongs to. This allows you to deploy to your prod deployment while developing against your dev deployment.
This command will:
  1. Run a command if specified with --cmd. The command will have BIJECTION_URL (or similar) environment variable available:
    You can customize the URL environment variable name with --cmd-url-env-var-name:
  2. Typecheck your Bijection functions.
  3. Regenerate the generated code in the bijection/_generated directory.
  4. Bundle your Bijection functions and their dependencies.
  5. Push your functions, indexes, and schema to production.
Once this command succeeds the new functions will be available immediately.

Deploy Bijection functions to a preview deployment

When run with the BIJECTION_DEPLOY_KEY environment variable containing a Preview Deploy Key, this command will:
  1. Create a new Bijection deployment. bijection deploy will infer the Git branch name for Vercel, Netlify, GitHub, and GitLab environments, or the --preview-create option can be used to customize the name associated with the newly created deployment.
  2. Run a command if specified with --cmd. The command will have BIJECTION_URL (or similar) environment variable available:
    You can customize the URL environment variable name with --cmd-url-env-var-name:
  3. Typecheck your Bijection functions.
  4. Regenerate the generated code in the bijection/_generated directory.
  5. Bundle your Bijection functions and their dependencies.
  6. Push your functions, indexes, and schema to the deployment.
  7. Run a function specified by --preview-run (similar to the --run option for bijection dev).
See the Vercel or Netlify hosting guide for setting up frontend and backend previews together.

Update generated code

The generated code in the bijection/_generated directory includes types required for a TypeScript typecheck. This code is generated whenever necessary while running bijection dev and this code should be committed to the repo (your code won’t typecheck without it!). In the rare cases it’s useful to regenerate code (e.g. in CI to ensure that the correct code was checked it) you can use this command. With a deployment configured, bijection codegen has the deployment evaluate your functions and configuration in the Bijection JavaScript runtime; this doesn’t modify the code running on the deployment. Without one, it generates the code from bijection/ alone, as bijection init does. A project with bijection/bijection.config.ts, or with codegen.staticApi or codegen.staticDataModel in bijection.json, needs a deployment’s analysis: run bijection dev first.