Skip to content

Deploy

Terminal window
npx discord0 deploy

deploy bundles your app with the project’s adapter into .discord0/<adapter>, uploads that directory with the provider’s CLI, and then syncs your commands. The provider’s CLI receives only the bundle and the files the adapter generates, not your source tree or .env.

When the upload succeeds, deploy prints the endpoint to use:

Interactions endpoint: https://my-bot.example.workers.dev/interactions

If deploy can’t find a URL in the provider’s output, it prints where to look instead.

Then:

  1. Set DISCORD_PUBLIC_KEY and DISCORD_BOT_TOKEN with your provider, as shown below.
  2. Set the printed URL as Interactions Endpoint URL on your application’s General Information page in the Developer Portal.
  3. Try /ping.

Wrangler asks you to log in on the first deploy. Set the secrets on the Worker, which is named after your project’s package.json name:

Terminal window
npx wrangler secret put DISCORD_PUBLIC_KEY --name my-bot
npx wrangler secret put DISCORD_BOT_TOKEN --name my-bot

Secrets apply right away. Workers always deploy live, so --prod has no effect.

After a successful upload, or after the build for Node.js and Bun, deploy registers your commands globally. It uses DISCORD_BOT_TOKEN from your local .env. Global commands can take a while to appear everywhere.

Commands you synced to your test server during development stay there, so the test server shows each command twice until you remove the server copies. To sync elsewhere:

  • --scope guild syncs to your test server instead.
  • --guild <id> syncs to one server.
  • --no-sync skips the sync.
  • sync: { deploy: "guild" } or sync: { deploy: false } in discord0.config.ts changes the default.

Run npx discord0 sync at any time to sync without deploying.

  • --dry-run builds .discord0/<adapter> without uploading or syncing, and prints the provider command it would run.
  • Anything after -- goes to the provider’s CLI unchanged, such as npx discord0 deploy -- --env staging.