Feature Request: Code Library for Reusable Functions in Code Nodes

Hi n8n Team and Community,

I’d like to suggest: new feature for Code nodes: a reusable “Code Library”.

When using Code nodes, we often write the same JavaScript/Python functions multiple times across different workflows—like normalization helpers, scoring functions, API wrappers, or other utility logic. This can become repetitive, hard to maintain, and error-prone, especially in larger automation projects.

Proposed Feature:

  • users can define reusable functions once.
  • Functions can be called by title inside any Code node, similar to importing a function from a module.
  • That update can be controlled without breaking existing workflows.
  • Multiple users in an organization can share verified utility functions.

Benefits:

  1. Write once, use everywhere (DRY).
  2. Automatically update all Code nodes that call it (each should have a title).
  3. Team members can leverage preapproved utility functions.
  4. Less advanced JavaScript/Python coding required; users can pick from a list of trusted library functions, makes it accessible for Begginners.
  5. Centralized logic makes it easier to understand, observe, and debug workflows.

Example Use Case:

Suppose you have multiple workflows that need to calculate Decision Confidence for routing tickets, as the follwong:

// Instead of copying this to every workflow
function calculateDecisionConfidence(topScore, secondScore) {
  if (!secondScore) return 1.0;
  return topScore / (topScore + secondScore);
}

// Call it in every Code node
const confidence = calculateDecisionConfidence(item.topScore, item.secondScore);
return { json: { ...item, confidence } };

“Enable modules” is node-local, and variables are just data. Your Code Library suggestion is about creating reusable logic across nodes/workflows, which is a step above what exists today.

Would love to hear thoughts from the community and n8n developers!