CLI
The discord0 CLI ships with the discord0 package. Run it with npx discord0, pnpm exec discord0, yarn discord0, or bun x discord0, or
through the starter’s package scripts.
The CLI runs on Bun. When Bun 1.4.4 or newer starts it, the CLI runs in that
process. Otherwise it runs on the Bun binary that discord0 installs as an
optional dependency (@oven/bun-<platform>), so you don’t need Bun yourself.
With Yarn, the starter’s .yarnrc.yml installs into node_modules, because Bun
doesn’t read Plug’n’Play.
Settings in discord0.config.ts apply when flags
don’t override them.
-h or --help prints usage. discord0 sync --help and
discord0 deploy --help print the options for those commands. discord0 test --help prints the help for bun test.
Interactive prompts
Section titled “Interactive prompts”When stdin and stdout are both TTYs and CI is unset, discord0 prompts for
missing arguments. init and sync prompt even for options that have a
default, with the default preselected. For example, init prompts for the
directory, then for the adapter with Cloudflare preselected. Run discord0
with no command to pick one from a list.
- Every prompt has a matching flag or argument. Passing a flag skips only that prompt. The CLI still prompts for the other missing values.
- Prompts work on all platforms, including Windows.
- With
-y,--yes,--no-interactive, orCIset, or when stdin or stdout isn’t a TTY, the CLI never prompts. It uses defaults and exits with an error when a required value is missing.
| Option | Description |
|---|---|
-y, --yes |
Accept defaults and skip prompts (all commands except test). |
--no-interactive |
Never prompt; use defaults or error on missing required values (except test). |
discord0 init [directory] [--directory <path>] [--adapter <name>] [-y|--yes] [--no-interactive]Copies the starter into directory, or the current directory, which must be
new or empty. It doesn’t install anything.
| Option | Description |
|---|---|
--directory <path> |
Target directory (alternative to the positional directory). |
--adapter <name> |
cloudflare (default), vercel, netlify, aws, node, or bun |
-y, --yes |
Accept defaults (. and cloudflare) without prompting. |
--no-interactive |
Never prompt; use defaults. |
discord0 dev [entrypoint] [--guild <id>] [--no-sync] [--tunnel]Serves the app at http://127.0.0.1:3000/interactions (set PORT to change
the port) with hot reload, loading .env and .env.local. See
Local development.
| Option | Description |
|---|---|
--guild <id> |
Sync commands to this server on start and whenever they change. Default: guild from the config, unless sync.dev is false. |
--no-sync |
Don’t sync commands. |
--tunnel |
Start a Cloudflare Quick Tunnel and print the HTTPS /interactions URL for the Developer Portal. |
discord0 sync [entrypoint] [--scope <global|guild>] [--guild <id>] [-y|--yes] [--no-interactive]Registers the app’s commands with Discord, replacing the current set in that
scope. Loads .env and .env.local for DISCORD_BOT_TOKEN and the optional
APPLICATION_ID.
| Option | Description |
|---|---|
--scope <global|guild> |
Every server (default), or the test server from guild in the config. |
--guild <id> |
Sync to this server. Implies --scope guild. |
-y, --yes |
Accept defaults (global) without prompting. |
--no-interactive |
Never prompt; use defaults or error if a guild ID is required. |
deploy
Section titled “deploy”discord0 deploy [adapter] [entrypoint] [options] [-- <provider flags>]Bundles the entry point’s default export with the adapter into
.discord0/<adapter>, writes each scheduled task
and webhook route, and the
events endpoint when the app handles webhook events, into the
host’s config, uploads it with the provider’s CLI, then syncs commands. It
prints each webhook URL and the Webhook Events URL next to the Interactions
endpoint. An adapter name loads @discord0/adapter-<name> instead
of the config’s adapter. The node and bun adapters build a server to run
yourself instead of uploading. See Deploy.
| Option | Description |
|---|---|
--adapter <name> |
Host adapter (alternative to the positional adapter). |
--prod |
Production on Vercel and Netlify, the prod stage on AWS. Default: preview, draft, or the dev stage. No effect on Cloudflare. |
--dry-run |
Build without uploading or syncing. |
--scope <global|guild> |
Sync scope. Default: sync.deploy in the config, or global. |
--guild <id> |
Sync commands to one server instead of globally. |
--no-sync |
Skip command sync. |
-y, --yes |
Skip discord0’s own prompts (pass provider --yes after --). |
--no-interactive |
Never prompt; error if required values (such as adapter) are missing. |
Flags after -- pass through to the provider’s CLI unchanged.
discord0 task [name] [entrypoint] [--name <name>] [-y|--yes] [--no-interactive]Runs one scheduled task once, now, loading .env
and .env.local. When name is omitted on a TTY with CI unset, prompts to
choose from the app’s registered tasks. It exits with an error if the task
throws.
| Option | Description |
|---|---|
--name <name> |
Task name (alternative to the positional name). |
-y, --yes |
Skip prompts (errors if no task name is passed). |
--no-interactive |
Never prompt (errors if no task name is passed). |
discord0 test [bun test options]Runs bun test in the project on the Bun the CLI uses, so npm, pnpm, and Yarn
projects need no Bun of their own. Options pass through to bun test. See
Testing.
Environment variables
Section titled “Environment variables”| Variable | Used by | Description |
|---|---|---|
DISCORD_PUBLIC_KEY |
The app | Verifies that requests come from Discord. Falls back to PUBLIC_KEY. |
DISCORD_BOT_TOKEN |
The app, sync, dev, deploy |
Sends replies and syncs commands. Falls back to BOT_TOKEN. |
APPLICATION_ID |
sync, dev, deploy |
Optional. Falls back to DISCORD_APPLICATION_ID, then to a lookup with the bot token. |
DISCORD_GUILD_ID |
discord0.config.ts in the starter |
Your test server’s ID. |
PORT |
dev, the Node.js and Bun servers |
The port to listen on. Default: 3000. |
CRON_SECRET |
The Vercel task route | Required for scheduled tasks on Vercel. |
DISCORD0_TASKS |
The Node.js and Bun servers | off, false, or 0 stops this server from running scheduled tasks. |
CI |
The CLI | Any value other than empty, 0, or false disables interactive prompts. |