Skip to main content

Module Organization

Plan your modules carefully

Modules are a way of organizing your project's code. When creating a plugin, it's a good idea to plan how you will separate your modules. Here are some things to keep in mind:

Core module

All plugins have a main module that serves as the foundation—often called the "core" module, or simply the name of the plugin. Other modules in the plugin add features on top of this module. Your core module cannot depend on any other modules within your plugin.

Dependencies

When one module needs to use features from another module, a dependency is formed. This means that the dependent module cannot function without the module it relies on.

Circular dependencies

When two modules depend on each other to function, a circular dependency is formed and you'll be unable to compile your project. It's a good idea to reconsider your architecture if this happens.

Compiling efficiency

All modules are compiled individually, which means only modules that have changed since the last build need to be recompiled. Compile times can be significantly reduced if your large project has smaller modules.

Performance efficiency

Modules can be enabled and disabled at runtime, which can help with optimization.