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.
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
Recommended workflow
Create an account and generate an API key from the PreviewShip console.
Run `npx previewship login --key YOUR_API_KEY` once on your machine or CI runner.
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.
Use `npx previewship projects list` and `npx previewship deployments list` to inspect fixed URLs, status, source, and rollback availability.
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.
Use `npx previewship projects versions <id>`, `projects rollback <id> <deployment-id> --confirm <name>`, or `projects redeploy <id>` for version recovery.
Use `--json` when an agent or script needs structured output.
Comparison snapshot
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.
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.
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.