Core
Guides v2.x
2

External Plugins #

You can extend Kuzzle's features via plugins.

Plugins are intended to be reused between several applications by proposing generic features.

Plugins allow you to achieve two main goals:

  • extension and modification of the API
  • integration of an authentication strategy

These feature categories are not exclusive and although it is not recommended, a plugin can embed features belonging to the 2 categories.

New network protocols can also be integrated to Kuzzle API by writting a Protocol.

Inside a plugin #

Plugins are classes that must implement the Plugin abstract class.

They can create new controllers or register pipes and hooks like applications.

In addition to the standard features available in an application, plugins can also integrate authentication strategies.

More information about features available to plugins: Write Plugins

Use a plugin #

Generally, plugins are distributed as NPM packages.

It is possible to use the Backend.plugin.use method to use a plugin in your application.

Plugins must be used before starting the application.

This method takes an instance of the plugin as a parameter:

import PluginS3 from 'kuzzle-plugin-s3';

// [...]

app.plugin.use(new PluginS3());

The plugin's default name will be inferred from the class name:

  • Class name will be converted to kebab-case
  • The word Plugin will be removed

E.g. PluginDeviceManager => device-manager

It's possible to override the original plugin name by passing a new one in the option object:

import PluginS3 from 'kuzzle-plugin-s3';

// [...]

app.plugin.use(new PluginS3(), { name: 'minio' });

Existing Kuzzle plugins may be found under the kuzzle-plugin Github topic.