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/cliCommands
| Command | Description |
|---|---|
ploy dev | Start local development server with hot reloading |
ploy types | Generate TypeScript types from ploy.yaml |
ploy build | Build your worker project using wrangler |
ploy auth login | Authenticate with the Ploy API |
ploy auth logout | Clear stored credentials |
ploy api | Interact 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 devploy.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.
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_AUTHAfter 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 loginThis 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