Feature Proposal: Custom Cluster Nodes with User-Defined Sub-Nodes (Non-AI)

Hi everyone,

I believe the custom node functionality in n8n is a fantastic feature. Building on that, I’d like to propose an enhancement: the ability to create custom cluster nodes that can incorporate user-defined sub-nodes, extending beyond the current AI-specific sub-node capabilities.

From what I understand, creating the main custom cluster node itself isn’t the primary challenge. The difficulty seems to lie in defining and utilizing custom (i.e., non-AI) nodes as sub-nodes. My current understanding is that only AI-related nodes can be used as sub-nodes in the existing implementation.

I envision a configuration for the custom sub-node connection within a node’s class that might look something like this:

inputs: [
    { // Index 0 - Main Input for the cluster node
        type: NodeConnectionType.Main,
        displayName: "Input",
    },
    { // Index 1 - Connection point for a custom sub-node
        displayName: "YourCustomSubNode", // Example display name
        type: NodeConnectionType.SubNode, // This type would ideally position the node's input anchor at the bottom, typical for sub-nodes.
        maxConnections: 1,
    },
    // Potentially more sub-node connections here
]

Based on my review of the n8n source code, I surmise that querying such a custom sub-node for its data on the cluster node could potentially be handled as follows:

const subNodeData = await this.getInputConnectionData(NodeConnectionType.SubNode, 1); 

This would then presumably call the supplyData (or equivalent execution method) implementation within the connected sub-node’s class.

Allowing the creation of cluster nodes with diverse, user-defined sub-nodes would be incredibly useful. It would significantly enhance the ability to organize complex workflows, make them more modular, and improve overall readability and maintainability.

What are your thoughts on this potential feature?