DEV Community

Kiu
Kiu Subscriber

Posted on

Create your own n8n custom node

In some cases, the existing n8n nodes are not enough. You may want to add support for a new service or simplify an existing node for your own needs. This tutorial shows you how to build a custom n8n node from scratch. As an example, we will create a node that uses the Binance API to get the current price of a cryptocurrency.

We begin by setting up a local development environment. We use Git and Docker Desktop on a Windows PC. Starting with a fresh system, we clone the n8n self-hosted AI Starter Kit from GitHub. After adjusting the configuration for our setup (such as using the CPU profile), Docker downloads the needed images and sets up the container environment.

Once the n8n instance is running, we open it in the browser and create the admin account. Before we can deploy custom nodes, we must create a folder called custom inside the Docker container. We do this by accessing the container shell and creating the folder at /home/node/.n8n/custom.

Next, we prepare our custom node. We clone the n8n-nodes-starter repository and rename it to follow the community naming convention (e.g., n8n-nodes-b24-custom-nodes). We edit the package.json, update the project name, and configure additional metadata. We also install required tools like pnpm and rimraf, and set up a script to build and deploy the node into the Docker container.

We then create our actual node by copying the example node and renaming it. We call our new node B24CryptoManager. It will fetch the price of a coin using Binance's public API, which does not require authentication. We clean up the code, remove the unused execute method, and add a single parameter: the symbol of the coin, like BTCUSDT.

After building the project, we deploy it using our custom script. Once deployed, we open n8n again and create a test workflow. Our custom node appears in the node search. We add it, enter a coin symbol, and execute the node. The current price is returned as JSON—just like with any standard n8n node.

To make the node dynamic, we add a Set node that passes a symbol value like ETHUSDT. We configure our custom node to use that input value instead of the default. After running the workflow again, it returns the Ethereum price correctly. This confirms that everything works as expected.

With that, we’ve successfully built and deployed our first custom n8n node. In the next part, we will explore how to add authentication to custom nodes for services that require API keys or tokens.

If you are interested in AI, Automation or finance you can join:
https://www.skool.com/business24ai

Top comments (0)