Plugin Development

Customize Your Developer Platform with Plugins

Extend and customize your Developer Platform with plugins. Add new features, integrate tools, and tailor workflows to fit your team’s needs.

 
import { Plugin, Logger } from '@ale-run/runtime';
import path from 'node:path';

const logger = Logger.getLogger('plugin:example');

export default class ExamplePlugin extends Plugin {
  public async activate(): Promise<void> {
    logger.info(`plugin ${this.name} is activate`, this.options);

    // install app
    const catalog = await this.context.getCatalog();
    await catalog.regist(`${path.resolve(__dirname, 'app/example')}`);
    await catalog.registPreset(`${path.resolve(__dirname, 'app/example')}`);
  }

  public async deactivate(): Promise<void> {
    logger.info(`plugin ${this.name} is deactivate`);
  }
}

Typescript

TypeScript-Based

Build plugins easily with a TypeScript-based framework. Use familiar tools to extend and enhance your developer platform.

 
import { Plugin, Logger, APIServer } from '@ale-run/runtime';
import { ExampleMetricDriver } from './metric';
import path from 'node:path';

const logger = Logger.getLogger('plugin:example');

export default class ExamplePlugin extends Plugin {
  public async activate(): Promise<void> {
    logger.info(`plugin ${this.name} is activate`, this.options);

    // regist app
    const catalog = await this.context.getCatalog();
    await catalog.regist(`${path.resolve(__dirname, 'app/example')}`);
    await catalog.registPreset(`${path.resolve(__dirname, 'app/example')}`);

    // add api route
    const api: APIServer = this.get('api-server');
    if (!api) throw new Error(`api-server is required`);

    const router = api.routers.body.get(this.name);

    router.post('/example', async (req, res) => {
      res.send({
        say: 'Hello'
      });
    });

    // add metric driver
    const clustermgr = this.context.getClusterManager();
    clustermgr.addMetricDriver('example', ExampleMetricDriver);
  }

  public async deactivate(): Promise<void> {
    logger.info(`plugin ${this.name} will be deactivate`);

    const server: APIServer = this.get('api-server');
    server?.routers?.body?.remove(this.name);

    // remove metric driver
    const clustermgr = this.context.getClusterManager();
    clustermgr.removeMetricDriver('example');
  }
}

Develop Plugin

Extend Your Platform with Plugins

Tailor your developer platform to your team’s needs. Customize workflows and features with full control.

PDE

Local Plugin Development Environment

Develop and test plugins locally before deployment. Ensure seamless integration with your platform.

 
$ npm i @ale-run/runtime@latest
$ npx aled dev
? Select a Kubernetes context: (Use arrow keys)
❯ No Cluster Selected 
  docker-desktop
  orbstack

Installation

Dynamic Plugin Installation

Install and update plugins on the fly. Extend functionality without restarting or redeploying services.

plugin management screenshot