NextDeploy CLI Complete Commands Reference: Workflow, Flags & Wire Protocols
The authoritative reference for every NextDeploy CLI command: init, prepare, build, ship, rollback, status, secrets, logs, creds, inspect, plan, and destroy.
The NextDeploy CLI (nextdeploy) is a compiled, single-binary deployment toolkit written in Go using the Cobra framework. It provides a deterministic, infrastructure-agnostic interface for deploying Next.js 15+ App Router applications across two target primitives: Linux VPS (systemd + Caddy + in-process Go sidecar) and Serverless Edges (Cloudflare Workers or AWS Lambda).
One declarative CLI. Zero Dockerfiles. Zero vendor lock-in. Reversible, release-pinned operations from init to destroy.
Global Architecture & Command Taxonomy
Commands in NextDeploy adhere to strict invariants: they are idempotent, report granular diagnostic phases, enforce cryptographic authentication over Unix sockets, and fail-closed prior to state mutations.
1. Lifecycle & Release Pipeline
nextdeploy init
Scaffolds the minimal nextdeploy.yml manifest at your repository root. Inspects package.json to verify the next dependency and seed app name and version:
nextdeploy initnextdeploy prepare
Provisions fresh Linux VPS target(s) with runtime dependencies, security hardening, and the nextdeployd control plane. Default mode is agent mode: downloads the latest static nextdeployd binary directly to the server, eliminating Python and Ansible prerequisites on the local machine:
1# Provision default server in agent mode
2nextdeploy prepare
3
4# Provision all configured servers in parallel
5nextdeploy prepare --all
6
7# Provision a specific server by name
8nextdeploy prepare --server production-01
9
10# Advanced flags
11nextdeploy prepare --skip-runtimes # Skip Node.js 22 / Corepack installation
12nextdeploy prepare --skip-hardening # Skip Fail2Ban jails and logrotate
13nextdeploy prepare --allow-root # Allow provisioning over root SSH session
14nextdeploy prepare --timeout 15m # Custom SSH provisioning timeout (default: 10m)nextdeploy build
Executes the buildflow.Run pipeline. Inspects your Next.js application, generates deployment metadata, and packages the deployable release tarball:
1# Incremental build (skips next build if git commit and config hash match)
2nextdeploy build
3
4# Force full rebuild ignoring cache locks
5nextdeploy build --forcenextdeploy ship (alias: deploy)
Uploads the packaged build and triggers release activation on the target environment:
1# Ship to default production target
2nextdeploy ship
3
4# Ship with forced rebuild
5nextdeploy ship --force
6
7# Ship to isolated named environment
8nextdeploy ship -e staging
9
10# Verbose execution trace
11nextdeploy ship -v2. Day-2 Operations & Observability
nextdeploy status
Queries the live state of the application across configured target servers or cloud providers:
nextdeploy statusnextdeploy logs
Streams live production logs directly to your local terminal over SSH using journalctl without requiring third-party log forwarders:
1# Stream application logs (journalctl -u nextdeploy-<app>-<release> -f -n 50)
2nextdeploy logs
3
4# Filter logs by specific route regex pattern
5nextdeploy logs --route /api/checkout
6
7# Inspect daemon audit log (who ran what command and HMAC status)
8nextdeploy logs --audit
9
10# Inspect daemon system log
11nextdeploy logs --daemon
12
13# Stream app, daemon, and audit streams concurrently
14nextdeploy logs --allnextdeploy rollback
Instantly points live traffic to a previously deployed release without rebuilding or re-uploading:
1# Revert one release step backwards
2nextdeploy rollback
3
4# Revert N releases backwards (up to 5 retained releases)
5nextdeploy rollback --steps 2
6
7# Roll back to a specific git commit SHA (full or short SHA)
8nextdeploy rollback --to 7c8350a03. Secrets & Credentials Management
nextdeploy secrets
Manages production environment variables stored securely on the VPS at /opt/nextdeploy/secrets/<app>.json (0600 root only):
1# Set one or more secrets
2nextdeploy secrets set DATABASE_URL=postgres://user:pass@host:5432/db
3nextdeploy secrets set STRIPE_KEY=sk_live_... REDIS_URL=redis://...
4
5# Retrieve a single secret in plaintext
6nextdeploy secrets get DATABASE_URL
7
8# List all secret keys (values masked)
9nextdeploy secrets list
10
11# Delete a secret
12nextdeploy secrets unset STRIPE_KEY
13
14# Bulk load environment variables from a local file
15nextdeploy secrets load .env.productionnextdeploy creds
Manages encrypted cloud provider credentials stored locally at ~/.nextdeploy/credstore (mode 0600):
1# Interactively save provider credentials
2nextdeploy creds set --provider cloudflare
3nextdeploy creds set --provider aws
4
5# Inspect configured providers without revealing keys
6nextdeploy creds list
7
8# Clear provider credentials from local disk
9nextdeploy creds clear --provider aws4. Inspection, Infrastructure Diffing & Teardown
nextdeploy inspect
Performs a deep size audit of the .next/standalone bundle without side effects, identifying package offenders against the 250MB threshold:
nextdeploy inspectnextdeploy plan & apply (Cloudflare)
Terraform-style dry-run for declarative Cloudflare resources declared under serverless.cloudflare.resources (R2 buckets, D1 databases, KV namespaces):
1# Preview planned resource creations, updates, and drift
2nextdeploy plan
3
4# Apply infrastructure changes
5nextdeploy applynextdeploy generate-ci
Emits an opinionated, production-ready GitHub Actions workflow file to .github/workflows/nextdeploy.yml that automates build and ship on push to main:
1# Generate GitHub Actions CI/CD workflow
2nextdeploy generate-ci
3
4# Generate workflow for a specific named environment
5nextdeploy generate-ci --environment productionnextdeploy upgrade-daemon (alias: update-daemon)
Pushes the latest nextdeployd binary to all configured VPS servers and restarts the systemd service non-destructively:
nextdeploy upgrade-daemonnextdeploy destroy
Permanently removes the application and all associated cloud/server resources:
1# Interactive teardown (prompts for app slug confirmation)
2nextdeploy destroy
3
4# Force destroy overriding deletion_protection
5nextdeploy destroy --force
6
7# Non-interactive confirmation for CI/CD pipelines
8nextdeploy destroy --yesDisciplined CLI primitives enable autonomous infrastructure. Every command provides full visibility, deterministic outputs, and zero vendor lock-in.