Skip to main content

WASM Plugins

Collabase features a native WebAssembly (WASM) plugin engine that allows you to extend the core backend securely. Unlike Frontend SDK Apps which run visually in an iFrame, WASM plugins run completely offline on your server, directly interfacing with the Collabase engine via a high-performance sandbox.

Why WebAssembly

  • Sandboxed Execution: Plugins cannot bring down the main application thread. Memory leaks, infinite loops, or crashes run securely isolated.
  • Zero Overhead Background Processing: Ideal for listening to system events (e.g., when a task is updated) without the overhead of HTTP webhooks.
  • Polyglot Freedom: Write your backend plugins in AssemblyScript, Rust, Go, or C/C++ and compile to standard .wasm.

The Sandbox Environment

When a WASM plugin is executed, it runs with strict boundaries:
  • memoryLimit: Configurable per plugin (default 64MB).
  • timeout: Configurable execution time limit (default 5000ms).
Plugins do not have arbitrarily native file system or raw network socket access unless specifically granted via Host Functions.

Hook points

WASM Plugins are triggered by “Hook Points.” A Hook Point is a subscription to a system event or an interception path within the main application.
{
  "hookPoints": ["task:created", "page:updated", "automation:custom_node"]
}
When a user modifies a task or triggers a specific node in an automation workflow, the Collabase engine invokes your WASM module’s entry point with the payload and context.

Available hook points

Here is a complete list of hooks currently exposed to the WASM engine.
HookPayload descriptionTypical use case
task:createdThe full Task object.Automatic tagging, routing, or validation upon task creation.
task:updatedThe Task object and changed fields.Auditing status transitions or computing derived states.
task:deletedThe taskId string.Cleaning up related external system records.
page:createdThe Page object (excluding content body).Initiating approval workflows for new documentation.
page:updatedThe Page object and diff structure.Tracking stale documentation or triggering translation tasks.
page:deletedThe pageId string.Archiving logic.
user:createdThe User profile object.Provisioning the user in external LDAP or SCIM integrations.
project:createdThe Project object.Bootstrapping default folders or task queues for new projects.
automation:custom_nodeThe node context, params, and variables.Executing highly specialized, memory-intensive logic required by an automation flowchart.

Host functions

The engine provides specific “Host Functions” bridging your WASM sandbox to the Collabase platform.

Context and logging

The most important host function is collabase:log. This allows you to stream execution logs directly to the Admin Dashboard’s live log viewer. AssemblyScript Example:
// Define the host function
@external("collabase", "log")
declare function collabaseLog(level: string, message: string): void;

export function onActivate(): void {
  collabaseLog("INFO", "WASM Plugin has been activated successfully!");
}

export function onEvent(eventName: string, payload: string): void {
  collabaseLog("DEBUG", `Received event: ${eventName}`);
  
  if (eventName == "task:created") {
    // Process the task
    collabaseLog("INFO", "Processed new task creation.");
  }
}

Building the plugin

1

Write logic

Write your logic.
2

Compile

Compile to .wasm (e.g., using asc for AssemblyScript or cargo build --target wasm32-unknown-unknown for Rust).

Installing and updating

Via the admin interface

1

Open plugins

Navigate to System Administration → Plugins.
2

Select tab

Switch to the WASM Plugins tab.
3

Click install

Click Install WASM Plugin.
4

Upload

Upload your compiled .wasm file along with the metadata (slug, name, version).

Reviewing live logs

In the WASM Plugins tab, you can expand any installed plugin row. This reveals a Live Log Viewer. Every time your plugin calls collabase:log (or encounters a sandbox panic/timeout), it is instantly streamed here. You can filter logs by Level (INFO, ERROR, DEBUG) to easily monitor background execution in production.