SDK for developing NT Panel plugins
npm install @ntpanel/plugin-sdkbash
npm install @ntpanel/plugin-sdk
`
Quick Start
Create a new plugin:
`bash
npx ntplugin create my-plugin
cd my-plugin
npm install
npm run build
npm run pack
`
Plugin Structure
`
my-plugin/
├── plugin.json # Plugin manifest
├── package.json
├── tsconfig.json
├── src/
│ └── backend/
│ └── index.ts # Main plugin class
└── dist/ # Compiled output
`
Example Plugin
`typescript
import { PluginBase, PluginContext, PluginRoute } from '@ntpanel/plugin-sdk';
export default class MyPlugin extends PluginBase {
readonly name = 'My Plugin';
async init(context: PluginContext): Promise {
this.context = context;
this.log('Plugin initialized');
}
getRoutes(): PluginRoute[] {
return [
{
path: '/hello',
method: 'GET',
handler: async (req, res) => {
res.json({ message: 'Hello!' });
}
}
];
}
}
`
CLI Commands
| Command | Description |
|---------|-------------|
| ntplugin create | Create new plugin from template |
| ntplugin build | Compile TypeScript |
| ntplugin validate | Validate plugin.json |
| ntplugin pack | Create .ntplugin archive |
Publishing
1. Build your plugin: npm run build
2. Pack it: npm run pack
3. Upload the .ntplugin` file to the NT Panel Developer Portal