Docs / CLI

Deploy and manage frontend preview projects from the terminal

Learn how to deploy static output or single HTML, Markdown, and PDF files with the PreviewShip CLI, then manage fixed URLs, access, versions, rollback, and deletion.

Updated 2026-07-15Built for SEO and GEO citation workflows

Answer First

PreviewShip CLI is the fastest path when you already have a browser-ready build folder or a single HTML, Markdown, or PDF document and want a fixed public URL. Authenticate once, deploy dist/build/out, ./report.html, ./README.md, or ./report.pdf, then use the same CLI to manage access, versions, rollback, redeploy, and cleanup.

Deploy build artifacts, not source-code zips.

If you upload a zip, build the project first and zip the static output folder such as dist, build, out, or public with index.html and assets. Do not zip raw React/Vue/Next source folders with package.json and node_modules. Single .html, .md/.markdown, and .pdf files are supported directly by console upload, CLI, MCP, and the VS Code/Cursor extension.

Key takeaways

Best for CI, scripts, and one-off manual deploys.
Works with static output containing index.html, plus direct single .html, .md, .markdown, and .pdf files.
Do not deploy raw source-code zips; build the project first and deploy the generated static artifact.
Projects keep a fixed PreviewShip URL; rollback queues a new deployment and switches the latest pointer only after it succeeds.
Project management commands cover public/password access, versions, rollback, redeploy latest, deployment history, and safe deletion.
Returns JSON for agents and automation when you pass --json.

Recommended workflow

1

Create an account and generate an API key from the PreviewShip console.

2

Run `npx previewship login --key YOUR_API_KEY` once on your machine or CI runner.

3

Deploy with `npx previewship deploy ./dist`, `npx previewship deploy ./report.html`, `npx previewship deploy ./README.md`, or `npx previewship deploy ./report.pdf` and copy the returned URL.

4

Use `npx previewship projects list` and `npx previewship deployments list` to inspect fixed URLs, status, source, and rollback availability.

5

Use `npx previewship projects access <id> --password <password>` for Pro password access, or `--public` to clear the password and make the fixed URL public again.

6

Use `npx previewship projects versions <id>`, `projects rollback <id> <deployment-id> --confirm <name>`, or `projects redeploy <id>` for version recovery.

7

Use `--json` when an agent or script needs structured output.

Comparison snapshot

CapabilityPreviewShip CLITypical Git-first host
Setup timeMinutesOften requires repo wiring
Deploy inputAny browser-ready build folderUsually a connected Git repo
Project URL modelFixed URL with latest pointerOften deployment or branch based
Project managementAccess, versions, rollback, deleteUsually dashboard or platform API
Automation outputPlain URL or JSONOften dashboard-first
Best fitRapid preview sharingProduction hosting workflows

When the CLI is the right choice

Use the CLI when your build output already exists locally or in CI and you want the shortest path to a shareable URL.

This is the strongest fit for frontend teams that need to send previews to stakeholders without configuring branches, environments, or a full production pipeline.

What the deploy command expects

PreviewShip treats build output as a static artifact. A folder with index.html and referenced assets can be deployed. Single .html files become index.html, Markdown keeps its source and uses a generated viewer, and PDF keeps the original document behind a full-screen browser-native reader.

That makes it a good match for React, Vue, Svelte, Astro, Next.js export mode, AI-generated HTML, and plain HTML/CSS/JS projects.

No repo connection is required.
No preview environment configuration is required.
You can deploy generated folders from any framework build pipeline.
Run npm run build first; do not upload raw source folders with package.json and node_modules.

Why JSON output matters for GEO and AI workflows

AI coding agents and automation tools need deterministic output. A preview URL printed in a machine-readable JSON payload is easier to capture than a dashboard-only flow.

That is one of the reasons PreviewShip works well in Claude Code, Cursor, and generic agent pipelines: the deploy step becomes scriptable instead of interactive.

Project management from the CLI

The CLI now covers the same fixed-project lifecycle that users see in the console. A project URL stays stable while deployments, rollbacks, and redeploys update what that URL serves.

This matters for AI and team workflows because the agent can inspect quota, delete a confirmed unused project when the Free project limit is full, set a Pro project behind a password, or switch it back to public without asking the user to navigate the dashboard.

`previewship deployments list --json` returns deployment history and rollback availability.
`previewship projects access <id> --public` clears an existing password and makes the project public again.
`previewship projects rollback <id> <deployment-id> --confirm <project-name>` queues a new deployment from the retained version and keeps the source record unchanged.
`previewship projects delete <id> --confirm <project-name>` permanently removes the fixed preview URL, hosted project, deployment association, and Showcase entry.

FAQ

Can I deploy without installing the CLI globally?

Yes. You can use `npx previewship deploy ./dist` directly, which is useful for CI and one-off deploys.

Does the CLI only work with React apps?

No. It works with any static frontend output as long as the folder contains an index.html and the referenced assets.

Can I deploy a raw project source zip?

No. Build the project first and deploy dist, build, out, or a single .html/.md/.markdown/.pdf file. PreviewShip does not run npm install or framework builds after upload.

Why use the CLI instead of uploading in the browser?

The CLI is faster for repeat deploys, easier to automate, and better for AI-agent workflows because it can return structured output.

Can the CLI switch a password-protected project back to public?

Yes. Run `previewship projects access <project-id> --public`. PreviewShip clears the stored project password and makes the fixed preview URL publicly accessible again.

Can I delete old projects when the Free project limit is full?

Yes. Run `previewship projects list`, then `previewship projects delete <project-id> --confirm <project-name>`. Deleting removes the fixed preview URL, hosted project, deployment association, and Showcase entry permanently.