Custom Nodes

The built-in library covers a lot of ground, but eventually you’ll want a node that does exactly your thing. The xript node editor lets you define custom nodes directly inside epixtudio. Name, ports, a JavaScript script, no external files.

This tutorial builds a ROT13 cipher node from scratch.

What You’ll Build

A rot13 node that takes a text input and outputs the ROT13-encoded version. ROT13 shifts each letter 13 places in the alphabet, so hello becomes uryyb. Apply it twice and you get the original back. Useless in production, perfect for learning.

Step 1: Open the Node Editor

In the Library panel on the left, scroll to the bottom and click + Create Node. The xript node editor opens as a two-column dialog:

Step 2: Fill in the Basics

Step 3: Define the Ports

Input ports are what your node receives. Click + Add Input and fill in:

Output ports are what your node produces. There’s already a default result output with type Any. Change it:

One text input, one text output. That’s the whole interface.

Step 4: Write the Script

In the code editor on the right, replace the default script with:

const text = inputs.text();

const result = text.replace(/[a-zA-Z]/g, (c) => {
  const base = c <= 'Z' ? 65 : 97;
  return String.fromCharCode(((c.charCodeAt(0) - base + 13) % 26) + base);
});

result;

Three things to know about xript scripts:

  1. Access inputs via inputs.portName(). The function call matters; inputs.portName without the parens won’t work.
  2. The last expression is the output. Whatever the final line evaluates to becomes the node’s result.
  3. Multiple outputs require returning a JSON object with keys matching port names: ({ result: "foo", other: "bar" })

Step 5: Create It

Click Create. Your node now appears in the Library under the category you chose.

Step 6: Use It

  1. Drag rot13 from the Library onto the canvas (or find it with Tab quick search)
  2. Add a text/text node and type hello world in the Inspector
  3. Connect the text node’s output to rot13’s text input
  4. Press F5 to evaluate

The rot13 node outputs uryyb jbeyq.

Chain a second rot13 after the first. The output is hello world again. That’s the whole point of ROT13.

Editing and Deleting

Hover over your custom node in the Library and click Edit Node in the tooltip. The editor reopens with your settings populated. Change anything, hit Save, and existing instances on the canvas pick up the updated script on next evaluation.

To delete, open the editor and click the red Delete button at the bottom left.

Script Tips

Error handling — if your script throws, the node shows an error in its preview and the log panel. No try/catch needed; the sandbox catches it.

Working with JSON — inputs arrive as their declared type. A Json port gives you a parsed object:

const data = inputs.data();
const names = data.map(item => item.name);
names;

Number crunching — a Number port gives you an actual number, not a string:

const a = inputs.a();
const b = inputs.b();
Math.sqrt(a * a + b * b);

Multiple outputs — return an object with keys matching your output port names:

const text = inputs.text();
({
  upper: text.toUpperCase(),
  lower: text.toLowerCase(),
  length: text.length
});

Persistence

Custom nodes are saved to your local database. They survive restarts, appear in the Library, and work in any graph. They’re yours.

What’s Next