{
  "id": "9H9ejftVvqcyq41z",
  "name": "Evaluating the KeyValue Community Node",
  "tags": [],
  "nodes": [
    {
      "id": "2ccbdfe4-0f78-4281-8a01-1b9752c668c2",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1536,
        -528
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "67ebfe97-49a8-4fdb-8a41-3bf30d4203f8",
      "name": "workflowid",
      "type": "n8n-nodes-keyvalue.keyValue",
      "onError": "continueErrorOutput",
      "position": [
        -1280,
        -528
      ],
      "parameters": {
        "resource": "counter",
        "operation": "get",
        "counterName": "={{ $workflow.id }}"
      },
      "typeVersion": 1
    },
    {
      "id": "d5dfbb7e-0810-496b-9aae-9663eaaea897",
      "name": "alreadyexecuted",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -992,
        -704
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f390c17e-ceae-4346-8d32-cdc6d1f1e84e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        -560
      ],
      "parameters": {
        "color": 5,
        "width": 464,
        "height": 304,
        "content": "## The very first time the workflow is executed, this logic is processed, and will never be again\nUse a Counter based on $workflow.id"
      },
      "typeVersion": 1
    },
    {
      "id": "882260ab-c796-409c-b0d6-280d746dc78e",
      "name": "check_value",
      "type": "n8n-nodes-keyvalue.keyValue",
      "onError": "continueErrorOutput",
      "position": [
        -1472,
        128
      ],
      "parameters": {
        "key": "={{ $workflow.id }}",
        "resource": "record",
        "directoryName": "businessprocess"
      },
      "typeVersion": 1
    },
    {
      "id": "0932de91-e0a0-49ff-a1aa-6ef066fe9508",
      "name": "run_your_logic",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1008,
        144
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ed760b1a-f1f7-45d0-bace-e55d59ce4f36",
      "name": "logic_already_executed",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1008,
        -128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "69324234-2087-43de-a198-9e455e581d81",
      "name": "logic_executed",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -768,
        144
      ],
      "parameters": {
        "key": "={{ $workflow.id }}",
        "value": "={{ $now.format('yyyy-MM-dd') }}",
        "resource": "record",
        "operation": "write",
        "frontmatter": {},
        "directoryName": "=businessprocess"
      },
      "typeVersion": 1
    },
    {
      "id": "557c77ff-39cd-4b8a-92da-831d3533a2e2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        32
      ],
      "parameters": {
        "color": 5,
        "width": 448,
        "height": 272,
        "content": "## Workflow can be executed once a day only\nUse a Key Value based on $workflow.id"
      },
      "typeVersion": 1
    },
    {
      "id": "486beb52-0d8a-467a-b5a3-d0a5658f59f7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1632,
        -768
      ],
      "parameters": {
        "color": 7,
        "width": 1104,
        "height": 560,
        "content": "# 1] Run a specific logic when the workflow is executed the first time\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1445fc98-39c9-4a2f-a5f9-e68b19f75156",
      "name": "specific_logic",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -992,
        -416
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e164cf99-7781-48d5-8c32-392e4d9b9d6e",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1632,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 1104,
        "height": 560,
        "content": "# 2] This workflow can be executed only once a day\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e5e6aa78-9a40-496e-b87f-d3aa0f55a928",
      "name": "flag_workflowid",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -800,
        -416
      ],
      "parameters": {
        "resource": "counter",
        "counterName": "={{ $workflow.id }}"
      },
      "typeVersion": 1
    },
    {
      "id": "f934f9fc-6b3c-4f21-91c7-b3d21c03cd10",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -624
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 528,
        "content": "## Which counters have been set ? Select the 'counters' directory, then list the records\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8102ba49-ef27-49b3-b9e4-98bfa34b0f1d",
      "name": "select_counters",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -448,
        -480
      ],
      "parameters": {
        "operation": "list",
        "directoryFilter": "counters"
      },
      "typeVersion": 1
    },
    {
      "id": "a54a7e33-7268-4658-8495-3c8412377e06",
      "name": "list_counters",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -208,
        -480
      ],
      "parameters": {
        "resource": "record",
        "operation": "list",
        "directoryName": "={{ $json.directory }}"
      },
      "typeVersion": 1
    },
    {
      "id": "7921bcd8-5b2b-49ae-83f4-249508720c78",
      "name": "reset_counter",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -448,
        -272
      ],
      "parameters": {
        "resource": "counter",
        "operation": "reset",
        "counterName": "loop"
      },
      "typeVersion": 1
    },
    {
      "id": "3960e899-bc94-4b8d-bc9d-b6468fd7b1cc",
      "name": "increment_counter",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -208,
        -272
      ],
      "parameters": {
        "resource": "counter",
        "counterName": "loop"
      },
      "typeVersion": 1
    },
    {
      "id": "2c1d11d4-ec72-4a75-96ff-0ec9a684a9cc",
      "name": "get_counter",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        0,
        -272
      ],
      "parameters": {
        "resource": "counter",
        "operation": "get",
        "counterName": "loop"
      },
      "typeVersion": 1
    },
    {
      "id": "35d6b78a-8877-4eac-85d9-da7f702ba0d4",
      "name": "create_directory",
      "type": "n8n-nodes-keyvalue.keyValue",
      "onError": "continueErrorOutput",
      "position": [
        0,
        -64
      ],
      "parameters": {
        "directoryName": "toto"
      },
      "typeVersion": 1
    },
    {
      "id": "0109c1a4-1bed-40e7-989f-a4c2412d6ec3",
      "name": "write_record",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -448,
        144
      ],
      "parameters": {
        "key": "k1",
        "resource": "record",
        "operation": "write",
        "frontmatter": {},
        "directoryName": "dir1"
      },
      "typeVersion": 1
    },
    {
      "id": "5e40f084-b009-4417-aaea-2fa16d3703be",
      "name": "list_records",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -224,
        144
      ],
      "parameters": {
        "resource": "record",
        "operation": "list",
        "directoryName": "dir1"
      },
      "typeVersion": 1
    },
    {
      "id": "e2c2ce44-f632-4fd5-b18d-52a7239b5a3e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2800,
        -624
      ],
      "parameters": {
        "width": 1104,
        "height": 1408,
        "content": "# Evaluating the KeyValue Community Node\n\n## Summary  \nThe **KeyValue** node provides a lightweight filesystem-based key-value store for n8n, allowing you to store, retrieve, list and delete key-value pairs using plain directories and text files. It can also act as a simple **Counter** system to persist and increment values across workflow executions without relying on an external database. The node is available on [GitHub](https://github.com/stephaneheckel/n8n-nodes-keyvalue) and published on [npm](https://www.npmjs.com/package/n8n-nodes-keyvalue). \n\n## When to use this node  \n\nUse **KeyValue** when you need simple, local persistence in your workflows without adding extra infrastructure. It is **not** a replacement for a full database; think of it as a convenient local key-value store that trades scalability and querying for simplicity. \n\n## How it works (datamodel)  \n\nUnder the hood, the node uses your n8n host filesystem as a store:\n\n- A **root directory** (for example `~/.n8n-keyvalue/`) contains all key-value data. \n- Each key maps to a file on disk; the **filename is the key**, and the **file content is the value**. \n- Operations (set, get, list, delete) are simple file operations, so persistence depends entirely on how your n8n instance mounts and preserves that directory. \n\n## Node Installation\n- Goto Settings / Community node and install **n8n-nodes-keyvalue**\n- Read the [README](https://github.com/stephaneheckel/n8n-nodes-keyvalue)\n\n## How to use the template  \n\nThis template is split into two parts to showcase both the counter and key-value features:\n\n1. **Part 1 \u2013 Counter feature**  \n   - Run the workflow once and observe the initial counter value.  \n   - Re-run it and check what is executed\n\n2. **Part 2 \u2013 KeyValue feature**  \n   - Run the second part to create, read, list, and delete keys in the store.  \n   - Inspect the execution data to see how keys and values are represented and how you can reference them in subsequent nodes. \n\n## Requirements  \n- **KeyValue** Community Node : n8n-nodes-keyvalue\n- **n8n** version: tested on 2.26.8 (Ubuntu & Windows 11)\n\n## Need Help?\nFeel free to comment this [post](https://www.linkedin.com/posts/n8n-about_n8n-keyvalue-activity-7474559561253818368-KjI6/).\nContact me on [LinkedIn](https://www.linkedin.com/in/stephaneheckel/) or ask in the [Forum](https://community.n8n.io/)!\n\n## Limitations and caveats  \n\nTo avoid surprises in production:\n\n- No **concurrency control**: Concurrent writes to the same key could overwrite each other.  \n- No **transactions** or partial rollbacks: Each operation is a simple file write or delete.  \n- No built-in **TTL / expiration**: Cleanup or rotation logic must be implemented in your workflows.  \n- **Plain-text** storage: Values are written as-is; do not store secrets unless your filesystem and host are secured appropriately."
      },
      "typeVersion": 1
    },
    {
      "id": "f63ad82e-4192-4403-aad1-a72b1c849133",
      "name": "json_as_text",
      "type": "n8n-nodes-base.set",
      "position": [
        -1248,
        688
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c3fc1ee4-be7a-4618-8686-5495d892498e",
              "name": "text",
              "type": "string",
              "value": "[     {         \"firstName\": \"James\",         \"lastName\": \"Mitchell\",         \"address\": {             \"line1\": \"14 Baker Street\",             \"line2\": \"Marylebone\",             \"city\": \"London\",             \"postcode\": \"NW1 6XE\",             \"country\": \"UK\"         },         \"telephone\": \"+1234567890\",         \"mobile\": \"+1234567890\",         \"email\": \"user@example.com\",         \"dateOfBirth\": \"1985-03-12\",         \"company\": \"Mitchell Consulting Ltd\",         \"role\": \"Director\",         \"active\": true     },     {         \"firstName\": \"Sarah\",         \"lastName\": \"Thompson\",         \"address\": {             \"line1\": \"742 Evergreen Terrace\",             \"city\": \"Springfield\",             \"state\": \"IL\",             \"zipCode\": \"62701\",             \"country\": \"US\"         },         \"telephone\": \"+1234567890\",         \"mobile\": \"+1234567890\",         \"email\": \"user@example.com\",         \"dateOfBirth\": \"1990-07-28\",         \"company\": \"Acme Corp\",         \"role\": \"Senior Engineer\",         \"active\": true     },     {         \"firstName\": \"Oliver\",         \"lastName\": \"Bennett\",         \"address\": {             \"line1\": \"Flat 3, 27 Canning Street\",             \"city\": \"Edinburgh\",             \"postcode\": \"EH3 8EG\",             \"country\": \"UK\"         },         \"telephone\": \"+1234567890\",         \"mobile\": \"+1234567890\",         \"email\": \"user@example.com\",         \"dateOfBirth\": \"1978-11-05\",         \"company\": \"Bennett & Co Solicitors\",         \"role\": \"Partner\",         \"active\": false     } ]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f8ce85d6-8f90-43e7-a8da-883c0c0ffea1",
      "name": "write_json",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -1008,
        688
      ],
      "parameters": {
        "key": "sample",
        "value": "={{ $json.text }}",
        "resource": "record",
        "operation": "write",
        "frontmatter": {},
        "directoryName": "json"
      },
      "typeVersion": 1
    },
    {
      "id": "c420d8e3-1c45-45e4-8e58-d468f0ee6673",
      "name": "read_json",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -784,
        688
      ],
      "parameters": {
        "key": "sample",
        "mode": "body",
        "resource": "record",
        "directoryName": "json"
      },
      "typeVersion": 1
    },
    {
      "id": "a7675b2a-1a7a-4a14-87b8-65e1291c1cfd",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -560,
        688
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "value"
      },
      "typeVersion": 1
    },
    {
      "id": "92aff5ee-db5c-4324-816a-b02106713fb0",
      "name": "extract_values",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        704
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4e50971f-8f6e-4cbe-8697-661317d45bed",
              "name": "firstName",
              "type": "string",
              "value": "={{ $json.firstName }}"
            },
            {
              "id": "b32aa6de-627f-4217-9674-f9ed924d986f",
              "name": "lastName",
              "type": "string",
              "value": "={{ $json.lastName }}"
            },
            {
              "id": "b360f17d-2f38-441c-9141-0e94856a14e7",
              "name": "city",
              "type": "string",
              "value": "={{ $json.address.city }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "206a4727-d878-40a0-849a-d102f620fd3e",
      "name": "loop_json",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -336,
        688
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "b1f109bd-86be-4d0d-a35a-81f4728d963a",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1648,
        432
      ],
      "parameters": {
        "color": 7,
        "width": 1072,
        "height": 560,
        "content": "# 3] Auto-detect/parsing JSON\nWhen you write a record whose value is a valid JSON object or array ({...} / [...]), it is stored as structured JSON and automatically parsed back on Read and List:\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0cc21386-6281-4d06-b5da-b7dae1dcab9c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        592
      ],
      "parameters": {
        "color": 5,
        "width": 448,
        "height": 272,
        "content": "## Auto-detect JSON\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5f447719-da73-496b-ab3b-1dc3db3c81c5",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        240,
        144
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "820f5c47-ec98-435d-98c0-dfa7890f012e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.exists }}",
              "rightValue": false
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a199fbe8-2d20-4c1d-aa03-5315a407d4fc",
      "name": "exists",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        32,
        144
      ],
      "parameters": {
        "key": "k6",
        "resource": "record",
        "operation": "exists",
        "directoryName": "dir1"
      },
      "typeVersion": 1
    },
    {
      "id": "a348c442-e66a-4104-90c2-6decf2972535",
      "name": "count_records",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -208,
        432
      ],
      "parameters": {
        "resource": "record",
        "operation": "count",
        "directoryName": "dir1"
      },
      "typeVersion": 1
    },
    {
      "id": "e4af11ea-c3e9-41d6-8fa5-5908c0c80ff3",
      "name": "list_records1",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -448,
        432
      ],
      "parameters": {
        "resource": "record",
        "operation": "list",
        "directoryName": "dir1"
      },
      "typeVersion": 1
    },
    {
      "id": "23e9ca25-55ef-447c-adeb-79a592646f48",
      "name": "list_directories",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -448,
        -64
      ],
      "parameters": {
        "operation": "list"
      },
      "typeVersion": 1
    },
    {
      "id": "343b35de-422e-4873-8355-18d26a7d4ad9",
      "name": "Append to a record",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        32,
        432
      ],
      "parameters": {
        "key": "k1",
        "value": "={{ $now.format('yyyy-MM-dd HH:mm:ss.SSS') }}",
        "resource": "record",
        "operation": "append",
        "separator": "\\n",
        "directoryName": "dir1"
      },
      "typeVersion": 1
    },
    {
      "id": "60bc9a34-51c6-403c-a456-0d2491ecfd47",
      "name": "Delete records",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        272,
        432
      ],
      "parameters": {
        "resource": "record",
        "keyFilter": "k1",
        "operation": "delete",
        "directoryName": "dir1"
      },
      "typeVersion": 1
    },
    {
      "id": "e1209f5c-aab5-412a-97f9-38f172de9d25",
      "name": "Delete directory",
      "type": "n8n-nodes-keyvalue.keyValue",
      "position": [
        -208,
        -64
      ],
      "parameters": {
        "operation": "delete",
        "directoryName": "toto"
      },
      "typeVersion": 1
    },
    {
      "id": "2db898bd-3a32-45e8-b6fa-764f3e1f40d9",
      "name": "If_today",
      "type": "n8n-nodes-base.if",
      "position": [
        -1264,
        32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0ffc8ac8-70e2-4924-99b6-0431210bd5a8",
              "operator": {
                "type": "dateTime",
                "operation": "equals"
              },
              "leftValue": "={{ $json.value }}",
              "rightValue": "={{ $now.format('yyyy-MM-dd') }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "739cf122-d3fd-4985-95dd-3f7ed12f1835",
  "nodeGroups": [],
  "connections": {
    "exists": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If_today": {
      "main": [
        [
          {
            "node": "logic_already_executed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "run_your_logic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "loop_json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "loop_json": {
      "main": [
        [],
        [
          {
            "node": "extract_values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "read_json": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "workflowid": {
      "main": [
        [
          {
            "node": "alreadyexecuted",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "specific_logic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "write_json": {
      "main": [
        [
          {
            "node": "read_json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check_value": {
      "main": [
        [
          {
            "node": "If_today",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "run_your_logic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "json_as_text": {
      "main": [
        [
          {
            "node": "write_json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "list_records": {
      "main": [
        []
      ]
    },
    "write_record": {
      "main": [
        []
      ]
    },
    "list_counters": {
      "main": [
        []
      ]
    },
    "list_records1": {
      "main": [
        []
      ]
    },
    "extract_values": {
      "main": [
        [
          {
            "node": "loop_json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "run_your_logic": {
      "main": [
        [
          {
            "node": "logic_executed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "specific_logic": {
      "main": [
        [
          {
            "node": "flag_workflowid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "select_counters": {
      "main": [
        [
          {
            "node": "list_counters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "create_directory": {
      "main": [
        []
      ]
    },
    "increment_counter": {
      "main": [
        []
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "workflowid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}