Migration Guide: Custom Nodes to Plugins
This guide explains how to migrate existing custom nodes to the new plugin system using NetPad’s modern node architecture.
Why Migrate?
- Unlock plugin store distribution and management
- Gain access to audit logging, security, and compliance features
- Use modern node visuals and configuration
Key Migration Steps
- Extract Node Logic
- Move your node’s logic into a
runner.jsfile
- Move your node’s logic into a
- Create a Plugin Manifest
- Define your plugin’s metadata, permissions, and visuals in
manifest.json
- Define your plugin’s metadata, permissions, and visuals in
- Refactor Node Shape
- Use
ModernNodeBaseand config from the manifest
- Use
- Test with PluginDevServer
- Use hot-reload and the test framework to validate your plugin
- Publish and Install
- Use the CLI to publish and install your new plugin
Before & After Example
Before: Custom Node
export default function CustomNodeShape({ shape, isSelected }) {
// 200+ lines of custom styling...
}After: Plugin Node
import { getPluginConfig } from '...';
import ModernNodeBase from '...';
export default function CustomNodeShape({ shape, isSelected }) {
const config = getPluginConfig('custom_node');
return (
<ModernNodeBase shape={shape} isSelected={isSelected} config={config}>
<APIVisualization x={shape.x} y={shape.y} width={shape.width} />
</ModernNodeBase>
);
}Best Practices
- Use the manifest for all config and permissions
- Leverage existing NodeVisualizations for visuals
- Keep runner logic modular and testable
- Document migration steps in your plugin’s README
Further Reading
For more, see the Plugin Sprint Plan.