> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# bijection deploy

> Deploy to a production or preview deployment

Deploys code to a deployment.
This is typically used for deploying to a prod or preview deployment manually or from CI; to deploy to your dev deployment when developing, use `bijection dev`.

The target deployment is chosen like this:

* If the `BIJECTION_DEPLOYMENT` environment variable is set (typical during local development), the target is the project’s default production deployment.
* If the `BIJECTION_DEPLOY_KEY` environment variable is set (typical in CI), it is the deployment associated with that key.
  * When it’s set to a preview deploy key, it will deploy to a preview deployment:
    * with the name of the current Git branch when running in CI (Vercel, Netlify, Cloudflare Pages, GitHub)
    * or with the name specified by the `--preview-name` or `--preview-create` flags

`bijection deploy` will:

1. Run a command if specified with `--cmd`, with the deployment URL available as an environment variable.
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 the deployment.
6. When deploying to a preview deployment, it runs the function specified by `--preview-run`.
   If any step fails, the next steps do not run.

## Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection deploy [options]
```

## Options

<dl>
  <dt>`-v, --verbose`</dt>

  <dd>
    Show full listing of changes
  </dd>

  <dt>`--dry-run`</dt>

  <dd>
    Print out the generated configuration without deploying to your Bijection deployment
  </dd>

  <dt>`--typecheck <mode>`</dt>

  <dd>
    Whether to check TypeScript files with `tsc --noEmit` before deploying.
  </dd>

  <dt>`--typecheck-components`</dt>

  <dd>
    Check TypeScript files within component implementations with `tsc --noEmit`.
  </dd>

  <dt>`--codegen <mode>`</dt>

  <dd>
    Whether to regenerate code in `bijection/_generated/` before pushing.
  </dd>

  <dt>`--cmd <command>`</dt>

  <dd>
    Command to run as part of deploying your app (e.g. `vite build`). This command can depend on the environment variables specified in `--cmd-url-env-var-name` being set.
  </dd>

  <dt>`--cmd-url-env-var-name <name>`</dt>

  <dd>
    Environment variable name to set Bijection deployment URL (e.g. `VITE_BIJECTION_URL`) when using `--cmd`
  </dd>

  <dt>`--preview-run <functionName>`</dt>

  <dd>
    Function to run if deploying to a preview deployment. This is ignored if deploying to a production deployment.
  </dd>

  <dt>`--preview-name <name>`</dt>

  <dd>
    The name to associate with this preview deployment. Defaults to the current Git branch name in Vercel, Netlify, Cloudflare Pages and GitHub CI. Reuses the existing deployment if one exists.
  </dd>

  <dt>`--preview-create <name>`</dt>

  <dd>
    Like --preview-name, but deletes and recreates an existing preview deployment with the same name. This parameter can only be used with a preview deploy key (when used with another type of key, the command will return an error).
  </dd>

  <dt>`--env-file <envFile>`</dt>

  <dd>
    Path to a custom file of environment variables, for choosing the deployment, e.g. BIJECTION\_DEPLOYMENT or BIJECTION\_SELF\_HOSTED\_URL. Same format as .env.local or .env files, and overrides them.
  </dd>

  <dt>`--message <message>`</dt>

  <dd>
    Optional message to attach to this deployment in the audit log.
  </dd>

  <dt>`--skip-large-indexes-check`</dt>

  <dd>
    Skip the confirmation prompt when this push creates, changes, or deletes an index on a large table. Creating or changing an index blocks the deploy until it is backfilled; consider staging it instead so it backfills in the background.
  </dd>
</dl>
