Skip to main content

πŸŽ“ Learn Code Node (JavaScript) with an Interactive Hands-On Tutorial

Workflow preview

Workflow preview
100%
πŸŽ“ Learn Code Node (JavaScript) with an Interactive Hands-On Tutorial preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

How it works This workflow is a hands on tutorial for the Code node in n8n, covering both basic and advanced concepts through a simple data processing task. 1. Provides Sample Data: The workflow be...

Best for

  • Miscellaneous automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.set, n8n-nodes-base.splitout, n8n-nodes-base.code, n8n-nodes-base.stickynote, n8n-nodes-base.manualtrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Lucas Peyrin.

Original n8n.io source

1.1 Workflow description

Title
πŸŽ“ Learn Code Node (JavaScript) with an Interactive Hands-On Tutorial
Workflow name
πŸŽ“ Learn Code Node (JavaScript) with an Interactive Hands-On Tutorial

How it works

This workflow is a hands-on tutorial for the Code node in n8n, covering both basic and advanced concepts through a simple data processing task.

  1. Provides Sample Data: The workflow begins with a sample list of users.
  2. Processes Each Item (Run Once for Each Item): The first Code node iterates through each user to calculate their fullName and age. This demonstrates basic item-by-item data manipulation using $input.item.json.
  3. Fetches External Data (Advanced): The second Code node showcases a more advanced feature. For each user, it uses the built-in this.helpers.httpRequest function to call an external API (genderize.io) to enrich the data with a predicted gender.
  4. Processes All Items at Once (Run Once for All Items): The third Code node receives the fully enriched list of users and runs only once. It uses $items() to access the entire list and calculate the averageAge, returning a single summary item.
  5. Create a Binary File: The final Code node gets the fully enriched list of users once again and creates a binary CSV file to show how to use binary data Buffer in JavaScript.

Set up steps

Setup time: < 1 minute

This workflow is a self-contained tutorial and requires no setup.

  1. Explore the Nodes: Click on each of the Code nodes to read the code and the comments explaining each step, from basic to advanced.
  2. Run the Workflow: Click "Execute Workflow" to see it in action.
  3. Check the Output: Click on each node after the execution to see how the data is transformed at each stage. Notice how the data is progressively enriched.
  4. Experiment! Try changing the data in the 1. Sample Data node, or modify the code in the Code nodes to see what happens.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - 1. Sample Data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 2 - 2. Split Out Users

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 3 - 3. Process Each User

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - 5. Calculate Average Age

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - 4. Fetch External Data (Advanced)

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - 6. Create a Binary File (Expert)

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Start Tutorial

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 13 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow πŸŽ“ Learn Code Node (JavaScript) with an Interactive Hands-On Tutorial
Complexity intermediate
Nodes 14
Categories Miscellaneous
Author Lucas Peyrin
Published 27 Jun 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5407/5407.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does πŸŽ“ Learn Code Node (JavaScript) with an Interactive Hands-On Tutorial do?

How it works This workflow is a hands on tutorial for the Code node in n8n, covering both basic and advanced concepts through a simple data processing task. 1. Provides Sample Data: The workflow be...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Miscellaneous use case.