Moonbase Documentation

Getting Started

Create, enable, and remove plugins.

Quick start

Create a file in api/plugins, for example api/plugins/hello.plugin.js.
Export a register function or a plugin object.
Restart the API (npm run dev from repo root).
// api/plugins/hello.plugin.js
module.exports = {
  name: 'hello',
  enabled: true,
  version: '0.1.0',
  register(ctx) {
    ctx.routers.api.get('/plugins/hello', (_req, res) => {
      res.json({ status_overview: 'success', status_message: 'HELLO' });
    });
  }
};

Supported formats

Use .js, .cjs, .mjs, or a folder with index.js.

Create app/plugins/hello.tsx.
Export a FrontendPlugin.
Register it in app/plugins/registry.ts (import it and add it to plugins).
Ensure the app runs with PluginHost (already wired in app/app/layout.tsx).
// app/plugins/hello.tsx
import type { FrontendPlugin } from '@/lib/plugins/types';

const HelloPlugin: FrontendPlugin = {
  name: 'hello',
  enabled: true,
  version: '0.1.0',
  slots: {
    global: () => <div className="fixed bottom-4 right-4">Hello</div>
  }
};

export default HelloPlugin;
// app/plugins/registry.ts
import helloPlugin from './hello';

export const plugins = [helloPlugin];

Registry is explicit

Add your plugin import to app/plugins/registry.ts and include it in the exported plugins array. Add version to label plugin releases.

Project paths

Maintenance

On this page