Skyport
Theme

Panel

Plugins

Extend your Skyport Panel with third-party plugins or build your own custom extensions.

Skyport Panel features a modular plugin architecture that allows administrators and developers to extend the panel with custom pages, administrative controls, and custom API endpoints without modifying the core codebase.


Overview

Plugins in Skyport are self-contained modules located in the plugins/ directory of your Panel installation. Each plugin can:

  • Register new Express routes and custom API endpoints.
  • Provide custom EJS view templates.
  • Add user navigation items in the sidebar.
  • Add administrative navigation items in the admin panel.
  • Hook into the panel lifecycle when the server starts.

Plugin Directory Structure

Every Skyport plugin lives in its own folder inside the plugins/ directory. A standard plugin follows this layout:

plugins/
└── my-plugin/
    ├── manifest.json    # Plugin metadata and configuration
    ├── index.js         # Plugin entry point (lifecycle hooks)
    ├── router.js        # Express router defining custom paths
    └── views/           # EJS template files for custom UI
        └── index.ejs

The Manifest File (manifest.json)

The manifest.json file defines your plugin's identity, entrypoint, and navigation integration. Here is an example manifest:

{
  "name": "My Custom Plugin",
  "version": "1.0.0",
  "description": "Adds custom dashboards and monitoring widgets to Skyport.",
  "author": "YourName",
  "main": "index.js",
  "router": "my-plugin",
  "sidebar": {
    "Dashboard": {
      "url": "/my-plugin",
      "search_data": "dashboard analytics monitoring",
      "icon": "/public/assets/icons/custom.svg"
    }
  },
  "adminsidebar": {
    "Plugin Settings": "/my-plugin/admin"
  }
}

Manifest Fields

  • name: The display name of your plugin shown in the Admin Plugins list.
  • version: The semantic version string (e.g. 1.0.0).
  • description: A short explanation of what your plugin does.
  • author: Author or organization name.
  • main: The JavaScript file executed during panel startup (usually index.js).
  • router: The base path where your plugin's router is mounted. For example, "router": "my-plugin" will mount routes under https://panel.example.com/my-plugin.
  • sidebar: Custom links injected into the main user navigation sidebar.
  • adminsidebar: Custom links injected into the Admin navigation panel.

Writing the Plugin Logic

Entry Point (index.js)

Your index.js must export a register function and the Express router:

const express = require('express');
const router = require('./router');

function register(addonManager) {
  // Initialization logic runs when the Skyport Panel boots up
  console.log('My Custom Plugin has been registered successfully.');
}

module.exports = {
  register,
  router,
};

Defining Routes (router.js)

Your router.js handles HTTP requests for your plugin. You can render views or return JSON responses:

const express = require('express');
const router = express.Router();
const path = require('path');

// Public or authenticated plugin route
router.get('/', (req, res) => {
  res.render(path.join(__dirname, 'views/index.ejs'), {
    user: req.session.user,
    pageTitle: 'My Custom Plugin',
  });
});

// Admin-only route example
router.get('/admin', (req, res) => {
  if (!req.session.user || !req.session.user.isAdmin) {
    return res.status(403).send('Forbidden: Administrator access required.');
  }

  res.render(path.join(__dirname, 'views/admin.ejs'), {
    user: req.session.user,
  });
});

module.exports = router;

Installing Plugins

To install a plugin in Skyport Panel:

  1. Download or clone the plugin directory.
  2. Move the plugin folder into the plugins/ directory in your Skyport root path:
    mv my-plugin /var/www/skyport/plugins/
    
  3. Access your Panel as an Administrator and navigate to Admin -> Plugins.
  4. Enable the plugin or ensure its status is active in plugins/plugins.json.
  5. Restart your Skyport Panel service:
    systemctl restart skyport
    

Plugin Security

Always verify third-party plugins before installing them on a production panel. Plugins run with the same system permissions as the Node.js Skyport process.

Previous
Development