Template: header
Template: markdown

Plugins overview

Built-in plugins

Amagaki provides a handful of inbuilt plugins which can trigger callbacks at
different times during Amagaki's lifecycle. Plugins can be used to do things
such as:

Creating plugins

Custom plugins can be created so that other custom plugins may interact with
them. For example, you may create one plugin that handles authentication for
several other plugins.

Normally, instead of explicitly creating new plugins, you can extend Amagaki
functionality by using hooks available from existing plugins, or by simply
interfacing with Amagaki within amagaki.js. But, if you want or need to
create a custom plugin, see below.

First, define the plugin.

class CustomPlugin {
  constructor(pod, options) {
    this.pod = pod;
    this.options = options;
  getFoo() {
      return this.options.foo;

Then, register the plugin.

module.exports = (pod) => {
    pod.plugins.register(CustomPlugin, {
        foo: 'bar'

Later, within code that depends on the plugin you created, access it.

const customPlugin = pod.plugins.get('CustomPlugin');

Using plugin hooks

Plugins can interface with hooks in Amagaki. These hooks allow for extending the functionality
of Amagaki without needing to change the core of Amagaki.

The PluginComponent interface defines the hooks that are available for plugins to use
and which arguments are expected for the hook arguments.

See PluginComponent Referencelaunch

You can see examples of the hooks in action in the built-in plugins (look for methods ending in Hook):

Template: footer