# 🟢 Beginner’s Guide to n8n Automation

## Build a “Weather Data Every Minute” Workflow (with & without Docker)

Automation can save hours of manual work—but coding full-blown services is daunting if you’re new to development.  
**n8n** changes that by letting you drag, drop, and connect nodes to create workflows visually.

In this guide you’ll learn:

* What n8n is and why it’s useful
    
* How to **install n8n two ways**: with Docker and without Docker
    
* How to **import and run a sample workflow** that generates random weather data every minute
    
* How each node in the workflow works
    
* Extra ideas to help you create your own automations
    

Let’s get started!

---

## 1️⃣ What Is n8n?

n8n (pronounced “n-eight-n”) is an open-source automation platform.  
Think of it like a programmable version of tools such as Zapier or IFTTT:

* **Visual builder** – create flows by connecting nodes instead of writing boilerplate code.
    
* **Over 350 ready-made nodes** – HTTP requests, Slack, Google Sheets, Databases, GitHub, and many more.
    
* **Self-hosted or cloud** – run on your own server for full control.
    

---

## 2️⃣ Install n8n

You can run n8n either inside a **Docker container** (simple and portable) or directly on your system (no Docker needed).  
Pick the method you prefer.

### A. Install with Docker (Recommended)

1. **Create a folder** for n8n:
    
    ```bash
    mkdir n8n && cd n8n
    ```
    
2. **docker-compose.yml**:
    
    ```bash
    version: "3.9"
    services:
      n8n:
        image: n8nio/n8n
        ports:
          - "5678:5678"
        environment:
          - N8N_BASIC_AUTH_ACTIVE=true
          - N8N_BASIC_AUTH_USER=admin
          - N8N_BASIC_AUTH_PASSWORD=strongpassword
          - TZ=Asia/Kolkata
        volumes:
          - ./n8n_data:/home/node/.n8n
    ```
    
3. **Start it**:
    
    ```bash
    docker compose up -d
    ```
    
4. Visit **http://&lt;your-server-ip&gt;:5678** and log in with `admin / strongpassword`.
    

---

### B. Install without Docker (Native Node.js)

If you’d rather skip Docker:

```bash
# Update packages
sudo apt update && sudo apt upgrade -y

# Install Node.js 18 or newer
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs build-essential

# Install n8n globally
sudo npm install -g n8n
```

Optional but recommended security:

```bash
export N8N_BASIC_AUTH_ACTIVE=true
export N8N_BASIC_AUTH_USER=admin
export N8N_BASIC_AUTH_PASSWORD=strongpassword
```

Run:

```bash
n8n
```

Open **http://&lt;your-server-ip&gt;:5678** in a browser.

> ✅ Tip: For production, create a systemd service so n8n starts automatically on reboot.

---

## 3️⃣ Import the Weather Workflow

Download or copy the following JSON into a file called **weather-workflow.json**:

```json
{
  "name": "Weather Data Every Minute (Enhanced)",
  "nodes": [
    {
      "parameters": {
        "triggerTimes": [
          {
            "mode": "everyMinute"
          }
        ]
      },
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [150, 300]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "city",
              "value": "London"
            }
          ]
        },
        "options": {}
      },
      "name": "Set City",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [350, 300]
    },
    {
      "parameters": {
        "functionCode": "const conditions = ['Sunny', 'Cloudy', 'Rainy', 'Windy', 'Snowy'];\nreturn [{\n  json: {\n    city: $json.city,\n    temperature: Math.floor(Math.random() * 16) + 15, // 15-30\n    condition: conditions[Math.floor(Math.random() * conditions.length)],\n    humidity: Math.floor(Math.random() * 41) + 40, // 40-80\n    wind: Math.floor(Math.random() * 21) + 5 // 5-25\n  }\n}];"
      },
      "name": "Random Weather",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [550, 300]
    },
    {
      "parameters": {
        "value": "={{$now}}",
        "custom": true,
        "toFormat": "yyyy-MM-dd HH:mm:ss",
        "options": {}
      },
      "name": "Date & Time",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 1,
      "position": [750, 300]
    },
    {
      "parameters": {
        "responseMode": "lastNode",
        "options": {}
      },
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [950, 300]
    }
  ],
  "connections": {
    "Cron": {
      "main": [
        [
          {
            "node": "Set City",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set City": {
      "main": [
        [
          {
            "node": "Random Weather",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Random Weather": {
      "main": [
        [
          {
            "node": "Date & Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
```

1. Go to the n8n web interface.
    
2. Click **Workflows → Import from File**.
    
3. Select the file and save.
    

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1758130000754/2b6831db-2b94-462b-841a-b1e890d29a48.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1758130039613/5890a90a-5e3b-4120-aa68-e98aab9bd3ba.png align="center")

## 4️⃣ Understand the Nodes

Here’s what each node in **Weather Data Every Minute (Enhanced)** does:

| Node | What It Does | Why It Matters |
| --- | --- | --- |
| **Cron** | Triggers the workflow every minute. | Acts as a scheduler—no manual clicks needed. |
| **Set City** | Adds a static `city: "London"` field. | Lets you define default data for downstream nodes. |
| **Random Weather (Function)** | Runs a small JavaScript snippet to create random `temperature`, `condition`, `humidity`, and `wind`. | Shows how to add custom logic beyond built-in nodes. |
| **Date & Time** | Adds the current timestamp formatted as `YYYY-MM-DD HH:mm:ss`. | Useful for logs or time-stamped records. |
| **Respond to Webhook** | Outputs the final JSON. | Lets other apps or people call the endpoint and get the data. |

When active, every minute this workflow generates output similar to:

```json
{
  "city": "London",
  "temperature": 24,
  "condition": "Sunny",
  "humidity": 65,
  "wind": 14,
  "date": "2025-09-17 22:30:00"
}
```

---

## 5️⃣ Test It

1. **Activate** the workflow (toggle in the top right).
    
2. Use curl or a browser to hit the test URL shown in the “Respond to Webhook” node:
    
    ```bash
    curl http://<your-ip>:5678/webhook/<your-path>
    ```
    
3. You’ll see fresh weather data each time you call it.
    

---

## 6️⃣ Fun Extensions

This simple example is just the start.  
Here are some beginner-friendly ideas:

* **Log to a Database** – Add a PostgreSQL or MySQL node to store each weather record.
    
* **Send Alerts** – Add an Email or Slack node to notify if the temperature crosses a threshold.
    
* **Google Sheets Dashboard** – Append each new data point to a sheet for easy charts.
    
* **Real API Calls** – Replace the Random Weather function with an HTTP Request node calling a real API such as OpenWeatherMap.
    

---

## 7️⃣ Key Takeaways for Beginners

* **Visual First** – You don’t need to be a developer to start; drag-and-drop gets you far.
    
* **Two Easy Installs** – Docker for convenience, Node.js if you prefer native.
    
* **Reusable** – The same workflow can run locally, in the cloud, or on a Raspberry Pi.
