YAKjs has a simple module loading system. There are three different types of modules that can be used by a plugin.

Common modules

YAKjs provides some useful common modules that are also used internally. Do not change this modules. If you want to create your own module use a user-defined module.



Creates a unique ID


A simple key-value store.


A simple key-value JSON store.

How to use it in your plugin code:
const guid = require('./common/guid');

User-defined modules

You can create your own module and upload it via the user interface or using the Rest API.

User-defined modules are stored in the ./modules/ folder.

How to use it in your plugin code:

const foo = require('./modules/foo');

The update trap

User-defined modules are loaded on their first use and will be cached for later. After upgrading a module that is already loaded, your changes will have no effect to any instance.

_Given_ an instance T is running that uses plugin P that requires module M (1.0)
_When_ updating module M to version (2.0)
_Then_ instance T with plugin P will still use M (1.0)

There are two ways to get around it. The hard one: stop and restart YAKjs. More soft: Reset the cache (via user interface or Rest API) and restart instance T.

Using node modules

Your plugin can use the same modules that are used by YAKjs. Take a look at the dependency section in the package.json file for more information.

How to use it in your plugin code:

const moment = require('moment');

Danger Zone: Install other node modules

It is possible to install other node modules via npm. But be very careful only to use modules that are not conflicting with modules that are required by YAKjs. Go to the folder where YAKjs is installed and install it via npm:

$ npm install module-name --save

Attention: When installing a new version YAKjs your changes to the package.json file will be lost. You have to install your dependencies again.