Configuration
Customize Robo.js to fit your project's needs.
Robo.js is configured through a file named robo.mjs in the config directory. You only need to specify the options you want to change from their defaults.
Note: You can also use TypeScript (robo.ts), CommonJS (robo.cjs), or JSON (robo.json). TypeScript configs are compiled automatically. The JSON format is less flexible but can be useful if you encounter issues with other formats on your hosting platform.
Example Configuration
// config/robo.mjs
// @ts-check
/** @type {import('robo.js').Config} */
export default {
logger: {
level: 'info'
},
plugins: []
}Note: Platform-specific options like Discord's clientOptions or sage are configured through their respective plugins, not in the core config. See your platform plugin's documentation for those settings.
Configuration Reference
excludePaths
Exclude files or directories from the build output by listing their path prefixes.
Use cases:
- Keeping test files out of the build.
- Preventing sensitive files from being copied.
excludePaths: ['/src/test', '/src/modules/example/statics.json']Note: This feature works with directory and file prefixes, not glob patterns.
experimental
Activate experimental features or change build behavior. These options may change outside of semver.
buildDirectory: Output directory for compiled code. Defaults to.robo/build. Can be a string or a function that receives context with the current mode.incrementalBuilds: Only recompile changed files for faster builds.
experimental: {
buildDirectory: 'dist',
incrementalBuilds: true
}Warning: Experimental features may be unstable and are subject to change outside of semver.
flashcore
Configure the built-in Flashcore key-value database.
keyv: Options passed to the Keyv adapter for external storage.namespaceSeparator: (string) Separator between namespace and key. Defaults to"/".
flashcore: {
keyv: {
store: new SQLite('sqlite://robo.db')
},
namespaceSeparator: '/'
}logger
Customize logging behavior.
drain: (LogDrain) Custom drain function for log output.enabled: (boolean) Set tofalseto disable logging.level: (LogLevel) Minimum log level to output.timestamp: (TimestampFormat) Global timestamp format for all log outputs.colorMap: (boolean) Generate companion.colormapfiles for file-based log outputs.files: (FileOutputConfig[]) File-based log outputs.
logger: {
enabled: true,
level: 'info',
}plugins
Register plugins for your project. Plugins can be specified as a package name string or as an array containing the package name, plugin options, and optional system-wide settings.
The failSafe option prevents plugin initialization failures from crashing the entire project.
plugins: [gptPlugin, '@roboplay/plugin-poll']For more details, see the Plugins guide.
roboplay
Configure RoboPlay hosting options.
node: ('18' | '20' | 'latest') Node.js version to use.
roboplay: {
node: 'latest',
}seed
For plugins only. Configure seed helpers that generate starter files and environment values.
timeouts
Set custom timeout values for lifecycle hooks.
lifecycle: (number) Timeout in milliseconds for lifecycle hook execution.
timeouts: {
lifecycle: 5000,
}watcher
Customize the file watcher used during development.
watcher: {
ignore: ['src/app', 'src/components', 'src/hooks']
}Sensitive Data
Keep sensitive values like API keys and tokens out of your configuration file. Use a .env file instead and reference values with process.env. Configuration files are meant to be committed to version control, while .env files should remain excluded.
See Environment Variables for more details.
