# Deploys and releases

Content-addressed, differential, immutable — and safe to run from two laptops at once.

A deploy uploads a finished directory. The platform never builds your
project — `astro build`, `vite build`, whatever you use runs on your side,
and `pilvia app deploy` ships the result. That split keeps the deploy
client thin and your build exactly as portable as it was.

## Differential by content

The CLI hashes every file, sends the server the list (**plan**), uploads
only the blobs the server has never seen, then **commits** the release by
hash. Consequences you will notice:

- An unchanged redeploy moves **zero bytes**.
- A typical site edit moves a few files, whatever the total size of the
  site — deploys take seconds regardless of how large the site has grown.
- Releases share storage: each release only references content, it does not
  copy it. The store is per-app, so content addressing never leaks anything
  across apps.

A release is **immutable**: activation is atomic, and the previous release
stays exactly as it was.

```sh
pilvia app rollback my-site   # back to the previous release
```

## Safe against each other

A commit states which release it is **superseding**. If a colleague's
deploy landed between your plan and your commit, yours is refused instead
of silently overwriting theirs — you rerun the deploy against what is
actually live. Two laptops, or a laptop and CI, cannot trample each other.

## Git provenance

When the app directory sits in a git work tree, the deploy records the
commit, branch and dirty state it was built from, and `pilvia app list`
answers "which commit is production running". Deploying uncommitted work is
never forbidden — it is simply visible.

## The protocol is the product

The deploy endpoints — plan, blob upload, commit, status — are a versioned
public REST API, not a private CLI contract. `Authorization: Bearer` and
JSON; anything that can hash a file can deploy. The `pilvia` CLI is one
client of it; your own afternoon script can be another.

> [!NOTE]
> **Planned**
>
> - **`@pilvia/deploy`** — a zero-dependency npm shim for CI pipelines:
>   `PILVIA_TOKEN=… bunx @pilvia/deploy dist/ --app my-site`.
> - **Deploying by `git push`** — see [Git-push deploy](/hosting/git-push-deploy.md).

Every deploy is already addressable: the answer names a **build URL** that
serves exactly that release for as long as it is retained, and `--branch`
deploys a preview without touching production — see
[Preview URLs](/hosting/previews.md).
