Skip to content

Create a Plugin System

Currently, almost all components of the application are dynamic enough that they would fit into a plugin system. So, to centralize everything, we should create a fairly simple plugin system, that allows to load installed modules as well as plugins inside the plugins folder and hook them into the application.

Tasks

  • Load plugins from the plugins folder
  • Load plugins installed as npm modules
  • Make plugins-loader customizable itself, so new sources can be added easily (Optional)
  • Move all existing default components into their own, separate plugins

Notes

Think of a solution to use core classes made available by the application in plugins installed as modules, without having to provide them with an object containing references for them all.

Solution 1

Separate the unicast module into unicast-core and unicast. unicast depends on unicast-core, which contains all source files, and the main module has only the the plugin loader. This way, plugins can also depend on unicast-core. One drawback from this is that the classes will be different, because node will download all files for each module that depends on it.