# Install the CLI

Install the pilvia CLI and sign in to a deploy plane.

The `pilvia` CLI is a single native binary, distributed through npm as
per-platform packages:

```sh
bun add -g @pilvia/cli
pilvia --version
```

(Any package manager works; we use [bun](https://bun.sh) throughout these
docs.)

Or, without a JavaScript toolchain, the signed installer from our own
download host (macOS and Linux):

```sh
curl -fsSL https://dl.pilvia.com/install.sh | sh
```

To update, `pilvia upgrade` replaces the binary with the newest release once
it has checked the release's signature (0.2.6 and later; `--check` only
says whether there is one). A copy installed through npm is updated through
npm, and the command says so:

```sh
bun add -g @pilvia/cli@latest
pilvia --version
```

## Sign in

> [!NOTE]
> **Early access**
>
> The hosted platform is in early access, and accounts are opened by
> arrangement. Write to [support@pilvia.com](mailto:support@pilvia.com) and
> tell us what you want to host. You get a [named token](/hosting/tokens.md)
> that may create apps and reaches only the apps it created. Sign in with it:
>
> ```sh
> pilvia app login --token pilvia_…
> ```
>
> Browser sign-in on the hosted platform is for our own organisation for now.

```sh
pilvia app login
```

On a deploy plane that takes browser logins, this opens your browser. You
sign in with your organisation's account, and the CLI catches the result on
a port on your own machine. The plane then gives you a
[named token](/hosting/tokens.md) for every app, labelled `login <machine>`
(0.2.6 and later). Logging in again replaces that token and revokes the old
one. `--no-browser` prints the address instead of opening it.

A deploy plane that takes no browser logins says so. Use a token from its
operator instead:

```sh
pilvia app login --token <your-token>
```

The control plane defaults to `https://deploy.pilvia.dev`. `--server` names
another, such as a self-hosted installation's. Credentials are stored in
`~/.config/pilvia/config.json` (mode `0600`). In CI, skip `login` and set
the `PILVIA_DEPLOY_TOKEN` environment variable instead. `--server` and
`--token` also exist as flags on every command.

## Where deploys go

A deployed app is served at `https://<name>.pilvia.app` on the shared
platform zone, plus any [custom domains](/hosting/custom-domains.md) its
manifest declares. Self-hosted installations use their own base domain; the
CLI's `--server` flag is the only thing that changes.
