Zumito Config
This guide will help you to understand the zumito.config.ts file.
The LauncherConfig interface
Section titled “The LauncherConfig interface”The zumito.config.ts file must export a constant named config that implements the LauncherConfig interface.
import type { LauncherConfig } from 'zumito-framework';
export const config: LauncherConfig = { // Your configuration here};The LauncherConfig extends Partial<FrameworkSettings>, so all settings are defined at the top level of the exported config object. The main properties are:
discordClientOptions: Discord client configuration (token, intents, clientId).defaultPrefix: Default bot prefix for text commands.database: zumito-db multi-driver configuration.bundles: An array ofBundleobjects to load external modules.
Modules
Section titled “Modules”The modules array is the recommended way to load Zumito modules. It accepts either a module npm package name string or a ModuleEntry created by a module’s factory function, giving you full type safety and autocomplete.
Using factory functions (recommended)
Section titled “Using factory functions (recommended)”Each module exports a factory function that returns a typed ModuleEntry. This gives you autocomplete on the config object and ensures types are correct at compile time:
import { defineConfig } from 'zumito-framework';import { adminModule } from '@zumito-team/admin-module';import { userPanelModule } from '@zumito-team/user-panel-module';
export default defineConfig({ modules: [ adminModule(), userPanelModule(), ]});Modules that support configuration can receive it directly in the factory call:
import { analyticsModule } from '@zumito-team/analytics-module';
export default defineConfig({ modules: [ analyticsModule({ defaultTrackCommandPerformance: true, defaultRetentionDays: 30, }) ]});Using strings
Section titled “Using strings”You can also pass module names as plain strings:
export default defineConfig({ modules: [ '@zumito-team/admin-module', '@zumito-team/user-panel-module', '@zumito-team/analytics-module', ]});Bundles (legacy)
Section titled “Bundles (legacy)”Bundles are the legacy way to organize your bot’s code. Each bundle is a directory that contains commands, events, and other modules.
import path from 'path';import type { LauncherConfig } from 'zumito-framework';
const __dirname = process.cwd();
export const config: LauncherConfig = { bundles: [{ path: path.join(__dirname, "node_modules", "@zumito-team", "admin-module"), }, { path: path.join(__dirname, "node_modules", "@zumito-team", "user-panel-module"), }],};Framework Settings
Section titled “Framework Settings”The zumito.config.ts file exports a LauncherConfig object. Framework settings are defined at the top level of the config (not nested):
import type { LauncherConfig } from 'zumito-framework';
export const config: LauncherConfig = { discordClientOptions: { intents: 3276799, token: process.env.DISCORD_TOKEN!, clientId: process.env.DISCORD_CLIENT_ID!, }, defaultPrefix: process.env.BOT_PREFIX || "z-", logLevel: parseInt(process.env.LOG_LEVEL || "3"),};Database configuration
Section titled “Database configuration”The database property configures zumito-db:
export const config: LauncherConfig = { mongoQueryString: process.env.MONGO_URI!, database: { default: 'mongo', drivers: { mongo: { uri: process.env.MONGO_URI! }, }, migrations: [], // optional: array of Migration instances }, models: [Guild, Member], // auto-register models on startup};| Property | Type | Description |
|---|---|---|
database.default | string | Default driver name ('mongo', 'sqlite', 'tingo', 'memory') |
database.drivers | Record<string, object> | Per-driver connection config |
database.migrations | Migration[] | Optional migration classes |
models | any[] | Model classes to auto-register |