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
| Flag | Description | Default |
|---|---|---|
--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 URL | Random |
--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 override | Auto-detected |
--exec <command> | Custom startup command | — |
--port <number> | Container port to expose | Auto-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 ubuntu | alphanumeric |
--to <subdomain> | Update existing environment with new code | — |
-o <format> | Output format: url or json | Pretty |
-e, --env KEY=VALUE | Set environment variable (repeatable) | — |
--env-file <path> | Path to env file (auto-detects .env) | Auto |
--logs | Stream logs after environment is running | false |
Examples
Deploy current directory:
prev create .Deploy with custom subdomain, label, and extended TTL:
prev create . --subdomain my-demo --label "client-review" --ttl 7dDeploy from GitHub:
prev create --source github.com/user/repoDeploy a Docker image:
prev create --image nginx:latest --port 80Deploy with password protection:
prev create . --credentials admin:secret123Deploy to EU region with IP restriction (Teams plan):
prev create . --region eu --ip-allow 10.0.0.0/8Use a saved deployment template (Teams plan):
prev create . --template stagingUpdate an existing environment with new code (same URL):
prev create --to my-demo .Deploy with a memorable subdomain (Ubuntu-style naming):
prev create . --naming ubuntuThis 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-abc123Deploy with an env file:
prev create . --env-file .env.stagingDeploy and stream logs immediately:
prev create --logs .Output only the URL (useful for scripts):
prev create . -o url
Supported Source Types
| Source | Example |
|---|---|
| Local directory | prev create . |
| GitHub | prev create --source github.com/user/repo |
| Git URL | prev create --source https://git.example.com/repo.git |
| FTP | prev create --source ftp://files.example.com/project |
| SSH | prev create --source ssh://git@github.com/user/repo |
| Docker image | prev 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
| Flag | Description | Default |
|---|---|---|
-f, --follow | Stream logs in real-time | false |
--type | Log type: stdout or stderr | stdout |
--tail | Bytes to show from end of log | 50000 |
--region | Region (auto-detected from URL) | Auto |
Examples
Show recent logs:
prev logs m5qr8pc2.us.prev.shStream logs in real-time:
prev logs --follow m5qr8pc2.us.prev.shShow 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
| Flag | Description | Default |
|---|---|---|
--port | Port to run the dashboard on | Random |
--no-open | Don't auto-open browser | false |
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 uiStart 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 allWhen 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:
| Flag | Description | Default |
|---|---|---|
--api-key <key> | API key for authentication | From env/config |
--api-url <url> | API endpoint URL | https://api.prev.sh |
--config <path> | Path to config file | Auto-discovered |
-h, --help | Show help | — |
-v, --version | Show CLI version | — |