Skip to content

Configuration ​

Conflux reads conflux.config.ts at the project root (or the path you pass to the CLI). Use defineConfig for typed defaults.

ts
import { defineConfig } from "@confluxjs/conflux";

export default defineConfig({
  outDir: "dist",
  entry: "src/index.ts",
  eventsDir: "src/events",
  commandsDir: "src/commands",
  env: "FLUXER_BOT_TOKEN",
  prefix: "!",
});

Token resolution ​

OptionBehavior
tokenLiteral bot token string
envName of an environment variable to read
(omitted)Checks FLUXER_BOT_TOKEN, then CONFLUX_BOT_TOKEN, then BOT_TOKEN

Load variables from .env automatically in dev and start.

Paths ​

FieldDefaultRole
entrysrc/index.tsBot module exporting client
commandsDirsrc/commandsPrefix command modules
eventsDirsrc/eventsEvent handler folders
outDirdistProduction bundle output

Command prefix ​

The prefix option controls which message prefixes trigger prefix commands.

ValueResolved behavior
Omitted["!"]
stringSingle prefix, for example ["!"]
string[]Multiple prefixes, tried in array order
ts
export default defineConfig({
  prefix: "!",
});

export default defineConfig({
  prefix: ["!", "?"],
});

At runtime, Conflux loads config prefixes first, then runs optional configure(conflux) from your entry module. If configure calls conflux.setPrefix(), that resolver replaces the config value for the rest of the process lifetime.

Use config for fixed prefixes. Use setPrefix when prefixes must be computed (dynamic lists, per-request logic, or async resolution). See PrefixResolver in the API reference.

Dev vs production output ​

ModeOutputNotes
conflux dev.conflux/Unminified bundle, watch + restart
conflux buildoutDir (dist)Minified production bundle
conflux startUses outDir when presentFalls back to source entry

Do not commit .conflux/; treat dist/ as deploy artifacts after conflux build.

tsdown build options ​

Bot bundling is powered by tsdown. Pass extra tsdown options through tsdown in conflux.config.ts. They merge over Conflux defaults. Conflux still owns entry, outDir, cwd, and config-file loading so command and event discovery keep working.

ts
import { defineConfig } from "@confluxjs/conflux";

export default defineConfig({
  prefix: "!",
  tsdown: {
    target: "node20",
    alias: { "@": "./src" },
    define: { "import.meta.env.DEV": "true" },
  },
});