Fullstack RAG app for "Chat with your PDFs" built on Cloudflare
Top 57.7% on sourcepulse
This project provides a full-stack Retrieval Augmented Generation (RAG) application, "Chat with your PDFs," built entirely on Cloudflare's serverless ecosystem. It targets developers and users seeking a self-contained, performant AI application deployable on a global edge network, leveraging Cloudflare's integrated services for a streamlined experience.
How It Works
The application implements a hybrid RAG approach, combining Full-Text Search (FTS) on Cloudflare D1 (using BM25) with vector search on Cloudflare Vectorize. User queries are expanded into multiple variations, which are then executed against both datastores. Results from D1 and Vectorize are merged using Reciprocal Rank Fusion (RRF) to produce a ranked list of relevant context, which is then passed to an LLM for response generation. This hybrid strategy aims to provide more accurate and comprehensive context than either FTS or vector search alone.
Quick Start & Requirements
pnpm install
(or npm install
)./setup.sh
wrangler.toml
with D1 database ID and KV namespace ID..dev.vars
(Cloudflare Account ID required; Groq, OpenAI, Anthropic optional, with fallback to Workers AI).npm run dev
npm run deploy
Highlighted Details
Maintenance & Community
The project is maintained by RafalWilinski. Contact information for consulting is provided via Twitter and a personal website.
Licensing & Compatibility
Licensed under the MIT License. This permissive license allows for commercial use and integration into closed-source projects.
Limitations & Caveats
The project relies heavily on the Cloudflare ecosystem; deployment and operation are tied to Cloudflare services. Specific Cloudflare resource IDs (D1, KV) must be manually configured after initial setup.
11 months ago
1 week