Back to Blog

Try n8n free for 10 days

After trial, plans start from $7/mo. No charge until day 11.

n8nguidetutorialcustom nodedevelopment

How to Create a Custom n8n Node: A Complete Step-by-Step Guide

n8nautomation TeamMay 26, 2026
TL;DR: This guide provides a complete walkthrough for creating your own custom n8n nodes. You will learn how to set up a development environment, structure your node code, build a functional node, and deploy it to your n8n instance.
This guide explains **how to create a custom n8n node**, giving you the power to extend n8n beyond its vast library of 400+ built-in integrations. While n8n’s existing nodes cover most use cases, you might occasionally need to connect to a niche, internal, or brand-new API. Instead of wrestling with generic HTTP Request nodes for every call, you can build a clean, reusable, and shareable custom node.

What Are Custom n8n Nodes (And Why Build One)?

A custom n8n node is a self-contained package of code that adds new functionality to your n8n instance. It appears in the nodes panel just like any other official node, complete with its own UI, parameters, and logic. You can build nodes for completely new services or create utility nodes that perform complex, reusable operations specific to your business needs.

Here are a few reasons why you might build a custom node:

  • Integrate with a private or niche API: If your company uses an internal tool or a vertical-specific SaaS product without a native n8n integration, a custom node is the perfect solution.
  • Encapsulate complex logic: If you find yourself rebuilding the same complex sequence of nodes repeatedly, you can abstract that logic into a single, easy-to-use custom node.
  • Improve usability: Custom nodes can have tailored user interfaces, including dynamic dropdowns, which makes workflows easier to build and manage than using generic HTTP nodes.
  • Share with the community: If you build a node for a public service, you can publish it to npm and contribute to the n8n ecosystem, helping thousands of other users.

Setting Up Your Development Environment

Before you can start building, you need to set up a few prerequisites. The n8n team provides a command-line tool to make this process straightforward.

  1. Install Node.js and npm: Your development machine needs a recent version of Node.js (v16 or later) and npm. You can download them from the official Node.js website.
  2. Install the n8n-node-dev CLI: This is the official scaffolding tool for creating custom nodes. Install it globally using npm:
    npm install -g n8n-node-dev
  3. Create a new node project: Once the CLI is installed, you can generate a new project structure. Run the following command, and the tool will guide you through the setup.
    n8n-node-dev new --name my-first-node
    This command creates a new directory named n8n-nodes-my-first-node containing all the boilerplate code, including a nodes folder and a credentials folder.

Anatomy of a Custom Node File

Inside the nodes directory, you'll find a file like MyNode.node.ts. This is the heart of your custom node. It's a TypeScript class that defines everything about your node's behavior and appearance.

The core of the file is the description property. This object defines the node's metadata and its user interface.

  • displayName: The name of the node as it appears in the n8n UI.
  • name: The internal, unique name for the node (e.g., myNode).
  • icon: The icon to display for the node (e.g., file:myNode.svg).
  • group: Which category the node appears under in the nodes panel.
  • version: The version of your node. Start with 1.
  • description: A short explanation of what the node does.
  • defaults: Defines default values for the node's properties.
  • inputs: An array defining the input properties, which create the fields in the node's UI. Each property is an object with a displayName, name, type, and default value.
  • outputs: Specifies the number of outputs the node has. The default is one.

The most important part of the class is the execute method. This is where your node's logic lives. It's an async function that receives the node's context, processes the input data, performs actions, and returns the output data that will be passed to the next node in the workflow.

Tip: The best way to learn is by example. Explore the official n8n nodes repository on GitHub. You can see how experienced developers structure their nodes, handle authentication, and manage complex operations.

Step-by-Step: Building a Simple "Hello World" Node

Let's create a basic node that takes a name as input and returns a "Hello" message. This will illustrate how the description and execute method work together.

  1. Define the node properties: In your MyNode.node.ts file, you'll set up the main description. We'll add one input field for the user to enter a name.
    
        import { IExecuteFunctions } from 'n8n-core';
        import {
            INodeExecutionData,
            INodeType,
            INodeTypeDescription,
        } from 'n8n-workflow';
    
        export class MyNode implements INodeType {
            description: INodeTypeDescription = {
                displayName: 'My First Node',
                name: 'myNode',
                group: ['transform'],
                version: 1,
                description: 'Takes a name and says hello.',
                defaults: {
                    name: 'My First Node',
                },
                inputs: ['main'],
                outputs: ['main'],
                properties: [
                    {
                        displayName: 'Name',
                        name: 'name',
                        type: 'string',
                        default: '',
                        placeholder: 'Enter a name',
                        description: 'The name to greet',
                    },
                ],
            };
            // ... execute function below
        }
        
  2. Write the execute logic: Now, implement the execute method. It will read the value from the 'name' property we just defined.
    
        async execute(this: IExecuteFunctions): Promise {
            const items = this.getInputData();
            let returnData: INodeExecutionData[] = [];
    
            for (let i = 0; i < items.length; i++) {
                const name = this.getNodeParameter('name', i, '') as string;
                
                const responseData = {
                    message: `Hello, ${name}!`,
                };
    
                returnData.push({ json: responseData });
            }
    
            return this.prepareOutputData(returnData);
        }
        
    This code iterates through incoming items, gets the name parameter for each, and constructs a new JSON object with a greeting.

Testing and Debugging Your Custom Node

Once you've written your node, you need to test it in a live n8n instance. This development feedback loop is crucial for building complex logic.

  1. Start the developer process: In your node project's terminal, run npm run dev. This command starts a process that automatically rebuilds your node whenever you save a file.
  2. Link the node to n8n: For n8n to find your local custom node, you need to link its folder. The n8n documentation provides instructions for different operating systems. This usually involves creating a symbolic link in your .n8n/custom directory pointing to your node's dist folder.
  3. Start n8n: Launch your local n8n instance. If the linking was successful, you'll see a message in the logs indicating that your custom node was loaded.
  4. Test in a workflow: Open your n8n editor, create a new workflow, and you should be able to find "My First Node" in the nodes panel. Add it, configure the "Name" field, execute it, and check the output!

This process can be a bit tricky when managing a local n8n installation. Using a managed platform like n8nautomation.cloud simplifies this, letting you focus on your node's code while the hosting environment is handled for you.

Deploying Your Custom Node on n8n

Once your node is tested and ready, you need to make it available to your production n8n instance. There are several ways to do this, depending on your hosting setup.

  • For Self-Hosted Users: If you manage your own n8n instance (e.g., with Docker), you have a few options. You can build your node, publish it as a private npm package, and then install it into your n8n Docker image. Alternatively, you can mount your node's code directory directly into the container. This gives you full control but also requires careful management of dependencies and updates.
  • For n8nautomation.cloud Users: With a managed solution, the process is streamlined. You can host your custom node in a private Git repository (like GitHub or GitLab). In your n8nautomation.cloud dashboard, you can configure your instance to automatically pull and install custom nodes from that repository. This ensures your proprietary nodes are secure, version-controlled, and automatically deployed without manual server management.
  • Publishing for the Community: If your node connects to a public service and you want to share it, you can publish it to the public npm registry. After publishing, it will become available for any n8n user to install and may even be included in a future version of n8n itself.

Creating custom nodes is a powerful skill that unlocks the full potential of n8n, enabling you to build truly bespoke automation workflows tailored to your exact needs.

Ready to automate with n8n?

Get affordable managed n8n hosting with 24/7 support.