Plugin Development Workflow
This guide covers the full development workflow for NetPad plugins, including local dev, hot-reload, testing, debugging, and using templates.
1. Using Plugin Templates
The CLI provides several templates to jumpstart your plugin:
- Basic Node: Simple transformation or utility node
- API Integration: Node that calls external APIs (with auth, error handling)
- Data Transformer: Node for mapping/filtering data
- Database Connector: (Planned) Node for database operations
To create a plugin with a template:
npx create-netpad-plugin my-plugin --template api2. Local Development & Hot-Reload
NetPad supports live plugin development with hot-reload:
npm run dev- Starts the PluginDevServer (WebSocket-based)
- Watches for changes in
runner.js,shape.js, and manifest - Automatically reloads your plugin in the NetPad UI
- Real-time error reporting in the editor
Tip:
- Use the NetPad UI to install your plugin locally for testing.
- Make changes and see them reflected instantly.
3. Testing Plugins
Each plugin includes a test suite powered by the PluginTestFramework:
npm run test- Runs unit and integration tests for your plugin logic
- Validates manifest and permissions
- Checks for performance and security issues
Best Practices:
- Write tests for all plugin logic (runner)
- Use mocks for API/database calls
- Validate edge cases and error handling
4. Debugging & Error Reporting
- Errors in your plugin code are reported in real-time in the NetPad UI and CLI
- Use
console.logor the providedlogfunction in your runner for debugging - Stack traces and error details are available in the PluginDevServer output
5. Iterating Quickly
- Use hot-reload to make rapid changes
- Update your manifest and node visuals as you go
- Test in real workflows before publishing
6. Best Practices
- Keep your plugin logic modular and testable
- Limit permissions to only what you need
- Use the modern node system for all visuals (ModernNodeBase, NodeVisualizations)
- Document your plugin in
README.md - Write clear, actionable error messages for users
Further Reading
For more, see the Plugin Sprint Plan.