Skip to main content

Reindex markdown RAG chunks with Supabase pgvector and webhooks

Workflow preview

Workflow preview
100%
Reindex markdown RAG chunks with Supabase pgvector and webhooks preview
Open on n8n.io

1. Workflow Overview

Quick Overview This workflow reindexes Markdown documentation into a Supabase Postgres pgvector table by fetching source docs from an HTTP API, chunking and embedding them via a Supabase Edge Funct...

Best for

  • Document Extraction automation workflows
  • AI RAG automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.httprequest, n8n-nodes-base.code, n8n-nodes-base.postgres, n8n-nodes-base.splitinbatches, n8n-nodes-base.webhook, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Reindex markdown RAG chunks with Supabase pgvector and webhooks
Workflow name
Reindex markdown RAG chunks with Supabase pgvector and webhooks

Quick Overview

This workflow reindexes Markdown documentation into a Supabase Postgres pgvector table by fetching source docs from an HTTP API, chunking and embedding them via a Supabase Edge Function, upserting the vectors, and deleting stale chunks on a daily schedule or on-demand webhook.

How it works

  1. Runs daily on a schedule or triggers when a POST request hits the webhook endpoint.
  2. Fetches Markdown sources (for example FAQ and blog posts) from a configured HTTP API endpoint.
  3. Strips frontmatter, splits content on H2 sections, chunks long sections with overlap, and batches chunks for embedding.
  4. For each batch, calls a Supabase Edge Function to generate embeddings for the chunk texts.
  5. Upserts each chunk’s source, index, content, and pgvector embedding into a Supabase Postgres rag_chunks table using conflict updates.
  6. After processing batches, deletes rows in rag_chunks whose updated_at timestamp is older than the current run to remove stale chunks.

Setup

  1. Add an HTTP Header Auth credential for the sources API request and for calling the Supabase Edge Function.
  2. Add Supabase Postgres credentials with access to the database where the vector table lives.
  3. Create a public.rag_chunks table with a pgvector embedding column (matching your model’s dimensions) and a primary key on (source, chunk_idx).
  4. Update the sources API URL, the Supabase Edge Function /embed URL, and (optionally) the daily schedule time and batch/chunk sizing constants to match your environment.

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 - Schedule: Daily Reindex

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.3

Block 2 - Fetch Sources (FAQ + Blog)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 3 - Chunk and Batch

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

Block 4 - Delete Stale Chunks

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 5 - Embed Batch (Supabase)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 6 - Build Upsert SQL

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

Block 7 - Upsert Chunks

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 8 - Loop Batches

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 9 - Deploy Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2.1

Block 10 - Sticky Note 1

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

Block 11 - Sticky Note 2

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

3. Summary Table

Workflow Reindex markdown RAG chunks with Supabase pgvector and webhooks
Complexity intermediate
Nodes 11
Categories Document Extraction, AI RAG
Author Filip Mijic
Published 15 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16370/16370.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 Reindex markdown RAG chunks with Supabase pgvector and webhooks do?

Quick Overview This workflow reindexes Markdown documentation into a Supabase Postgres pgvector table by fetching source docs from an HTTP API, chunking and embedding them via a Supabase Edge Funct...

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 Document Extraction, AI RAG use case.