npm package: @prisma/compute-cli
Description: Command-line interface for deploying and managing [Prisma Compute](https://www.prisma.io/compute) services.
Latest version: 0.14.0

# Compute CLI

Command-line interface for deploying and managing [Prisma Compute](https://www.prisma.io/compute) services.

## Quick start

Run directly with bunx (no install required):

```sh
bunx @prisma/compute-cli --help
```

> Also works with `npx @prisma/compute-cli` if you don't have Bun installed.

## Authentication

### Interactive login (browser-based)

```sh
bunx @prisma/compute-cli login
```

This opens your browser for OAuth authentication with Prisma. Tokens are stored locally:

| Platform | Path                                                                                           |
| -------- | ---------------------------------------------------------------------------------------------- |
| macOS    | `~/Library/Application Support/prisma-compute/auth.json`                                       |
| Linux    | `$XDG_CONFIG_HOME/prisma-compute/auth.json` (defaults to `~/.config/prisma-compute/auth.json`) |
| Windows  | `%APPDATA%\prisma-compute\auth.json`                                                           |

To log out and clear stored credentials:

```sh
bunx @prisma/compute-cli logout
```

### Service token (CI / non-interactive)

Set the `PRISMA_API_TOKEN` environment variable. When present, the CLI skips the stored OAuth credentials and authenticates with this token directly.

```sh
export PRISMA_API_TOKEN="your-service-token"
bunx @prisma/compute-cli projects list
```

## Commands

All commands except `login` and `logout` support `--json` for machine-readable output.

### Deploy

Build and deploy your application:

```sh
bunx @prisma/compute-cli deploy --path ./my-app
```

Key flags:

| Flag              | Description                                                                        |
| ----------------- | ---------------------------------------------------------------------------------- |
| `--path`          | App directory (default: `.`)                                                       |
| `--project`       | Project ID (prompted interactively if omitted)                                     |
| `--service`       | Compute service ID (prompted interactively if omitted)                             |
| `--entrypoint`    | File to run at startup, relative to `--path` (falls back to `package.json` `main`) |
| `--serviceName`   | Name for a new compute service                                                     |
| `--region`        | Region for a new compute service                                                   |
| `--env KEY=VALUE` | Environment variable (repeatable)                                                  |
| `--httpPort`      | HTTP port your application listens on (default: `8080`)                            |
| `--skipBuild`     | Deploy a pre-built artifact (requires `--entrypoint`)                              |
| `--timeout`       | Poll timeout in seconds (default: `120`)                                           |
| `--pollInterval`  | Poll interval in ms (default: `1000`)                                              |
| `--json`          | Output JSON instead of human-readable text                                         |

Set `PRISMA_COMPUTE_SERVICE_ID` to skip the `--service` flag across all commands:

```sh
export PRISMA_COMPUTE_SERVICE_ID="your-service-id"
bunx @prisma/compute-cli deploy --path ./my-app
```

### Environment variables

Update environment variables on a running service (creates a new version):

```sh
bunx @prisma/compute-cli env update --env DATABASE_URL=postgres://... --env NODE_ENV=production
```

### Projects

```sh
bunx @prisma/compute-cli projects list
```

### Services

```sh
bunx @prisma/compute-cli services list --project <id>
bunx @prisma/compute-cli services create --project <id> --name my-service --region <region>
bunx @prisma/compute-cli services show <service-id>
bunx @prisma/compute-cli services delete <service-id>
bunx @prisma/compute-cli services destroy <service-id>  # stops all versions, then deletes
```

### Versions

```sh
bunx @prisma/compute-cli versions list --service <id>
bunx @prisma/compute-cli versions show <version-id>
bunx @prisma/compute-cli versions start <version-id>
bunx @prisma/compute-cli versions stop <version-id>
bunx @prisma/compute-cli versions delete <version-id>
bunx @prisma/compute-cli versions destroy <version-id>  # stops, then deletes
```

## JSON output

Pass `--json` to any command for structured output suitable for scripting:

```sh
bunx @prisma/compute-cli services list --project <id> --json | jq '.value[].id'
```

## Configuration

| Variable                    | Description                            |
| --------------------------- | -------------------------------------- |
| `PRISMA_API_TOKEN`          | Service token for non-interactive auth |
| `PRISMA_COMPUTE_SERVICE_ID` | Default compute service ID             |
| `PRISMA_MANAGEMENT_API_URL` | Override the management API base URL   |

## Development

```sh
bun run bin/compute --help
bun run bin/compute deploy --path .
```