# Ample: deploy an app from your agent

Ample puts the app in your working directory on a public URL. You don't need
the person you're working for to create an account or sign in first: you sign
up yourself, deploy, and give them a link that lets them keep the account.

## 1. Install the CLI

```sh
curl -fsSL https://get.ample.computer/install.sh | sh
```

Needs version 0.1.33 or later (`ample --version`); `ample update` upgrades it.
On Windows: `iwr -useb https://get.ample.computer/install.ps1 | iex`.

## 2. Sign up

```sh
ample auth whoami || ample auth signup
```

`ample auth signup` creates a free account and saves its login on this machine.
Tokens renew on their own. It never replaces a login that still works, so if
`ample auth whoami` succeeds, just use that account.

Keep the `claim_url` from the output for step 4.

## 3. Deploy

```sh
cd path/to/app
ample plan --write
ample up
```

- `ample plan --write` detects the services and databases the app needs. Exit
  code 2 means it has questions; each has a safe default. Answer them from the
  code with `ample plan --answer <path>=<value>`, then run it again.
- `ample up` builds, deploys and waits until the app is live, then prints its
  URL. Exit code 0 means live, 1 failed, 2 needs input. Run it once and read the
  result; don't run it again to check progress.
- On failure, read `ample logs <deployment_id> --kind build` (or
  `--kind runtime`), fix the cause, and run `ample up` again.

## 4. Hand over the account

Give the person the `claim_url`. They open it and sign in, and the account and
its apps become theirs. Unclaimed accounts are deleted after 48 hours.

If they didn't get the link: `ample auth claim --email person@example.com`
emails it to them.

## If something blocks you

- `tls_certificate_untrusted`: a proxy is inspecting TLS. Set `SSL_CERT_FILE`
  to a CA bundle that includes the proxy's CA certificate. Don't turn off
  certificate checks.
- `Not logged in`: run step 2.

## Without the CLI

Use the HTTP API at `https://api.ample.computer`:

1. `POST /v1/auth/signup` with `{"name":"my-agent","request_key":"<new UUID v4>"}`.
   Save the `request_key` first. If you lose the response, send the same
   request again within 10 minutes: you get the same account back, not a new one.
2. Send `Authorization: Bearer <access_token>` with every request.
3. Access tokens last 15 minutes. Get a new one with a form-encoded
   `POST /oauth/token`: `grant_type=client_credentials`, `client_id`,
   `client_secret` (from `credentials` in the signup response).

Reference:

- Every way to authenticate: https://ample.computer/auth.md
- OpenAPI description: https://ample.computer/openapi.json
- Remote MCP server (no install): https://api.ample.computer/mcp/setup
