Ploy
Ploy
CLI

CLI Overview

The Ploy CLI for local development, type generation, and building workers.

Ploy CLI

The @meetploy/cli package provides the ploy command for local development, TypeScript type generation, and building workers.

Installation

# Global install (recommended for local development)
npm install -g @meetploy/cli

# Or as a dev dependency in your project
npm install -D @meetploy/cli

Commands

CommandDescription
ploy devStart local development server with hot reloading
ploy typesGenerate TypeScript types from ploy.yaml
ploy buildBuild your worker project using wrangler
ploy auth loginAuthenticate with the Ploy API
ploy auth logoutClear stored credentials
ploy apiInteract with the Ploy platform API

Quick Start

Create a ploy.yaml at the root of your project, then run:

# Generate TypeScript types for your bindings
ploy types

# Start the local development server
ploy dev

ploy.yaml

The ploy.yaml file configures the Ploy runtime bindings available to your worker or Next.js app. The CLI reads this file for both ploy dev and ploy types.

ploy.yaml
kind: worker # worker | nextjs | static
build: pnpm build
out: dist

# Environment variables (exposed as vars: {} in PloyEnv)
env:
  API_URL: https://api.example.com

# Runtime bindings — format is BINDING_NAME: resource_name
db:
  DB: default

queue:
  QUEUE: tasks

workflow:
  FLOW: my_flow

cache:
  CACHE: default

state:
  STATE: default

ai: true

auth:
  binding: PLOY_AUTH

After editing ploy.yaml, run ploy types to regenerate your TypeScript types.

See the Configuration page for the full ploy.yaml reference.

Authentication

To use the ploy api commands, authenticate first:

ploy auth login

This opens a browser window for OAuth login. Credentials are stored in ~/.ploy/config.json. You can also set PLOY_API_TOKEN as an environment variable to skip interactive login.

How is this guide?

Last updated on