What is n8n-workflow?
The n8n-workflow package is a core component of the n8n automation tool, which is used to define and manage workflows. It provides the necessary classes and functions to create, execute, and manage workflows, nodes, and data within the n8n environment.
What are n8n-workflow's main functionalities?
Workflow Creation
This feature allows users to create workflows by defining nodes and connections. The code sample demonstrates how to instantiate a new Workflow object with nodes and connections.
const { Workflow } = require('n8n-workflow');
const workflow = new Workflow({
nodes: [
// Define nodes here
],
connections: {}
});
Node Management
Node management involves creating and configuring nodes within a workflow. The code sample shows how to create a new Node object with specific parameters.
const { Node } = require('n8n-workflow');
const node = new Node({
name: 'Example Node',
type: 'exampleType',
parameters: {}
});
Data Handling
Data handling is crucial for processing and transferring data between nodes. The code sample illustrates how to create NodeExecutionData to manage data within a node.
const { NodeExecutionData } = require('n8n-workflow');
const executionData = new NodeExecutionData({
json: { key: 'value' }
});
Other packages similar to n8n-workflow
node-red
Node-RED is a flow-based development tool for visual programming, similar to n8n. It allows users to wire together devices, APIs, and online services. While Node-RED is more focused on IoT and hardware integrations, n8n is more versatile in terms of workflow automation across various services.
zapier-platform-core
Zapier Platform Core is a package for building custom integrations on the Zapier platform. It provides tools to create 'Zaps' that automate tasks between different web apps. Compared to n8n-workflow, Zapier is more user-friendly for non-developers but less flexible for complex custom workflows.

n8n-workflow
Workflow base code for n8n
npm install n8n-workflow
License
n8n is fair-code distributed under the Sustainable Use License.
Proprietary licenses are available for enterprise customers. Get in touch
Additional information about the license can be found in the docs.