Docs/Guides/Plugins

Author a plugin package

A Veap plugin is described by a plugin object and can include metadata, lifecycle hooks, migrations, navigation, UI extensions, widgets, locale loaders, nested plugins, and a…

2 min read

A Veap plugin is described by a plugin object and can include metadata, lifecycle hooks, migrations, navigation, UI extensions, widgets, locale loaders, nested plugins, and a route tree.

Package metadata#

The plugin package can define a veap field in package.json:

json
{
  "name": "@example/analytics-plugin",
  "version": "1.0.0",
  "description": "Analytics dashboard extension",
  "veap": {
    "id": "example-analytics",
    "name": "Analytics",
    "enabled": true,
    "dependencies": [],
    "extends": []
  }
}

createManifestFromPackageJson() maps this metadata to a plugin manifest, using package metadata as fallback values. The helper is exported from the common plugin types module; use the actual public export path exposed by your installed package.

Implement the contract#

tsx
import type { IPlugin } from "@veap/plugins";

export const analyticsPlugin: IPlugin = {
  manifest: {
    id: "example-analytics",
    name: "Analytics",
    version: "1.0.0",
    enabled: true,
    dependencies: [],
  },
  async init() {
    // Initialize plugin-owned server resources.
  },
  hooks: [],
  extensions: [],
  widgets: [],
};

The contract permits optional lifecycle methods such as init, onMigrate, onEnable, and onDisable, plus migrations, hooks, extensions, widgets, navigation, plugins, locales, and routeTree.

Package quality checklist#

  • Declare a stable plugin ID and semantic version.
  • Declare required plugin dependencies.
  • Make activation and migration behavior repeatable.
  • Do not put secrets in client-visible metadata.
  • Validate plugin configuration before activation.
  • Add tests for missing dependencies, migration failures, enable/disable behavior, and authorization.
  • Document supported Veap package versions.
veap
Preparing0%