What you will build: A scaffolded plugin in JavaScript, Rust, or AssemblyScript, verified offline with the SDK test harness and mounted live with --dev-plugin.
Step 1: Scaffold a Plugin by Language
Scaffold a zero-build ES2024 plugin (manifest_schema: 3, entrypoint plugin.js) that needs no bundler or compilation:
opendash new plugin my-plugin --lang js --dir ./my-plugin
// plugin.js generated scaffold:
od.on("content/after_save", async (env) => {
od.log.info("Saved entry: " + JSON.stringify(env.payload));
return { ok: true };
});
Scaffold a Rust cdylib crate targeting wasm32-unknown-unknown using opendash-plugin-sdk:
opendash new plugin my-plugin --lang rust --dir ./my-plugin
// src/lib.rs:
use opendash_plugin_sdk::{export_plugin, log, Envelope, LogLevel, SdkError};
export_plugin!(run);
fn run(env: Envelope) -> Result<(), SdkError> {
log(LogLevel::Info, &format!("Handled event: {}", env.event))?;
Ok(())
}
Scaffold an AssemblyScript project compiled with asc using @opendash/sdk/as/opendash:
opendash new plugin my-plugin --lang as --dir ./my-plugin
// assembly/index.ts:
import { readEnvelope, log, outputAllow } from "@opendash/sdk/as/opendash";
export function opendash_run(): i32 {
const env = readEnvelope();
if (env != null) {
log("info", "Handled event: " + env.event);
}
outputAllow();
return 0;
}
Step 2: Offline Unit Testing with @opendash/sdk
Test Boa JS modules and cron handlers locally in Node.js before booting OpenDash using createTestHost from @opendash/sdk/test-harness:
import { createTestHost } from "@opendash/sdk/test-harness";
const host = createTestHost({ kv: { count: 1 } });
host.loadModule((od) => {
od.onCron("sync", async () => {
const n = Number(od.kv.get("count") ?? 0);
od.kv.set("count", n + 1);
od.log.info("synced");
return { count: n + 1 };
});
});
const res = await host.runCron("sync");
// => { ok: true, value: { count: 2 } }
Step 3: Live Mount, Inspect Logs & Package
# Mount plugin directory live on an isolated site root
OPENDASH_SITE_ROOT=./dev-site OPENDASH_PORT=18767 \
opendash serve --dev --dev-plugin ./my-plugin
# Tail plugin runtime logs in another terminal
opendash logs my-plugin --owner plugin --follow
# Run offline ABI check and build an installable ZIP archive
opendash check plugin ./my-plugin
opendash pack plugin ./my-plugin --out ./my-plugin.zip
opendash schema plugin > plugin.schema.json
Step 4: Install & Enable Safely
Place ready folder plugins inside <site_root>/plugins/<slug>/ or upload my-plugin.zip in Plugins and click Enable. Configure plugin settings and secrets cleanly in Admin before triggering actions.
Next Steps
- Explore hooks, sync filters, cron jobs, routes, widgets, and
SecretStorein Permissions, Hooks, Custom Routes, Admin UI & SecretStore. - Inspect worker isolation bounds in Isolated Plugin Sandbox.