Packages
CLI
Command-line tool for deploying and managing CommerceJS stores.
The @commercejs/cli package provides the commercejs command-line tool for deploying stores, scaffolding projects, and managing environment variables.
Installation
pnpm add -g @commercejs/cli
# Or run directly with npx
npx @commercejs/cli deploy
Commands
commercejs deploy
Deploy your store to CommerceJS Cloud:
# Deploy to production
commercejs deploy --env production
# Deploy a specific branch as preview
commercejs deploy --env preview --branch feature/new-checkout
# Deploy staging
commercejs deploy --env staging
| Flag | Type | Default | Description |
|---|---|---|---|
--env | string | production | Target environment |
--branch | string | Current branch | Git branch to deploy |
--project | string | Auto-detected | Project ID |
The deploy command runs the full pipeline:
- Clone — pulls your repo from GitHub
- Build — runs
pnpm build(or custom build command) - Migrate — applies database migrations to Neon Postgres
- Deploy — pushes to Cloudflare Workers/Pages
- Health check — verifies the deployment is live
commercejs init
Scaffold a new CommerceJS project:
commercejs init my-store
Interactive prompts:
- Adapter — Platform (built-in), Salla, Medusa, or custom
- Database — Neon Postgres
- Template — Minimal, storefront, or headless API
Creates a ready-to-run project with:
- Nuxt app with
@commercejs/nuxtconfigured - Database initialized and seeded
.envfile with sensible defaults
commercejs env
Manage environment variables for your Cloud project:
# Set a variable
commercejs env set TAP_SECRET_KEY=sk_test_xxx
# Set multiple variables
commercejs env set KEY1=value1 KEY2=value2
# Pull remote env vars to local .env
commercejs env pull
# List all variables (values masked)
commercejs env list
| Subcommand | Description |
|---|---|
set KEY=VALUE | Set environment variable(s) |
pull | Download env vars to .env |
list | List variables with masked values |
Configuration
The CLI reads project config from commercejs.config.ts (auto-detected) or manual flags:
// commercejs.config.ts
export default {
project: 'my-store',
buildCommand: 'pnpm build',
outputDir: '.output',
}
Authentication
The CLI authenticates via your CommerceJS Cloud account:
# Login (opens browser for OAuth)
commercejs login
# Check current auth status
commercejs whoami
Status
Scaffold — Commands are structured but require integration testing against live Cloud infrastructure.