# Command line (ee-cdn-cli)

> Publish any folder of static files to Evolving Edge from your computer or from CI with the ee-cdn-cli package: the ee-deploy and ee-domain commands, options, deploy tokens and GitHub Actions.

Source: https://docs.evolvingedge.ai/cli/

`@evolving-edge/ee-cdn-cli` is an npm package with three commands: `ee-deploy` publishes a folder of static files as a workload, `ee-domain` claims a [custom domain](https://docs.evolvingedge.ai/custom-domains/) for your project, and `ee-migrate` translates a Netlify site's `netlify.toml` into the files Evolving Edge reads and a GitHub Actions workflow that builds and deploys it (see [Moving from Netlify](https://docs.evolvingedge.ai/migrate-from-netlify/)). Use them from your own computer, or from CI every time you push.

It works with the output of any static site generator, and with hand-written HTML.

Using an AI coding agent? Give it [ee-cdn-cli for AI agents](https://docs.evolvingedge.ai/cli-for-agents/), written for agents, at `https://docs.evolvingedge.ai/cli-for-agents.md`.

## Before you begin

You need:

- **Node.js 22.12 or later.**
- **Windows (x64), macOS or Linux (x64 or arm64).**
- **A deploy token** from the portal, under **Workload → Deploy Tokens**. See [Deploy tokens](#deploy-tokens).
- **Your project ID** (it starts `proj_`), if your token is scoped to one project.
- **A domain** the network serves your site on. It must be claimed for your project and active before you deploy to it. See [Custom domains](https://docs.evolvingedge.ai/custom-domains/).

## Your first deploy

Build your site, then run `ee-deploy` in your project folder. With `npx` there's nothing to install:

```sh
export EE_CDN_TOKEN=<your deploy token>
npx @evolving-edge/ee-cdn-cli --domain www.example.com --project proj_abc123
```

`ee-deploy` finds your generator's output folder and says what it chose, for example `Deploying ./dist (detected: Astro)`. To name the folder yourself, put it first: `npx @evolving-edge/ee-cdn-cli ./public --domain www.example.com`.

To check the folder packages correctly without publishing anything, add `--dry-run`.

A new deploy takes up to about 90 seconds to reach every node.

### Installing it in a project

To pin a version for a project, add it as a dev dependency and call `ee-deploy` from a script:

```sh
npm install -D @evolving-edge/ee-cdn-cli
```

```json
{
  "scripts": {
    "deploy": "ee-deploy --domain www.example.com"
  }
}
```

## Usage

```
ee-deploy [directory] --domain <host> [options]
```

| Argument | What it is |
|---|---|
| `[directory]` | The built site to publish. Optional: see [Finding the output folder](#finding-the-output-folder). |
| `--domain`, `-d <host>` | The hostname the network serves this workload on. Required. |

### Finding the output folder

Without a directory, `ee-deploy` works out the output folder from your project's dependencies or your generator's config file. It recognises Astro, Next.js (static export), Nuxt, SvelteKit, Docusaurus, VitePress, Gatsby, Hexo, Eleventy, Hugo, Jekyll, MkDocs, mdBook, Sphinx, Zola and Vite.

It never guesses. If it finds no generator, finds two, or the folder has no `index.html`, it stops and asks you to name the directory.

### Options

| Option | What it does |
|---|---|
| `--project <id>` | Project ID (`proj_…`). Required if your token is scoped to a project. |
| `--name <name>` | Workload name. Defaults to the domain. |
| `--level <0\|1\|2>` | Encryption level. Defaults to `0`, a public site. See [encryption levels](https://docs.evolvingedge.ai/workloads/#encryption-levels-in-depth). |
| `--key <key>` | Level 1 only: the key from this content's first deploy, so a redeploy or rollback can use what's already stored. Defaults to `$EE_CDN_LEVEL1_KEY`. See [Redeploys and rollbacks](#redeploys-and-rollbacks). |
| `--token <token>` | Deploy token. Defaults to `$EE_CDN_TOKEN`. Prefer the environment variable, so the token stays out of your shell history. |
| `--build <id>` | Build configuration ID, to use settings saved in the portal. |
| `--org <id>` | Organisation ID. |
| `--trailing-slash` | Redirect `/about` to `/about/`. See [Routing](#routing-trailing-slashes-clean-urls-and-redirects). |
| `--clean-urls` | Serve `/about` from `about.html`. |
| `--images <webp\|avif\|off>` | Convert JPEG and PNG images to WebP or AVIF while packaging. See [Images](https://docs.evolvingedge.ai/image-conversion/#converting-to-webp-or-avif). |
| `--image-host <host>` | Another host the site is served from, so absolute addresses on it count as the site's own. Repeat for each host. |
| `--image-report <file>` | Write the image report as JSON. |
| `--image-max-width <px>` | Scale JPEG and PNG images wider than this down to it. Changes the deployed image files. See [Images](https://docs.evolvingedge.ai/image-conversion/#scaling-down-wide-images). |
| `--dry-run` | Package the folder but don't upload it. Leaves the packaged `.ee` file on disk. |
| `--quiet`, `-q` | Print errors only. |
| `--builder <path>` | Use a packaging tool already on disk instead of downloading one. |
| `--builder-version <v>` | Use one version of the packaging tool instead of the latest. Defaults to `$EE_BUILDER_VERSION`. |
| `--lockfile <path>` | Where to record the packaging tool's checksum. Defaults to `.ee-builder-lock.json`. |
| `--cache-dir <path>` | Where to keep the downloaded packaging tool. Defaults to `~/.cache/evolving-edge`. |
| `--version`, `-v` | Print the version. |
| `--help`, `-h` | Print every option. |

### Environment variables

| Variable | What it sets |
|---|---|
| `EE_CDN_TOKEN` | The deploy token. |
| `EE_CDN_PROJECT_ID` | The default for `--project`. |
| `EE_CDN_BUILD_ID` | The default for `--build`. |
| `EE_BUILDER_VERSION` | The default for `--builder-version`. |
| `EE_CDN_LEVEL1_KEY` | The default for `--key`. |

## Deploy tokens

Create a deploy token in the portal under **Workload → Deploy Tokens**.

- **Scope it to one project** where you can. A token for one project can't publish to another.
- **Grant `workload:write`** to deploy content, and `release:write` if you need it.
- **Revoke it at any time** from the portal. A revoked token stops working immediately.
- **Keep it out of your repository.** In CI, store it as a secret.

## Routing: trailing slashes, clean URLs and redirects

Pages are served at exactly the address that matches a file. `/about/` serves `about/index.html`, and `/about` is a 404 unless you say otherwise.

There are two settings, and two ways to turn each one on:

| Setting | Flag | Line in `_redirects` |
|---|---|---|
| Redirect `/about` to `/about/` | `--trailing-slash` | `# ee:trailing-slash on` |
| Serve `/about` from `about.html` | `--clean-urls` | `# ee:clean-urls on` |

A flag writes its line into the [`_redirects`](https://docs.evolvingedge.ai/redirects/) file in your output folder, creating the file if there isn't one, so the setting travels with the deploy. If your own `_redirects` already sets one, including to `off`, your file wins.

[Static Site Generators](https://docs.evolvingedge.ai/static-sites/) says which one your generator needs.

`ee-deploy` checks your `_redirects` and [`_headers`](https://docs.evolvingedge.ai/headers/) files while packaging. It stops if a redirect rule can't work, and prints a warning for each header rule it has to drop.

## Size limit

A deploy's package can be up to **1 GiB**, after compression. `ee-deploy` (0.5.0 or later), the Astro integration and the GitHub Action check the size before uploading anything, and stop with a message if the package is over the limit. They read the current limit from `https://cp.3dge.app/api/limits` (`packageMaxBytes`), so it never needs to be hard-coded in your scripts. A package uploaded another way that is over the limit is refused with `413`.

- **Photos and video take most of the room.** They're already compressed, so they count at about their full size. [Images](https://docs.evolvingedge.ai/image-conversion/) can convert and scale photos down while packaging.
- **Keep any single file under 256 MB.** A larger file is served only in ranges, which is how video players ask for it, and not in one piece.
- **Deploys from the portal** have the same 1 GiB limit. The portal checks the size from your file list before it packages anything. A site with hundreds of large photos takes several minutes to package there.

Older versions of `ee-deploy` stop at 100 MiB. Update with `npx @evolving-edge/ee-cdn-cli@latest`, or raise the version you pin.

## Redeploys and rollbacks

When everything in a deploy is already stored for your project at the same level, `ee-deploy` sends nothing: it says `Already stored … nothing uploaded` and points your domain at what's stored. That makes redeploying unchanged content, and rolling back to an earlier build, quick, however large the site.

When only some of it has changed, a **Level 0** redeploy (0.7.0 or later) uploads only the parts your domain's current content doesn't already have. Every file of 64 KiB or more is packaged in blocks of its own, so changing a few files sends a few blocks: `ee-deploy` says `Uploaded 0.10 MB of 4.60 MB (the rest is already in the domain's current package)`. There's nothing to turn on.

- **The first deploy after you upgrade** uploads the whole package once, because the package layout changed.
- **It needs a packaging tool published on or after 2026-11-19.** If you pin an older one with `--builder-version` or `EE_BUILDER_VERSION`, deploys keep uploading whole packages.
- **If it can't be used,** `ee-deploy` uploads the whole package instead and says so. The deploy still succeeds.
- **Levels 1 and 2** upload the whole package, or nothing when it's already stored.

- **Level 0 and Level 2** need nothing extra.
- **Level 1** needs the key from that content's first deploy, so the browser can still open what's stored: pass it with `--key` or `EE_CDN_LEVEL1_KEY`. The Astro integration keeps it for you. Without it, `ee-deploy` stops and says so rather than replacing the key.
- **The same content at a different level** is refused, and nothing changes: deploy it at the level it was stored at, or change the content.

## Deploying from GitHub Actions

Store the token as a repository secret named `EE_CDN_TOKEN`, and the project ID as a repository variable named `EE_CDN_PROJECT_ID`. Then:

```yaml
name: Deploy

on:
  push:
    branches: [main]

concurrency:
  # Never let two deploys race to repoint the same domain.
  group: deploy
  cancel-in-progress: false

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: npm
      - run: npm ci
      - run: npm run build
      - name: Publish
        env:
          EE_CDN_TOKEN: ${{ secrets.EE_CDN_TOKEN }}
          EE_CDN_PROJECT_ID: ${{ vars.EE_CDN_PROJECT_ID }}
        run: npx --yes @evolving-edge/ee-cdn-cli --domain www.example.com
```

Any CI system works the same way: install Node.js, build, set the two variables, and run the command.

### The GitHub Action

For a site whose build doesn't use Node.js (Hugo, Jekyll, Zola, Pelican, MkDocs, mdBook and others), use the GitHub Action instead: [Deploy to Evolving Edge CDN](https://github.com/marketplace/actions/deploy-to-evolving-edge-cdn) on GitHub Marketplace. It brings its own Node.js, so the workflow needs no `setup-node` step:

```yaml
      - uses: actions/checkout@v4
      - run: hugo --minify
      - uses: evolving-edge/deploy-action@v1.0.2
        with:
          directory: public
          domain: www.example.com
          project: ${{ vars.EE_CDN_PROJECT_ID }}
          token: ${{ secrets.EE_CDN_TOKEN }}
          builder-version: '<version>'
```

This step receives your deploy token and publishes to your domain, and the [packaging tool](#the-packaging-tool-and-its-lockfile) it downloads runs with that token too. To control when either changes, pin both:

- **`builder-version`:** the packaging tool's version. Without it, each run downloads the latest release.
- **The Action,** by one of:
  - **a commit SHA** (`@<sha> # v1.0.2`), the only reference that can't change;
  - **an exact tag** such as `@v1.0.2`, which names one release, but a tag can be moved;
  - **`@v1`**, which picks up every 1.x release automatically, including the version of `@evolving-edge/ee-cdn-cli` each release runs, without you reviewing it.

  Never use `@main`.

Each release's [notes](https://github.com/evolving-edge/deploy-action/releases) name the version of `@evolving-edge/ee-cdn-cli` it runs.

Workflows that use the Action from its earlier home, `evolving-edge/ee-cdn-cli@v0.4.0`, keep working. It takes the same inputs, so change the `uses:` line to move.

| Input | What it does |
|---|---|
| `domain` | The hostname to publish to. Required. |
| `token` | The deploy token. Pass it from a secret. |
| `project` | The project ID. Required if the token is scoped to a project. |
| `directory` | The folder to publish. If you leave it out, the Action finds it, as `ee-deploy` does. |
| `working-directory` | Where the project is, if not at the root of the repository. |
| `level` | `0` or `2`. Level 1 is refused, because its key is made for each build and must reach only the browser. Deploy Level 1 sites from your own computer. |
| `name` | Workload name. Defaults to the domain. |
| `trailing-slash`, `clean-urls` | `true` to turn on the [routing settings](#routing-trailing-slashes-clean-urls-and-redirects). |
| `images`, `image-hosts`, `image-report`, `image-max-width` | The [image options](https://docs.evolvingedge.ai/image-conversion/). `image-hosts` takes several hosts separated by spaces, commas or new lines. |
| `builder-version` | Pin the packaging tool's version. |
| `dry-run` | `true` to package without publishing. Needs no token. |

The Action sets the output `url` to `https://<domain>` once the deploy is accepted. It publishes only: build the site, including any CSS step, in the steps before it.

### The packaging tool and its lockfile

`ee-deploy` downloads a small packaging tool the first time it runs, and caches it. It records the tool's checksum in `.ee-builder-lock.json` and refuses a later download that doesn't match.

- **Commit `.ee-builder-lock.json`,** so CI uses the same tool you tested with.
- **In CI, pin a version** with `--builder-version` or `EE_BUILDER_VERSION`. With the latest version and a committed lockfile, every new release of the tool stops your deploy with a checksum mismatch, on purpose, until you accept it.
- **If a deploy stops with a checksum mismatch,** a new version of the tool has been published. Check the [changelog](https://changelog.evolvingedge.ai/) for the release, then delete the lockfile, or update the checksum in it, and commit the change.

## Custom domains

`ee-domain` claims a domain for a project from the command line. It reads `EE_CDN_TOKEN` and `EE_CDN_PROJECT_ID`, as `ee-deploy` does.

```sh
npx -p @evolving-edge/ee-cdn-cli ee-domain claim www.example.com --project proj_abc123 --wait
```

It prints the TXT and CNAME records to add at your DNS provider. With `--wait`, it keeps checking until the domain is active or the claim fails. If the package is installed in your project, run `ee-domain` by name.

| Command | What it does |
|---|---|
| `ee-domain claim <domain>` | Claims the domain for your project and prints the two DNS records |
| `ee-domain status <domain>` | Shows where the claim stands, and the records while it's waiting for DNS |
| `ee-domain verify <domain>` | Checks for the TXT record now, without waiting for the next check |

| Option | What it does |
|---|---|
| `--project <id>` | The project the domain is for. Defaults to `$EE_CDN_PROJECT_ID` |
| `--wait` | Keep checking until the claim is active or fails |
| `--interval <seconds>` | Time between checks with `--wait`. Defaults to 30 |
| `--timeout <minutes>` | Stop waiting after this long. Defaults to 120 |
| `--json` | Print the response as JSON |

Use a deploy token scoped to the project. A token that isn't scoped to one project is refused, because it doesn't say which project the domain is for.

See [Custom domains](https://docs.evolvingedge.ai/custom-domains/) for what the records are, the statuses, and what to do if a claim fails.

## Astro

The same package includes an Astro integration that publishes at the end of `astro build`, so there's no separate deploy step:

```js
// astro.config.mjs
import { defineConfig } from 'astro/config';
import eeCdn from '@evolving-edge/ee-cdn-cli/astro';

export default defineConfig({
  site: 'https://www.example.com',
  trailingSlash: 'always',
  build: { format: 'directory' },
  integrations: [
    // Keep this last, so it packages what the other integrations write.
    eeCdn({ deploy: { domain: 'www.example.com', projectId: 'proj_abc123' } }),
  ],
});
```

The [image options](https://docs.evolvingedge.ai/image-conversion/) go in `deploy` too: `images`, `imageHosts`, `imageReport` and `imageMaxWidth`. For example, `deploy: { domain: 'www.example.com', images: 'webp', imageMaxWidth: 2560 }`.

Set `EE_CDN_TOKEN` as above. Both Astro settings are required: without them, pages are written and linked in a way the network doesn't serve. List `eeCdn` last in `integrations`, or files written by integrations after it, such as a sitemap, are left out of what's published.

## After a deploy

- **Allow up to about 90 seconds** for a new deploy to reach every node.
- **Every deploy is kept.** Each one is stored under its own content address and never changes, so going back to an earlier version means pointing your domain at it again. See [URLs and aliases](https://docs.evolvingedge.ai/workloads/#urls-and-aliases).

## Troubleshooting

| What you see | What to check |
|---|---|
| A page works with a trailing slash but not without | Pass `--trailing-slash`, or add `# ee:trailing-slash on` to [`_redirects`](https://docs.evolvingedge.ai/redirects/#add-a-trailing-slash). |
| `/about` is a 404 but `/about.html` works | Pass `--clean-urls`, or add `# ee:clean-urls on` to [`_redirects`](https://docs.evolvingedge.ai/redirects/#clean-urls). |
| The deploy is refused for your domain | Claim the domain for this project first. See [Custom domains](https://docs.evolvingedge.ai/custom-domains/). |
| It stops and asks for a directory | It couldn't tell which folder to publish. Name it: `ee-deploy ./dist --domain …`. |
| The deploy stops on a `_redirects` rule | The message names the line. See [Checking your file](https://docs.evolvingedge.ai/redirects/#checking-your-file). |
| It stops saying the packaging tool is too old to convert or resize images | The tool you pinned predates the option. See [Which version you need](https://docs.evolvingedge.ai/image-conversion/#which-version-you-need). |
| An image wasn't converted | The summary gives the reason, and `--image-report` lists every image. See [What's left as it is](https://docs.evolvingedge.ai/image-conversion/#whats-left-as-it-is). |
| A checksum mismatch for the packaging tool | See [The packaging tool and its lockfile](#the-packaging-tool-and-its-lockfile). |
| An authorisation error | Check `EE_CDN_TOKEN` is set, hasn't been revoked, and is scoped to the project you passed. |
| It stops saying the package is over the size limit | See [Size limit](#size-limit). With an older `ee-deploy` the limit is 100 MiB: update it. |
| A Level 1 redeploy stops and asks for the key | Pass the key from the first deploy with `--key` or `EE_CDN_LEVEL1_KEY`. See [Redeploys and rollbacks](#redeploys-and-rollbacks). |
| It doesn't run on your computer | Check Node.js is 22.12 or later, and that you're on Windows (x64), macOS, or Linux (x64 or arm64). |

## Other API access

There's no public API reference for other endpoints. If you need programmatic access beyond publishing workloads, [contact Customer Support](https://docs.evolvingedge.ai/customer-support/).

For Level 1 content in the browser, see the [Browser SDK](https://docs.evolvingedge.ai/workloads/#browser-sdk-level-1).

**Next:** [Static Site Generators >](https://docs.evolvingedge.ai/static-sites/)
