Skip to content

CLI

The zocket CLI signs you in to the platform, creates or links projects, and deploys actor bundles.

The CLI ships as @zocket/cli. Install it globally, or use it via your package manager’s runner.

Terminal window
bun add -g @zocket/cli
# or
npm i -g @zocket/cli

After install the zocket binary is on your path.

The CLI stores state in two JSON files.

FilePathContents
Global config~/.zocket/config.jsonplatformUrl, cliToken (from zocket auth)
Project link./.zocket.json (cwd)projectId, projectSlug, projectDomain, deployToken, entry

Environment variables:

  • ZOCKET_PLATFORM_URL — default control-plane URL. Falls back to http://localhost:3000. Every command accepts --platform-url to override per-invocation.

Sign in through the platform device flow.

Terminal window
zocket auth [--platform-url <url>]

The CLI hits /api/auth/device/start, prints a verification URL and user code, opens your browser if possible, and polls until approval. On success it writes cliToken to ~/.zocket/config.json so later commands can authenticate.

Run zocket auth again any time to refresh the token.

Create a new project on the platform and link the current directory to it.

Terminal window
zocket init --name <name> [--slug <slug>] [--entry <file>] [--platform-url <url>]
FlagRequiredDefaultDescription
--nameHuman-readable project name
--slugautoOptional URL slug for the project
--entryindex.tsPath to the actor entry file
--platform-url$ZOCKET_PLATFORM_URLOverride the control plane

Requires cliToken (run zocket auth first). Writes .zocket.json in the current directory:

{
"projectId": "prj_...",
"projectSlug": "my-app",
"projectDomain": "my-app.zocket.app",
"deployToken": "dt_...",
"entry": "index.ts"
}

Link the current directory to an existing project you already have access to.

Terminal window
zocket link --project <slug> [--entry <file>] [--platform-url <url>]
FlagRequiredDefaultDescription
--projectExisting project slug
--entryindex.tsPath to the actor entry file
--platform-url$ZOCKET_PLATFORM_URLOverride the control plane

Fetches the project, mints a fresh deploy token, and writes .zocket.json (same shape as init).

Bundle the linked project and push it to the platform.

Terminal window
zocket deploy [--entry <file>] [--platform-url <url>]
FlagRequiredDefaultDescription
--entryvalue from .zocket.json, else index.tsEntry file to bundle
--platform-url$ZOCKET_PLATFORM_URLOverride the control plane

zocket deploy must be run from a linked directory (one containing .zocket.json). It bundles the entry file using Bun (target: "bun", format: "esm"), uploads the bundle to /api/deployments with the project’s deploy token, and prints the new version, status, domain, and WebSocket URL.

Under the hood the platform stores the bundle in S3, records a row in the deployments table, and triggers the runtime to fetch and load it. See the Deployment overview for what happens after upload.

Terminal window
# one-time
zocket auth
# in a new project
zocket init --name "Realtime Todos" --entry src/server.ts
# iterate
bun run build # optional
zocket deploy
# join an existing project from another machine
zocket link --project realtime-todos
zocket deploy