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
FlagTypeDefaultDescription
--envstringproductionTarget environment
--branchstringCurrent branchGit branch to deploy
--projectstringAuto-detectedProject ID

The deploy command runs the full pipeline:

  1. Clone — pulls your repo from GitHub
  2. Build — runs pnpm build (or custom build command)
  3. Migrate — applies database migrations to Neon Postgres
  4. Deploy — pushes to Cloudflare Workers/Pages
  5. 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/nuxt configured
  • Database initialized and seeded
  • .env file 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
SubcommandDescription
set KEY=VALUESet environment variable(s)
pullDownload env vars to .env
listList 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.