Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 2 KB

index.md

File metadata and controls

56 lines (38 loc) · 2 KB

Plug-in API

Indiekit is a Node.js Express server designed to interoperate with IndieWeb protocols and features.

Indiekit has an API which can be accessed via plug-ins. Plug-ins can add new features or provide support for different protocols and specifications.

A plug-in can provide any of the following features:

A plug-in can also add a collection to the MongoDb database.

Anatomy of a plug-in

A plug-in is a Class with an init() function that is used to register endpoints, presets, stores and syndicators. You can also use the init() function to modify Indiekit’s configuration. For example:

export default class PluginName {
  constructor() {
    this.name = "Plugin name";
  }

  syndicate() {}

  init(Indiekit) {
    // Register a plug-in method
    Indiekit.addSyndicator(this)

    // Update Indiekit’s configuration
    Indiekit.config.application.foo = "bar"
  }
};

Folder structure

Indiekit expects plug-in packages to provide assets in the following directories:

Folder name Contents
/assets Static files (for example images, stylesheets). Optional.
/includes Nunjucks partials used in views. Optional.
/locales Localisation files. Optional.
/views Nunjucks view templates. Optional.

Plug-in icon

To provide an icon for your plug-in, include a square shaped SVG file at /assets/icon.svg.

Homepage widget

To provide a small widget for the signed-in homepage, include a Nunjucks file at /includes/[module-name]-widget.njk, and use the widget component to ensure correct markup and styling. Here’s an example.