Skip to content

discord0.config.ts

discord0.config.ts in the project root holds the settings the CLI uses. Flags you pass on the command line override it. init writes one for the adapter you chose:

discord0.config.ts
import adapter from "@discord0/adapter-cloudflare";
import { defineConfig } from "discord0";
export default defineConfig({
entry: "src/index.ts",
adapter: adapter(),
// Your test server. `discord0 dev` syncs commands to it on start and on change.
guild: process.env.DISCORD_GUILD_ID,
sync: {
// dev: false, // never sync from `discord0 dev`
deploy: "global", // after `discord0 deploy`: "global", "guild", or false
},
});

The CLI loads .env and .env.local before it reads the config, so the config can read their values through process.env. .env.local wins over .env, and variables already set in your environment win over both. The CLI also accepts discord0.config.mts, discord0.config.js, and discord0.config.mjs.

Option Default Description
entry "src/index.ts" The module that default-exports the app. A path passed to dev, sync, task, or deploy overrides it.
adapter none What deploy builds for, such as adapter() from @discord0/adapter-vercel. An adapter name passed to deploy overrides it.
guild none Your test server’s ID, 17 to 20 digits. An empty or unset value counts as no server.
sync.dev "guild" if guild is set, otherwise false "guild" syncs to guild when dev starts and when commands change. false never syncs from dev.
sync.deploy "global" Where deploy syncs after a successful deploy: "global", "guild", or false.

Setting sync.dev or sync.deploy to "guild" without guild is an error. So is any other key, at the top level or in sync, so a typo fails instead of being ignored.