AutomationFlowsData & Sheets › Sync Supabase Products to Local Postgres

Sync Supabase Products to Local Postgres

Original n8n title: 🔄 Sync Productos Supabase → Local (fixed)

🔄 Sync Productos Supabase → Local (FIXED). Uses supabase, postgres. Scheduled trigger; 7 nodes.

Cron / scheduled trigger★★★★☆ complexity7 nodesSupabasePostgres
Data & Sheets Trigger: Cron / scheduled Nodes: 7 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "\ud83d\udd04 Sync Productos Supabase \u2192 Local (FIXED)",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "id": "11cd3cfd-6e1a-48fd-a1cf-2866de082ab6",
      "name": "\u23f0 Cada Hora",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "tableId": "products",
        "limit": 500
      },
      "id": "066c8aae-7edc-41d7-bfe2-ff19f9561733",
      "name": "\ud83d\udce5 Obtener Productos Supabase",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        224,
        0
      ],
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Transformar Y guardar en memoria para despu\u00e9s del DELETE\nconst staticData = $getWorkflowStaticData('global');\nconst productos = [];\n\nfor (const item of $input.all()) {\n  const p = item.json;\n  \n  productos.push({\n    supabase_id: p.id,\n    name: p.name || 'Sin nombre',\n    slug: p.slug || null,\n    description: p.description || null,\n    price: parseFloat(p.price) || 0,\n    discount_price: p.discount_price ? parseFloat(p.discount_price) : null,\n    category_name: p.category?.name || p.category_name || null,\n    category_id: p.category_id || null,\n    main_image_url: p.main_image_url || p.image_url || null,\n    stock: parseInt(p.stock) || 100,\n    is_active: p.is_active !== false,\n    is_featured: p.is_featured === true,\n    synced_from_supabase_at: new Date().toISOString()\n  });\n}\n\n// Guardar en memoria est\u00e1tica\nstaticData.productosParaInsertar = productos;\nstaticData.totalProductos = productos.length;\n\n// Retornar un item dummy para continuar el flujo\nreturn [{ json: { mensaje: `${productos.length} productos listos para insertar`, continuar: true } }];"
      },
      "id": "65e4218f-d8c8-495c-a836-04c554514af7",
      "name": "\ud83d\udd04 Transformar y Guardar",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        448,
        0
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "DELETE FROM productos_tienda;",
        "options": {}
      },
      "id": "9d4167e1-aa4d-44a1-ae1a-29cb87681855",
      "name": "\ud83d\uddd1\ufe0f Limpiar Tabla",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2,
      "position": [
        672,
        0
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Recuperar productos guardados en memoria\nconst staticData = $getWorkflowStaticData('global');\nconst productos = staticData.productosParaInsertar || [];\n\nif (productos.length === 0) {\n  throw new Error('No hay productos para insertar. El flujo fall\u00f3.');\n}\n\n// Limpiar memoria despu\u00e9s de recuperar\ndelete staticData.productosParaInsertar;\n\n// Retornar los productos como items para insertar\nreturn productos.map(p => ({ json: p }));"
      },
      "id": "recover-products",
      "name": "\ud83d\udce4 Recuperar Productos",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        896,
        0
      ]
    },
    {
      "parameters": {
        "operation": "insert",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "productos_tienda"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        },
        "options": {}
      },
      "id": "942abbbc-c6c7-4fc1-9016-c5d974f26cd8",
      "name": "\ud83d\udcbe Insertar Productos",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.3,
      "position": [
        1120,
        0
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT COUNT(*) as total_productos FROM productos_tienda;",
        "options": {}
      },
      "id": "fe55504d-62b4-4083-a904-393759e48fb8",
      "name": "\u2705 Verificar Total",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2,
      "position": [
        1344,
        0
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "\u23f0 Cada Hora": {
      "main": [
        [
          {
            "node": "\ud83d\udce5 Obtener Productos Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udce5 Obtener Productos Supabase": {
      "main": [
        [
          {
            "node": "\ud83d\udd04 Transformar y Guardar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd04 Transformar y Guardar": {
      "main": [
        [
          {
            "node": "\ud83d\uddd1\ufe0f Limpiar Tabla",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\uddd1\ufe0f Limpiar Tabla": {
      "main": [
        [
          {
            "node": "\ud83d\udce4 Recuperar Productos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udce4 Recuperar Productos": {
      "main": [
        [
          {
            "node": "\ud83d\udcbe Insertar Productos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcbe Insertar Productos": {
      "main": [
        [
          {
            "node": "\u2705 Verificar Total",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

🔄 Sync Productos Supabase → Local (FIXED). Uses supabase, postgres. Scheduled trigger; 7 nodes.

Source: https://github.com/maurixio8/tus-aguacates/blob/aecc54e1cbe447b064ec8b8280ee23bbf08cddce/n8n-workflows/workflow-sync-FIXED.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

This workflow is a multi-system document synchronization pipeline built in n8n, designed to automatically sync and back up files between Microsoft SharePoint, Supabase/Postgres, and Google Drive.

HTTP Request, Supabase, Postgres +1
Data & Sheets

🔄 Sync Productos Supabase → Local (LISTO). Uses supabase, postgres. Scheduled trigger; 9 nodes.

Supabase, Postgres
Data & Sheets

Disparador 1.8. Uses itemLists, postgres, emailSend, httpRequest. Scheduled trigger; 85 nodes.

Item Lists, Postgres, Email Send +1
Data & Sheets

공유회_알림톡_크론. Uses postgres, httpRequest, n8n-nodes-solapi. Scheduled trigger; 39 nodes.

Postgres, HTTP Request, N8N Nodes Solapi
Data & Sheets

QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.

Postgres, Postgres Trigger, HTTP Request