Plugin SDK

Add what a client needs, without forking the engine.

A plugin can add fields, blocks, storage, sign-in providers, routes and limits. It’s a module the server loads at start. The operator enables it, and a project can turn it on for itself.

terminal

npm install @moteurio/plugin-auth-github

# .env
MOTEUR_HOST_PLUGINS=@moteurio/plugin-auth-github
MOTEUR_ENABLED_PLUGINS=auth-github
Installing a public plugin: a package, and two lines in the server’s settings.

Try it

Read a real plugin

The plugin that gives every project its paragraph, heading and image blocks, line by line. Press a number to see what that part does.

moteur-plugins/packages/plugin-core-blocks/src/index.ts

/**
 * Optional plugin: Default core block schemas.
 * When enabled, registers built-in block types (paragraph, heading, image, spacer, quote, divider, button).
 */
import type { PluginManifest } from '@moteurio/types/Plugin.js';
import type { PluginInitContext as PluginContext } from '@moteurio/plugin-sdk';
import { defaultCoreBlockSchemas } from './data/coreBlocks.js';

export const manifest: PluginManifest = {
    id: 'core-blocks',
    label: 'Default core blocks',
    description: 'Built-in block types: paragraph, heading, image, spacer, quote, divider, button',
    source: 'opensource',
    kind: 'optional',
    scope: 'project',
    categories: ['content'],
    contributes: {
        schemas: {
            blocks: [
                'core/paragraph',
                'core/heading',
                // … image, spacer, quote, divider, button
            ]
        }
    },
    studio: {
        blockTypes: [
            'core/paragraph',
            // … the same seven
        ]
    }
};

export function init(ctx: PluginContext): void {
    for (const schema of defaultCoreBlockSchemas) {
        ctx.registerBlockSchema(schema);
    }
    // Structures (core/audit, core/publishable, core/seo, core/source) ship from the engine.
}

export default { manifest, init };
  1. Its idWhat MOTEUR_ENABLED_PLUGINS and a project’s own plugin list refer to.
  2. Per projectA project-scoped plugin can be on for one project and off for another.
  3. What it bringsDeclared up front, so the server knows what each plugin adds before it runs.
  4. For the StudioThe block types the Studio should offer when the plugin is on.
  5. initRuns once when the server starts, with everything a plugin may register.
  6. A block typeEach schema becomes a block type, used exactly like one made in the Studio.

The real file from the public plugins repository, with two long lists shortened.

The SDK

What a plugin can add

Everything below is a method on the context a plugin’s init receives. Build it once, and every client project can use it.

  • Content

    Fields, blocks and structures

    A map field, a pricing table block, an address structure: they show up beside the built-in ones.

    • registerFieldSchema
    • registerBlockSchema
  • Storage

    Where files and videos go

    Send files to your own storage, or videos to a host, with an adapter.

    • registerStorageAdapterFactory
    • registerVideoProviderFactory
  • Sign-in

    Sign-in providers

    GitHub, Google, Microsoft and OIDC are plugins already. Your provider can be one too.

    • getAuthProviders
    • Read the four public ones
  • API

    Routes, commands and tools

    Add API routes with their OpenAPI, and commands that become CLI commands and MCP tools.

    • getRoutes
    • registerCommand, registerMcpTool
  • Media

    Media transforms

    Add variant presets, transforms and generators to what Moteur does with uploads.

    • registerMediaTransform
    • registerMediaGenerator
  • Limits

    Limits, if you host

    Set people, storage, requests, image traffic, letters and counts per project, or leave them unlimited.

    • setStorageLimit, setCountLimit…
    • Moteur Cloud’s billing does this

Questions about plugins

A developer asksWhich public plugins are there?

MoteurSign-in with GitHub, Google, Microsoft or any OIDC provider. The core blocks and blueprints. OEmbed. Maps and places. Form data retention. And incoming webhooks from GitHub and Slack.

A developer asksCan a plugin add a screen to the Studio?

MoteurStudio plugins exist, built into Moteur Cloud’s Studio. A self-hosted engine has no web Studio to add to.

An agency owner asksDoes a plugin run on Moteur Cloud?

MoteurMoteur Cloud runs the plugins it ships. Your own plugins run on your own server.

A developer asksWhat do I write it in?

MoteurA Node module. The SDK’s types are TypeScript, and the public plugins are written in it.

An agency developer asksCan a plugin do something with a form?

MoteurYes. It can act when a form is sent, add its own field checks and spam checks, or hold a letter back. Plugins can also read, keep and erase letters: the form data retention plugin is one.

Write the plugin your client needs.

Start from a public one, or the SDK’s own example.