Complete reference for all prev CLI commands.

prev create

Create a new preview environment from local code, a remote source, or a Docker image.

Usage

prev create [path] [flags]

Arguments

  • path — Directory containing your project (default: current directory)

Flags

FlagDescriptionDefault
--path <dir>Project directory (alternative to positional arg).
--source <url>Deploy from a remote source URL
--image <name>Deploy a Docker image directly
--subdomain <name>Custom subdomain for the preview URLRandom
--domain <domain>Use a registered custom domain
--label <text>Label for the environment (e.g., "frontend-redesign")
--ttl <duration>Time-to-live (e.g., 1h, 24h, 7d)24h
--type <type>Project type overrideAuto-detected
--exec <command>Custom startup command
--port <number>Container port to exposeAuto-detected
--credentials <user:pass>HTTP Basic Auth protection
--region <code>Deploy region (us, eu, apac, latam)us
--ip-allow <cidr>IP allowlist in CIDR notation
--template <name>Use a saved deployment template
--naming <style>Subdomain naming style: alphanumeric or ubuntualphanumeric
--to <subdomain>Update existing environment with new code
-o <format>Output format: url or jsonPretty
-e, --env KEY=VALUESet environment variable (repeatable)
--env-file <path>Path to env file (auto-detects .env)Auto
--logsStream logs after environment is runningfalse

Examples

Deploy current directory:

prev create .

Deploy with custom subdomain, label, and extended TTL:

prev create . --subdomain my-demo --label "client-review" --ttl 7d

Deploy from GitHub:

prev create --source github.com/user/repo

Deploy a Docker image:

prev create --image nginx:latest --port 80

Deploy with password protection:

prev create . --credentials admin:secret123

Deploy to EU region with IP restriction (Teams plan):

prev create . --region eu --ip-allow 10.0.0.0/8

Use a saved deployment template (Teams plan):

prev create . --template staging

Update an existing environment with new code (same URL):

prev create --to my-demo .

Deploy with a memorable subdomain (Ubuntu-style naming):

prev create . --naming ubuntu

This generates adjective-animal subdomains like cosmic-falcon.us.prev.sh or arctic-penguin.eu.prev.sh instead of the default random alphanumeric style.

Deploy with environment variables:

prev create . -e NODE_ENV=production -e API_KEY=sk-abc123

Deploy with an env file:

prev create . --env-file .env.staging

Deploy and stream logs immediately:

prev create --logs .

Output only the URL (useful for scripts):

prev create . -o url

Supported Source Types

SourceExample
Local directoryprev create .
GitHubprev create --source github.com/user/repo
Git URLprev create --source https://git.example.com/repo.git
FTPprev create --source ftp://files.example.com/project
SSHprev create --source ssh://git@github.com/user/repo
Docker imageprev create --image nginx:latest

prev list

List all active preview environments.

Usage

prev list

Output

Displays a table of all your active environments including:

  • Environment ID
  • URL
  • Status (running, starting, creating, failed)
  • Region
  • Time remaining
  • Usage progress (current / max environments)

prev env

Show detailed information about a specific environment.

Usage

prev env <environment-id>

Output

  • Environment ID
  • Full URL
  • Status
  • TTL duration
  • Created date and time
  • Expiration date and time with remaining time

prev logs

Display logs from a running preview environment.

Usage

prev logs <url-or-id> [flags]

Flags

FlagDescriptionDefault
-f, --followStream logs in real-timefalse
--typeLog type: stdout or stderrstdout
--tailBytes to show from end of log50000
--regionRegion (auto-detected from URL)Auto

Examples

Show recent logs:

prev logs m5qr8pc2.us.prev.sh

Stream logs in real-time:

prev logs --follow m5qr8pc2.us.prev.sh

Show stderr only:

prev logs --type stderr cosmic-falcon.eu.prev.sh

prev ui

Start a local web-based mini-dashboard to view and manage your preview environments. No authentication required — uses your CLI API key.

Usage

prev ui [flags]

Flags

FlagDescriptionDefault
--portPort to run the dashboard onRandom
--no-openDon't auto-open browserfalse

Features

  • Environment List — All active environments across all regions with status, URL, and TTL countdown
  • Live Logs — Real-time log streaming with stdout/stderr toggle and auto-scroll
  • Stats — CPU and memory usage per environment (auto-refreshes every 5 seconds)
  • Destroy — Delete environments directly from the UI

Examples

Start the mini-dashboard:

prev ui

Start on a specific port without opening the browser:

prev ui --port 3001 --no-open

prev destroy

Destroy one or all preview environments.

Usage

Destroy a specific environment:

prev destroy <environment-id>

Destroy all environments (with confirmation):

prev destroy all

When using destroy all, the CLI will ask for confirmation before proceeding.


prev subscription

Display your current subscription plan and status.

Usage

prev subscription

Output

  • Email address
  • Current plan name
  • Subscription status (active, trialing, canceled)

Global Options

These flags can be used with any command:

FlagDescriptionDefault
--api-key <key>API key for authenticationFrom env/config
--api-url <url>API endpoint URLhttps://api.prev.sh
--config <path>Path to config fileAuto-discovered
-h, --helpShow help
-v, --versionShow CLI version