Deploy
npx discord0 deploydeploy 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/interactionsIf deploy can’t find a URL in the provider’s output, it prints where to look
instead.
Then:
- Set
DISCORD_PUBLIC_KEYandDISCORD_BOT_TOKENwith your provider, as shown below. - Set the printed URL as Interactions Endpoint URL on your application’s General Information page in the Developer Portal.
- Try
/ping.
Set credentials with your provider
Section titled “Set credentials with your provider”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:
npx wrangler secret put DISCORD_PUBLIC_KEY --name my-botnpx wrangler secret put DISCORD_BOT_TOKEN --name my-botSecrets apply right away. Workers always deploy live, so --prod has no
effect.
The Vercel CLI asks you to log in and link a project on the first deploy.
Add the variables in Project Settings → Environment Variables, or from
.discord0/vercel:
cd .discord0/vercelnpx vercel env add DISCORD_PUBLIC_KEY productionnpx vercel env add DISCORD_BOT_TOKEN productionVariables apply to new deployments, so deploy again afterwards. Deploys
are previews unless you pass --prod:
npx discord0 deploy --prodThe Netlify CLI asks you to log in and link a site on the first deploy.
Add the variables in Site configuration → Environment variables, or
from .discord0/netlify:
cd .discord0/netlifynpx netlify-cli env:set DISCORD_PUBLIC_KEY <public key>npx netlify-cli env:set DISCORD_BOT_TOKEN <bot token>Variables apply to new deploys, so deploy again afterwards. Deploys are
drafts unless you pass --prod:
npx discord0 deploy --prodThe AWS adapter deploys with Serverless Framework v3, which uses your AWS
CLI credentials. Serverless reads the Discord credentials from SSM
Parameter Store at deploy time, so create the parameters before the
first deploy, in the region you deploy to. Serverless deploys to
us-east-1 unless you pass -- --region <region>:
aws ssm put-parameter --name /my-bot/DISCORD_PUBLIC_KEY --type String --value <public key>aws ssm put-parameter --name /my-bot/DISCORD_BOT_TOKEN --type SecureString --value <bot token>my-bot is your project’s package.json name. Deploys go to the dev
stage unless you pass --prod, which deploys the prod stage.
The Node.js adapter builds a server instead of uploading anything:
cd .discord0/nodeDISCORD_PUBLIC_KEY=... DISCORD_BOT_TOKEN=... node index.mjsCopy .discord0/node to your server, set the variables in its
environment, and serve it over HTTPS, such as behind a reverse proxy. It
listens on PORT, or 3000.
The Bun adapter builds a server instead of uploading anything:
cd .discord0/bunDISCORD_PUBLIC_KEY=... DISCORD_BOT_TOKEN=... bun index.jsCopy .discord0/bun to your server, set the variables in its environment,
and serve it over HTTPS, such as behind a reverse proxy. It listens on
PORT, or 3000.
Command sync after deploy
Section titled “Command sync after deploy”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 guildsyncs to your test server instead.--guild <id>syncs to one server.--no-syncskips the sync.sync: { deploy: "guild" }orsync: { deploy: false }indiscord0.config.tschanges the default.
Run npx discord0 sync at any time to sync without deploying.
Other options
Section titled “Other options”--dry-runbuilds.discord0/<adapter>without uploading or syncing, and prints the provider command it would run.- Anything after
--goes to the provider’s CLI unchanged, such asnpx discord0 deploy -- --env staging.