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 |
|---|---|---|
| %%INLINECODE_1%% | Project directory (alternative to positional arg) | %%INLINECODE_2%% |
| %%INLINECODE_3%% | Deploy from a remote source URL | — |
| %%INLINECODE_4%% | Deploy a Docker image directly | — |
| %%INLINECODE_5%% | Custom subdomain for the preview URL | Random |
| %%INLINECODE_6%% | Use a registered custom domain | — |
| %%INLINECODE_7%% | Label for the environment (e.g., "frontend-redesign") | — |
| %%INLINECODE_8%% | Time-to-live (e.g., 1h, 24h, 7d) | 24h |
| %%INLINECODE_9%% | Project type override | Auto-detected |
| %%INLINECODE_10%% | Custom startup command | — |
| %%INLINECODE_11%% | Container port to expose | Auto-detected |
| %%INLINECODE_12%% | HTTP Basic Auth protection | — |
| %%INLINECODE_13%% | Deploy region (us, eu, apac, latam) | us |
| %%INLINECODE_14%% | IP allowlist in CIDR notation | — |
| %%INLINECODE_15%% | Use a saved deployment template | — |
| %%INLINECODE_16%% | Subdomain naming style: %%INLINECODE_17%% or %%INLINECODE_18%% | alphanumeric |
| %%INLINECODE_19%% | Update existing environment with new code | — |
| %%INLINECODE_20%% | Output format: url or json | Pretty |
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 (Business plan):
prev create . --region eu --ip-allow 10.0.0.0/8Use a saved deployment template (Business 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.
Output only the URL (useful for scripts):
prev create . -o url
Supported Source Types
| Source | Example |
|---|---|
| Local directory | %%INLINECODE_23%% |
| GitHub | %%INLINECODE_24%% |
| Git URL | %%INLINECODE_25%% |
| FTP | %%INLINECODE_26%% |
| SSH | %%INLINECODE_27%% |
| Docker image | %%INLINECODE_28%% |
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 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 |
|---|---|---|
| %%INLINECODE_30%% | API key for authentication | From env/config |
| %%INLINECODE_31%% | API endpoint URL | https://api.prev.sh |
| %%INLINECODE_32%% | Path to config file | Auto-discovered |
| %%INLINECODE_33%% | Show help | — |
| %%INLINECODE_34%% | Show CLI version | — |