# nesly CLI

Every command, its flags and what it prints.

## Account

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly login</td><td class="py-2">Sign in with the device flow and store the token.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly whoami</td><td class="py-2">Show the signed-in account and which API is in use.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly logout</td><td class="py-2">Remove the stored credentials from this machine.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly token create &lt;name&gt;</td><td class="py-2">Create an access token for CI (shown once).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly token list</td><td class="py-2">List your access tokens and when they were last used.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly token revoke &lt;id&gt;</td><td class="py-2">Revoke a token immediately.</td></tr></tbody></table>

## Projects

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly new [template] [dir]</td><td class="py-2">Start from a template (no argument lists the gallery).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly project create &lt;name&gt;</td><td class="py-2">Create a project and print its address.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly project list</td><td class="py-2">List your projects.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly project delete &lt;name&gt; --yes</td><td class="py-2">Delete a project, its deployments and its addons.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly link &lt;project&gt;</td><td class="py-2">Link this directory to a project (writes .nesly/project.json).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly open</td><td class="py-2">Open the project's URL in your browser.</td></tr></tbody></table>

## Deploying

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly deploy</td><td class="py-2">Build and publish the current directory; prints the live URL.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly deploy --yes</td><td class="py-2">Same, creating and linking the project if it does not exist.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly ls</td><td class="py-2">List deployments, newest first, with their ids.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly inspect &lt;deployment-id&gt;</td><td class="py-2">Status, tier, failure reason and URLs for one deployment.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly rollback &lt;deployment-id&gt;</td><td class="py-2">Repoint traffic at a previous deployment, instantly.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly logs --follow</td><td class="py-2">Stream build and runtime output.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly diagnose</td><td class="py-2">Explain a failed deployment: evidence, missing env vars, the fix.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly mcp</td><td class="py-2">Serve the platform as MCP tools on stdio, for AI agents.</td></tr></tbody></table>

## Builds

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly init</td><td class="py-2">Detect the framework here and write nesly.toml.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly build show</td><td class="py-2">Show the build settings and what this directory would build.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly build set --output dist</td><td class="py-2">Change a build setting (root, install, command, output, start).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly build clear [field...]</td><td class="py-2">Hand a setting back to nesly.toml and detection.</td></tr></tbody></table>

## Configuration

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly env set KEY=VALUE</td><td class="py-2">Set variables; they apply to the next deployment.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly env ls [--reveal]</td><td class="py-2">List variables; values are hidden unless --reveal.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly env rm KEY</td><td class="py-2">Remove a variable.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly addon add postgres</td><td class="py-2">Attach a managed PostgreSQL database (injects DATABASE_URL).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly addon add mssql</td><td class="py-2">Attach a managed SQL Server database (also injects ConnectionStrings__Default for .NET).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly addon ls</td><td class="py-2">List attached addons.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly addon rm postgres --yes</td><td class="py-2">Detach an addon.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly backup create</td><td class="py-2">Copy the project's database now (nightly copies happen anyway).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly backup ls</td><td class="py-2">List backups, newest first, with sizes.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly backup restore &lt;id&gt; --yes</td><td class="py-2">Replace the database's contents with that copy.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly backup download &lt;id&gt;</td><td class="py-2">Download the archive; pg_restore reads it anywhere.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly run -- &lt;cmd&gt;</td><td class="py-2">Run a command in the deployed image; exits with its exit code.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly domain add &lt;fqdn&gt;</td><td class="py-2">Add a custom domain (root domains get A records) and print what to create.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly domain verify &lt;fqdn&gt;</td><td class="py-2">Check the DNS records and activate the domain.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly domain ls</td><td class="py-2">List domains and their status.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly usage</td><td class="py-2">Requests, egress and build time for the last 30 days.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly limits</td><td class="py-2">What your plan allows and how much of it you have used.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly account export</td><td class="py-2">Download everything the platform holds about your account.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly account notifications ls</td><td class="py-2">The messages we sent you, and whether they arrived.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly account notifications set</td><td class="py-2">Choose which messages reach you, and in which language.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">nesly account close --confirm &lt;email&gt; --yes</td><td class="py-2">Close the account and destroy everything in it.</td></tr></tbody></table>

## Flags on every command

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">--project &lt;name&gt;</td><td class="py-2">Act on this project instead of the linked one.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">--dir &lt;path&gt;</td><td class="py-2">Use another directory as the project root (default: .).</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">--json</td><td class="py-2">Print exactly one JSON object on stdout — for scripts and agents.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">--yes</td><td class="py-2">Confirm destructive actions and create a missing project.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">--api &lt;host:port&gt;</td><td class="py-2">Point at another platform (or set NESLY_API).</td></tr></tbody></table>

## Environment variables

For CI: create a token with `nesly token create "github actions"`, store it as a secret, and the pipeline deploys as you — with your role in the team. Leave the team and the token stops working.

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">NESLY_TOKEN</td><td class="py-2">An access token. Set it in CI and every command uses it — no browser sign-in.</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">NESLY_API</td><td class="py-2">The platform API address, when it is not the default.</td></tr></tbody></table>

## Exit codes

Stable, so scripts can branch on them. Errors go to stderr; results go to stdout.

<table class="w-full border-collapse text-sm"><tbody><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">0</td><td class="py-2">success</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">1</td><td class="py-2">error</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">2</td><td class="py-2">usage error</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">3</td><td class="py-2">not signed in, or not allowed</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">4</td><td class="py-2">not found</td></tr><tr class="border-b border-neutral-200 align-top dark:border-neutral-800"><td class="whitespace-nowrap py-2 pr-6 font-mono text-[13px] text-neutral-900 dark:text-neutral-100">5</td><td class="py-2">conflict (already exists, wrong state)</td></tr></tbody></table>

## Scripting and agents

With `--json` every command prints one object on stdout and nothing else; progress and logs stay on stderr. That, plus the exit codes above, is the whole contract — no output parsing required.

```
nesly deploy --json | jq -r .url
```

---
Canonical: https://nesly.net/docs/cli/
Every docs page has this markdown twin: replace the trailing slash with .md
