LogoRobo.js

Modules

Organize by grouping related commands and events into modules.

Modules let you group related commands and events into self-contained units within your project. Each module follows the same file structure conventions as the top-level src/ directory, acting as a mini-project within your main project.

Using modules is optional. They are most useful for larger projects where organizing by feature keeps the codebase manageable.

What is a Module

A module is a subfolder inside src/modules/ that contains its own commands/ and events/ directories. You can create as many modules as needed and name them after the feature they represent.

Combining with Top-Level Directories

Modules coexist alongside top-level commands/ and events/ directories. General-purpose handlers can live at the top level while feature-specific handlers are organized into modules.

Note: Events can overlap across modules, but command names must be unique. You cannot have multiple command files with the same name in different modules.

Nested Modules

Modules can be nested inside other modules. Each nested module follows the same structure, allowing for fine-grained organization in large projects.

Modules as a Path to Plugins

Modules are the natural starting point for plugin development. Because they bundle related commands and events together, a well-structured module can be extracted into a standalone plugin with minimal changes.

See the Plugins documentation for details on converting modules into shareable plugins.

Next Steps

On this page