Skip to main content

Build a RAG document chatbot with Supabase vector search and OpenRouter

Workflow preview

Workflow preview
100%
Build a RAG document chatbot with Supabase vector search and OpenRouter preview
Open on n8n.io

1. Workflow Overview

What this workflow does This workflow builds a Retrieval Augmented Generation (RAG) document chat assistant inside n8n using Supabase Vector Store and AI models. The workflow allows users to upload...

Best for

  • Internal Wiki automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.webhook, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenrouter, @n8n/n8n-nodes-langchain.vectorstoresupabase, n8n-nodes-base.respondtowebhook, n8n-nodes-base.googledrive, @n8n/n8n-nodes-langchain.documentdefaultdataloader

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Build a RAG document chatbot with Supabase vector search and OpenRouter
Workflow name
Build a RAG document chatbot with Supabase vector search and OpenRouter

What this workflow does

This workflow builds a Retrieval-Augmented Generation (RAG) document chat assistant inside n8n using Supabase Vector Store and AI models.

The workflow allows users to upload documents, convert them into embeddings, store them inside Supabase pgvector, and query them through an AI chat interface using semantic search.

When a user sends a question through the webhook endpoint, the workflow retrieves the most relevant document chunks from Supabase and uses an AI model to generate a grounded response based on the uploaded documents.

This template includes:

  • Document ingestion pipeline
  • Recursive text chunking
  • AI embeddings generation
  • Supabase vector storage
  • Semantic retrieval
  • AI-powered document question answering
  • Webhook API integration for frontend apps

How it works

The workflow is split into two main parts:

  1. Document ingestion pipeline
  • Downloads documents from Google Drive
  • Extracts text from PDFs
  • Splits text into smaller chunks
  • Generates embeddings using AI models
  • Stores embeddings inside Supabase pgvector
  1. RAG chat pipeline
  • Receives user questions through a webhook
  • Searches Supabase vector database for relevant content
  • Retrieves matching document chunks
  • Sends retrieved context to the AI model
  • Returns grounded responses back to the frontend

Requirements

  • n8n instance
  • Supabase account with pgvector enabled
  • Google Drive account
  • AI provider credentials (OpenRouter, Gemini, or OpenAI)

Setup

  1. Create a Supabase project and enable pgvector
  2. Create the required documents table and match_documents function
  3. Connect your Supabase credentials in n8n
  4. Connect your AI model credentials
  5. Add your Google Drive credentials
  6. Upload your documents and run the ingestion workflow
  7. Use the webhook endpoint to connect your frontend application

Setup typically takes around 15–30 minutes.

How to customize

You can customize this workflow by:

  • Switching AI providers (Gemini, OpenRouter, OpenAI)
  • Adjusting chunk size and retrieval count
  • Connecting your own frontend UI
  • Adding support for multiple document sources
  • Expanding the workflow into a multi-user knowledge assistant

This workflow is designed as a practical starting point for building AI-powered document assistants and RAG applications inside n8n.

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 - Sticky Note

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

Block 2 - Sticky Note1

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

Block 3 - Chat Request Webhook

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

Block 4 - RAG Document Assistant

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 5 - OpenRouter LLM

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 6 - Supabase Vector Retriever

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.3

Block 7 - Return AI Response

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.5

Block 8 - Google Drive PDF Downloader

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

Block 9 - Supabase Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.3

Block 10 - Document Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1.1

Block 11 - Gemini Embedding Model

Type / Role
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini - embeddingsGoogleGemini
Config choices
Version 1

Block 12 - Recursive Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 13 - Sticky Note2

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

Block 14 - Sticky Note3

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

Block 15 - Sticky Note4

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

3. Summary Table

Workflow Build a RAG document chatbot with Supabase vector search and OpenRouter
Complexity advanced
Nodes 15
Categories Internal Wiki, AI RAG
Author Mariyan Nijan
Published 16 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15751/15751.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 Build a RAG document chatbot with Supabase vector search and OpenRouter do?

What this workflow does This workflow builds a Retrieval Augmented Generation (RAG) document chat assistant inside n8n using Supabase Vector Store and AI models. The workflow allows users to upload...

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 Internal Wiki, AI RAG use case.