previewbox-cli
v1.2.5
Published
A lightweight CLI tool for deploying static site previews with ease
Maintainers
Readme
PreviewBox CLI
A lightweight CLI tool for deploying static site previews with email-based authentication.
Installation
npm install -g previewbox-cliUsage
Authentication
Create Account
Sign up for a new account with email and password:
previewbox auth signup --email <email> --password <password>This creates a new account, saves your authentication token, and automatically opens your browser for email verification.
Login
Sign in to an existing account:
previewbox auth login --email <email> --password <password>If your email isn't verified, the CLI will guide you through the verification process.
Email Verification
After signup or login, if your email isn't verified, the CLI will:
- Open your browser to
https://www.previewbox.dev/verify/<email> - Watch for verification completion in real-time
- Notify you when verification is complete
You can verify your email later by running previewbox publish with an unverified account.
Publish a Directory
Create a preview by publishing a directory of static files:
previewbox publish <directory>This will:
- Check your email verification status
- Upload all files in directory (recursively)
- Provide a temporary preview URL that expires in 7 days
- Require verified email for preview creation
List Previews
View all available previews (now public):
previewbox listFor detailed listing with filtering and sorting options:
previewbox list-previews [options]Options:
-f, --format <format>: Output format (table|json)-s, --sort <field>: Sort by field (created|expires|hash|url)-r, --reverse: Reverse sort order--search <query>: Search previews by hash or URL--active-only: Show only active (non-expired) previews--expired-only: Show only expired previews
Remove a Preview
Delete a preview by its hash or URL:
previewbox remove <hash-or-url>Authentication Flow
- Signup →
previewbox auth signup→ Create account → Email verification → JWT token saved - Login →
previewbox auth login→ Authenticate → Email verification (if needed) → JWT token saved - Publish →
previewbox publish→ Check verification status → Upload files → Preview created
Your JWT token is stored in ~/.previewbox/token for future use.
Requirements
- Node.js 18+
- Verified email address (required for creating previews)
Features
- Email-based Authentication: Secure JWT-based authentication with email verification
- Automatic Verification: Real-time verification watching via Server-Sent Events
- Public Discovery: List and view previews without authentication
- File Management: Upload, list, and remove previews
- Search & Filter: Advanced preview listing with search and filtering options
License
ISC
Usage
Register
Generate a new API token:
previewbox registerThis will generate a new token, save it, and display it for your reference.
Login
Alternatively, authenticate with an existing API token:
previewbox login <token>Provide your API token as an argument.
Publish a Directory
Create a preview by publishing a directory of static files:
previewbox publish <directory>This will upload all files in the directory (recursively) and provide a temporary preview URL that expires in 7 days.
List Previews
View your active previews:
previewbox listRemove a Preview
Delete a preview by its hash or URL:
previewbox remove <hash>Requirements
- Node.js 18+
License
ISC
