Create your own n8n custom node
Build, test, and deploy a simple n8n custom node that fetches cryptocurrency prices from the Binance public API. This walkthrough covers everything from setting up a local self-hosted n8n instance with Docker to creating a reusable custom node, registering it with n8n, and testing it in a workflow. The example node will return the latest price for a symbol like BTCUSDT or ETHUSDT.
What you’ll need
- Git installed on your machine
- Docker Desktop (running)
- An editor or IDE (VS Code, WebStorm, etc.)
- Basic familiarity with the terminal
1. Install and run the n8n self-hosted starter kit
Use the self-hosted AI starter kit repository (or the standard n8n Docker setup) to run n8n locally. Clone the repository and follow the README for the Docker command appropriate to your hardware profile (CPU, GPU, etc.). On Windows choose the CPU profile if you’re on a regular PC.
Once the Docker images download and the containers start, open n8n at http://localhost:5678 and create the owner account. After logging in, open personal settings and optionally switch to dark theme.
2. Prepare a custom nodes folder inside the n8n container
n8n looks for custom nodes in a specific folder inside the n8n user directory. It does not exist by default, so create it inside the running container.
# Find the running n8n container
docker ps
# Open a shell in the container (replace <container> with the actual container name)
docker exec -it <container> /bin/sh
# Inside the container
cd /home/node/.n8n
mkdir custom
pwd
# /home/node/.n8n/custom
# Exit the container shell
exit
3. Start a custom nodes project from the n8n node starter
Use the n8n node starter repository as a scaffold. Clone it and rename the folder to follow the community naming convention if you plan to publish later.
- Clone n8n-nodes-starter and rename to n8n-nodes-b24-custom-nodes (or another name starting with
n8n-nodes-for community packages). - Open the project in your IDE. The important files and folders are
nodes/,credentials/, andpackage.json.
4. Adjust package.json and install tooling
Update package.json to reflect your repository name, author, homepage, and other metadata. The n8n section of the package.json is where you’ll register your node later.
Install required tools and dependencies:
# Install pnpm (if not already installed)
npm install -g pnpm
# Install rimraf (used for cleanup scripts)
npm install -g rimraf
# Install project dependencies
pnpm install
5. Implement the Binance price node
Copy one of the example node folders, rename it and its TypeScript file to something descriptive — for example b24-crypto-manager and B24CryptoManager.ts. Adjust the exported class name to match the file name.
Keep the node simple: one resource, one operation. The node will build a single URL for Binance and return the result. Binance exposes a public, unauthenticated endpoint to get the current price:
# Example API call to get BTC price in USDT
curl "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT"
In the node properties define a string parameter called symbol with a default like BTCUSDT. When executing, the node should call the above endpoint with the provided symbol and return the JSON payload.
Implementation notes
- Set request defaults or a base URL to
https://api.binance.com. - Use n8n helpers like
this.helpers.request(when writing a programmatic node) to perform the HTTP request. - Provide clear node name, description, and an SVG icon with a transparent background.
6. Register the node in package.json
Add your new node file name to the n8n.nodes list inside the project's package.json. This tells the build system to include the node in the final dist bundle.
7. Build and deploy the custom node to the n8n container
Build the project and copy the compiled dist output into the container's custom folder. You can use pnpm run build and then docker cp or a script that wraps those steps.
# Build the node package
pnpm run build
# Copy the compiled files into the container's custom folder
# Replace <container> with your container name and adjust paths as needed
docker cp ./dist <container>:/home/node/.n8n/custom
# Restart the n8n container so it loads updated custom nodes
docker restart <container>
After copying and restarting, confirm inside the container that the files are present:
docker exec -it <container> /bin/sh
ls -la /home/node/.n8n/custom
exit
8. Test the custom node inside n8n
Open your local n8n instance at http://localhost:5678 and create a new workflow:
- Add a Manual Trigger as the start node.
- Add your custom node (search by the name you gave it, e.g. B24 Crypto Manager).
- Keep the default
symbolvalue (likeBTCUSDT) and execute the node. The node should return the current price as JSON.
To make the node input dynamic, insert a Set node before your custom node and add a field symbol with value ETHUSDT (or any other symbol). In the custom node configuration, use an expression to read that value:
{{$node["Set"].json["symbol"]}}Execute the workflow again. The custom node should now use the symbol supplied by the Set node and return the corresponding price.
Troubleshooting and tips
- If the custom node does not appear, ensure the files are in
/home/node/.n8n/custominside the container and restart the container. - Check n8n logs for build or runtime errors. Setting the log level to debug in your environment can reveal useful details.
- When preparing a package for publication, ensure the repository name starts with
n8n-nodes-. - Consider using a small script to automate build, copy, and restart steps. On Windows this can be a batch file; on macOS/Linux a shell script.
What’s next
This node uses a public, unauthenticated API. The logical next step is adding authentication to custom nodes (for services that require API keys or OAuth) and expanding the node to support multiple operations (historical prices, candlesticks, etc.). If you plan to publish the node, follow n8n community guidelines and make sure your package metadata is complete.
Summary
Creating and deploying a custom n8n node is straightforward: scaffold with the n8n node starter, implement the node logic (here using Binance’s public price endpoint), register the node in package.json, build, and copy the dist to /home/node/.n8n/custom in the running container. Once deployed, the node behaves just like any other n8n node and can be used in workflows, accept dynamic inputs, and return execution data for further processing.
Free Stuff! |
|
Check out this really cool thing |
| Click me |