---
url: https://docs.zenavo.app/cli
---

# CLI

`zenavo` deploys and operates your projects from a terminal or from CI. It talks to the [REST API](https://docs.zenavo.app/api/overview) with an [API key](https://docs.zenavo.app/account/api-keys), and its commands follow Zeabur's CLI (`auth`, `workspace`, `context`, `project`, `service`, `deployment`), so moving over is easy.

## Install

macOS and Linux:

```sh
curl -fsSL https://zenavo.app/install.sh | sh
```

Windows (PowerShell):

```powershell
irm https://zenavo.app/install.ps1 | iex
```

The script downloads the binary for your system from the [latest release](https://github.com/Zenavo-App/zenavo-cli/releases/latest), checks it against the release's `SHA256SUMS` and puts it on your `PATH`, without root or administrator rights. Read it first if you like: [install.sh](https://github.com/Zenavo-App/zenavo-cli/blob/main/install.sh), [install.ps1](https://github.com/Zenavo-App/zenavo-cli/blob/main/install.ps1). Set `ZENAVO_VERSION=v0.2.0` for a particular release or `ZENAVO_INSTALL_DIR` for another directory.

With a package manager:

```sh
brew trust --formula zenavo-app/tap/zenavo  # Homebrew 7+: allow this formula first
brew install zenavo-app/tap/zenavo          # Homebrew, macOS and Linux
npm install -g zenavo                       # npm; or run once with npx zenavo
go install github.com/Zenavo-App/zenavo-cli/cmd/zenavo@latest   # Go 1.26+, from source
```

The npm package installs only the binary for your system and runs nothing at install time. Each release also lists every binary on its own, `zenavo_<os>_<arch>` with `SHA256SUMS`, and the [zenavo-cli](https://github.com/Zenavo-App/zenavo-cli) repository explains how to build it yourself. Check the result with `zenavo version`.

## Sign in

```sh
zenavo auth login                          # shows a code and opens <console>/device
zenavo auth login --scope deploy           # ask for a key that can deploy but not do everything
zenavo auth login --with-token < key.txt   # an existing API key, read from stdin
zenavo auth status                         # who you are signed in as, and what the key may do
```

`auth login` shows a code and opens the console's **/device** page: sign in, type the code and approve. Check the device name and network the page shows before approving. Over SSH, open the printed address on any device. The CLI then gets its own API key, named "CLI on &lt;computer&gt;" and valid for 90 days. On the approval page you can lower its [permission](https://docs.zenavo.app/account/api-keys#permissions) and limit it to some projects.

`--scope` chooses the [permission](https://docs.zenavo.app/account/api-keys#permissions) the CLI asks for: `read` (Read only), `deploy` (Deploy) or `full` (Full access, the default). Ask for the least you need, especially on shared machines. The approver can still lower it or limit it to some projects, never raise it. The CLI saves what was approved, and `zenavo auth status` shows it:

```
https://zenavo.app as dev@example.com (saved key)
Access: deploy (deploy and configure existing projects), limited to 1 project(s): proj_…
```

When a command needs more than the key may do, the API answers `403` and the CLI says what to do: sign in again with a wider scope (`zenavo auth login --scope full`), approve the key for all projects, or, for what no API key can do (billing, members, the account), use the console. With `--with-token` the key's permission was chosen when it was created, so `auth status` cannot show it; `--scope` does not apply there.

The key is saved in `~/.config/zenavo/config.json` (or `$ZENAVO_CONFIG`) with mode `0600`, and is sent only to the console it was created for. `auth logout` forgets it locally; delete it under **API Keys** to revoke it.

## CI and scripts

Set `ZENAVO_TOKEN` to an API key (and `ZENAVO_API_URL` when it is not `https://zenavo.app`) instead of signing in, and pass `-i=false` so no command prompts. `--json` prints JSON on stdout for `jq`; progress goes to stderr. A followed job that fails exits with status 1.

```sh
export ZENAVO_TOKEN=zv_pat_…
zenavo deploy web -p blog -i=false
```

## Context

`zenavo team switch` and `zenavo context set project|service` save the team, project and service that later commands use. `--team` (or `--workspace`), `--project`/`-p` and `--service`/`-s` override them for one command. Without a saved or given project or service, the CLI uses the only one, asks when it can, and otherwise says what to pass.

## Quick tour

```sh
zenavo team ls                                # your teams; * marks the current one
zenavo team switch acme
zenavo project create blog --git https://github.com/acme/blog
zenavo service add --database postgresql     # a database with a volume and a generated password
zenavo env set PORT=3000 DATABASE_PASSWORD    # a bare KEY asks for the value without echo
zenavo service restart web                    # applies changed variables without a rebuild
zenavo deploy                                 # every service; follows the build log
zenavo deploy web                             # one service; the others stay as deployed
zenavo service ls                             # state, readiness, restarts, CPU and memory
zenavo logs web -f                            # live runtime logs
zenavo logs --build                           # the latest build and deploy log
zenavo domain add blog                        # blog.zenavo.app, or a full domain of your own
zenavo rollback                               # pick an earlier successful deployment
zenavo template deploy -f zeabur.yaml --var DOMAIN=blog
```

## Add a service {#add-a-service}

`zenavo service add [name]` adds a service to the project, as **Add Service** in the console does, and `--deploy` deploys it right away. The name defaults to one from the source; other services reach it at `<hostname>.zenavo.internal`.

```sh
zenavo service add --database postgresql:17
zenavo service add api --git https://github.com/acme/api --branch main --root /services/api
zenavo service add search --image elasticsearch:9.3.3 --port 9200/http \
  --volume /usr/share/elasticsearch/data --env ES_JAVA_OPTS="-Xms2g -Xmx2g" \
  --secret ELASTIC_PASSWORD --deploy
```

- `--image`: the ports the image declares are used unless you pass `--port port[/http|tcp|udp]`.
- `--git`: `owner/repo` means GitHub. Without `--branch` the default branch is used, and the port comes from the [build plan](https://docs.zenavo.app/deploy/build-plan). `--root` and `--dockerfile` are as in the console.
- `--database`: `postgresql`, `mysql`, `mariadb`, `mongodb`, `redis` or `valkey`, with `:version` if you want one. It comes with a volume, a generated password, a health check and variables the other services can use, such as `${POSTGRESQL_HOST}`.
- `--volume [id:]path`, `--env KEY=value`, `--env-file .env` (all but `--env-file` repeatable).
- `--secret KEY` sets `KEY` to a password Zenavo generates when it saves the service, so the value never passes through your terminal, shell history or CI logs. All `--secret` keys of one service share that password. Read it in the console or with `zenavo env ls -s <service> --reveal`.
- `--icon key` sets the service's [icon](https://docs.zenavo.app/deploy/service-settings#name-hostname-and-id) in the console; without it, the icon is inferred from the image, or for `--git` from the build plan. `zenavo service icon --list` lists the keys, and `zenavo service icon <key|auto> -s <service>` changes it later.

## Commands

| Command | What it does |
|---|---|
| `auth login \| logout \| status` | Sign in through the browser or with an API key; forget the key; show who you are |
| `team ls \| current \| switch \| clear` | Teams (alias `workspace`). Switching clears the saved project and service |
| `context show \| set project \| set service \| clear` | The defaults later commands use |
| `server ls \| get` | The team's servers. Add servers in the console |
| `project ls \| get \| create \| delete` | Projects. `create --git <url>` or `--image <image>` adds a first service; `delete` asks you to type the name |
| `service ls \| add \| icon \| deploy \| restart \| suspend \| resume \| exec` | Services. `add` adds one from `--image`, `--git` or `--database` ([below](#add-a-service)); `icon` shows or sets the console icon (`--list` for the keys, `auto` to infer it again); `exec -- <command>` runs in the container with `sh -c`, for up to 60 seconds |
| `deploy [service] [--dir <path>]` | Deploy the project or one service and follow the build. `--dir` uploads a [local directory](https://docs.zenavo.app/deploy/local-directory) as the service's source, creating the service if needed. `--detach` returns at once |
| `logs [service] [-f] [--build]` | The last 200 runtime log lines, streamed with `-f`; `--build` prints the latest build log |
| `shell [service]` | An interactive [terminal](https://docs.zenavo.app/operations/terminal) (bash or sh) in the service's container; exits with the shell's status |
| `job ls \| get \| log \| wait` | Jobs: deploys, restarts, backups (alias `deployment`) |
| `rollback [job-id]` | Roll the project back to an earlier successful deployment |
| `env ls \| set \| unset` | Variables of a service. Values stay hidden unless `--reveal`; `set --file .env`; `--deploy` deploys after saving |
| `domain ls \| add \| rm` | A name without dots (`blog`) gets a generated domain; a full name is your own domain |
| `template deploy -f <file>` | Create a project from a Zeabur template (YAML) or a Zenavo export (JSON); `--var KEY=value`, `--deploy` |
| `backup ls \| create` | Backups. `create --engine postgres\|mysql\|volume:<id>`. Download and restore them in the console |
| `version` | The CLI's version |

Every command takes `--help`. Global flags: `--team` (`--workspace`), `--project`/`-p`, `--service`/`-s`, `--json`, `--yes`/`-y`, `-i=false` and `--api`.

## Not in the CLI yet

Adding and setting up servers, team management, the GitHub App, and downloading or restoring backups are done in the console.
