F Floweon Hyperflow Learn

Developing Your Own Plugins (Developer Guide)

Build your own Hyperflow extensions step by step with plugin.json, a FastAPI backend, event hooks, and the iframe SDK.

10 min • 2026-11-27

Every developer and every company can write, share, and distribute their own plugins for Hyperflow, just as with Nextcloud apps. A plugin requires only a valid plugin.json manifest and, optionally, a Python backend (backend.py) and a web interface (index.html). The bundled plugin Hello World Demo (plugins_bundled/hello-world) serves as a complete reference.

Generating a starter template#

In the Erweiterungen (Extensions) area under + Erweiterung erstellen (Create extension), or through POST /api/v1/plugins/scaffold, Hyperflow generates a ready-to-run .zip starter package with manifest, backend, frontend SDK example, and README.md.

Directory structure of a plugin#

mein-plugin/
├── plugin.json   # Required: metadata, backend, frontend & settings
├── backend.py    # Optional: FastAPI APIRouter & hooks
├── index.html    # Optional: UI in a sandboxed iframe + plugin SDK
└── README.md

The folder name must match the plugin id.

1. The manifest (plugin.json)#

{
  "id": "mein-plugin",
  "name": "Mein Plugin",
  "version": "1.0.0",
  "description": "Reagiert auf VM-Events und bietet eine eigene UI.",
  "author": "Floweon Community",
  "license": "MIT",
  "icon": "🔔",
  "category": "Automatisierung",
  "backend": { "entrypoint": "backend.py" },
  "frontend": {
    "entry": "index.html",
    "nav_label": "Mein Plugin",
    "nav_icon": "🔔"
  },
  "settings": [
    { "key": "webhook_url", "label": "Webhook URL", "type": "string", "default": "" },
    { "key": "api_secret", "label": "API Secret", "type": "password" },
    { "key": "enabled_events", "label": "Events", "type": "select", "options": ["alle", "nur Power"], "default": "alle" }
  ]
}
Field Required Description
id, name, version yes Unique ID, display name, version
description, author, license, homepage, category no Metadata for the catalog and plugin card
icon no Emoji for the plugin card
backend.entrypoint no Python file with router and hooks
frontend.entry, nav_label, nav_icon no HTML entry point and sidebar entry
settings[] no Settings fields: key, label, type, default, options
min_hyperflow_version, permissions no Informational; not enforced in v1.8.0

The permitted settings types are string, number, boolean, password, and select. Fields of type password are masked in API responses.

Rules for id#

The plugin ID must match the pattern ^[a-z0-9][a-z0-9-]{0,48}[a-z0-9]$: 2 to 50 characters, lowercase letters, digits, and hyphens only, with no hyphen at the beginning or end. Underscores are not permitted.

2. Python backend & hooks (backend.py)#

Hyperflow loads the module in its own process and uses these optional objects:

Object Invocation
router FastAPI APIRouter, mounted under /api/v1/plugins/{id}/api
setup(ctx) On activation
teardown(ctx) On deactivation
on_event(event_name, payload, ctx) On every system event

Through ctx, you receive plugin_id, settings (dictionary), data_dir (persistent data directory under data/plugins_data/<id>), logger, and emit().

from fastapi import APIRouter

router = APIRouter()
_state = {"ctx": None}


def setup(ctx):
    _state["ctx"] = ctx
    ctx.logger.info(f"Plugin {ctx.plugin_id} enabled")


def teardown(ctx):
    _state["ctx"] = None
    ctx.logger.info(f"Plugin {ctx.plugin_id} disabled")


def on_event(event_name, payload, ctx):
    if event_name == "vm.power":
        ctx.logger.info(f"VM {payload.get('name')} -> {payload.get('action')}")


@router.get("/status")
async def get_status():
    ctx = _state["ctx"]
    return {"ok": True, "webhook_url": ctx.settings.get("webhook_url") if ctx else None}

Available system events#

Event Trigger Payload
vm.created New VM created vm_id, name, node_id, vcpus, ram_mb, autostart
vm.updated Hardware/autostart changed vm_id, name, vcpus, ram_mb, autostart
vm.deleted VM deleted vm_id, name, disk_deleted
vm.power Start, stop, restart vm_id, name, action, status
node.created Hypervisor added node_id, hostname, ip_address
node.deleted Hypervisor removed node_id, hostname
plugin.enabled / plugin.disabled Plugin enabled/disabled Plugin details

3. Frontend with the plugin SDK (index.html)#

The interface is displayed in an iframe at /plugins/{id}/static/<entry> (sandbox: allow-scripts allow-same-origin allow-forms allow-popups). Include /static/js/hyperflow-plugin-sdk.js. Communication with the portal runs through postMessage; your auth token is passed on automatically.

SDK function Description
Hyperflow.ready(callback) Calls callback(ctx) as soon as the connection to the portal is established
Hyperflow.api(path, method, body) Call any Hyperflow API (promise)
Hyperflow.pluginApi(subpath, method, body) Call your own plugin routes; the plugin ID is determined automatically
Hyperflow.toast(message, type) Display a notification in the portal
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <script src="/static/js/hyperflow-plugin-sdk.js"></script>
</head>
<body style="font-family: sans-serif; color: #eef1f3; background: transparent;">
  <h2>My Plugin</h2>
  <button id="btn">Load status</button>
  <pre id="out"></pre>

  <script>
    Hyperflow.ready(function () {
      document.getElementById("btn").onclick = async function () {
        const res = await Hyperflow.pluginApi("/status");
        document.getElementById("out").textContent = JSON.stringify(res, null, 2);
        Hyperflow.toast("Status loaded", "success");
      };
    });
  </script>
</body>
</html>

4. Packaging & publishing#

  1. Pack all files directly (or inside a single root folder) into a .zip file (max. 50 MB).
  2. Upload the archive under ZIP / Git installieren (Install ZIP / Git), or publish a Git repository with plugin.json in the root, which administrators add through Aus Git installieren (Install from Git).