← Open Source
RafalWilinski

cloudflare-rag

Fullstack "Chat with your PDFs" RAG (Retrieval Augmented Generation) app built fully on Cloudflare.

ApplicationsResearch & knowledgeTypeScript
Open on GitHub
Momentum
+0stars in 24 hours0.0%
606
Stars
93
Forks
+0
This week
2
Contributors
Created 2024-08-26 · Updated 2026-10-01 · #16198 today
Top developers

RafalWilinski/cloudflare-rag is ranked 16,198 with 606 stars.

Same-category comparison

RafalWilinski/cloudflare-rag is ranked 16,198 among these 8 peers; CharlesPikachu/AIGames is ranked 16,195.

Same-category comparison
NameRankMetrics
zhang17173/Event-Extraction16,185
Language:
Python
Stars:
608
Forks:
132
aryn-ai/sycamore16,191
Language:
Python
Stars:
607
Forks:
71
Description:
🍁 Sycamore is an LLM-powered search and analytics platform for unstructured data.
yanx27/EverybodyDanceNow_reproduce_pytorch16,194
Language:
Python
Stars:
607
Forks:
172
Description:
Everybody dance now reproduced in pytorch.
CharlesPikachu/AIGames16,195
Language:
Python
Stars:
606
Forks:
187
Description:
use AI to play some games.
minghao-wu/transagents16,221
Stars:
605
Forks:
29
Description:
The official repository of the paper "(Perhaps) Beyond Human Translation: Harnessing Multi-Agent Collaboration for Translating Ultra-Long Literary Texts".
jackson-video-resources/claude-tradingview-mcp-trading16,229
Language:
JavaScript
Stars:
604
Forks:
302
Description:
Connect Claude Code to TradingView and execute trades automatically via BitGet.
mckaywrigley/repo-chat16,232
Language:
Python
Stars:
604
Forks:
104
wexare-ai/openbrowserclaw16,234
Language:
TypeScript
Stars:
604
Forks:
83
Description:
Browser-native personal AI assistant. Zero infrastructure, the browser is the server.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguageTypeScript
CategoryApplications
SubcategoryResearch & knowledge
KeywordsRAG, Talk-to-your-docs
Stars606
Forks93
Contributors2
Created date2024-08-26
Updated date2026-10-01
Stars in 1 day0
Stars in 7 days0
Rank16,198
Previous rank15,988
Rank change-210
7-day stars rank15,399
Previous 7-day stars rank15,407
7-day stars rank change8
Total stars rank16,658
Previous total stars rank16,631
Total stars rank change-27
CountryPoland
README summary

Fullstack Cloudflare RAG This is a fullstack example of how to build a RAG (Retrieval Augmented Generation) app with Cloudflare. It uses Cloudflare Workers, Pages, D1, KV, R2, AI Gateway and Workers AI. Demo Features: Every interaction is streamed to the UI using Server-Sent Events Hybrid RAG using Full-Text Search on D1 and Vector Search on Vectorize Switchable between various providers (OpenAI, Groq, Anthropic) using AI Gateway with fallbacks Per-IP Rate limiting using Cloudflare's KV OCR is

running inside Cloudflare Worker using unpdf Smart Placement automatically places your workloads in an optimal location that minimizes latency and speeds up your applications Development Make sure you have Node, pnpm and wrangler CLI installed. Install dependencies: Deploy necessary primitives: Then, in , set the to your D1 database id and to your rate limiter KV namespace id. Then, create a file with your API keys: If you don't have these keys, will fallback to Workers AI. Run the dev server

: And access the app at . Deployment Having the necessary primitives setup, first setup secrets: Then, deploy your app to Cloudflare Pages: Hybrid Search RAG This project uses a combination of classical Full Text Search (sparse) against Cloudflare D1 and Hybrid Search with embeddings against Vectorize (dense) to provide the best of both worlds providing the most applicable context to the LLM. We take user input and we rewrite it to 5 different queries using an LLM 2. We run each

of these queries against our both datastores - D1 database using BM25 for full-text search and Vectorize for dense retrieval 3. We take the results from both datastores and we merge them together using Reciprocal Rank Fusion which provides us with a single list of results 4. We then take the top 10 results from this list and we pass them to the LLM to generate a response License This project is licensed under the terms of the MIT License

. Consulting If you need help in building AI applications, please reach out to me on Twitter or via my website.

Frequently asked questions

How many stars and forks are recorded?

RafalWilinski/cloudflare-rag has 606 stars and 93 forks.

What is the repository rank?

RafalWilinski/cloudflare-rag is ranked 16,198.

What language and category are recorded?

RafalWilinski/cloudflare-rag has 606 stars, uses TypeScript and belongs to Applications.

Which repository is closest in rank?

RafalWilinski/cloudflare-rag is compared with CharlesPikachu/AIGames, ranked 16,195 with 606 stars.

README

Fullstack Cloudflare RAG

This is a fullstack example of how to build a RAG (Retrieval Augmented Generation) app with Cloudflare. It uses Cloudflare Workers, Pages, D1, KV, R2, AI Gateway and Workers AI.

https://github.com/user-attachments/assets/cbaa0380-7ad6-448d-ad44-e83772a9cf3f

Demo

Features:

  • Every interaction is streamed to the UI using Server-Sent Events
  • Hybrid RAG using Full-Text Search on D1 and Vector Search on Vectorize
  • Switchable between various providers (OpenAI, Groq, Anthropic) using AI Gateway with fallbacks
  • Per-IP Rate limiting using Cloudflare's KV
  • OCR is running inside Cloudflare Worker using unpdf
  • Smart Placement automatically places your workloads in an optimal location that minimizes latency and speeds up your applications

Development

Make sure you have Node, pnpm and wrangler CLI installed.

Install dependencies:

pnpm install # or npm install

Deploy necessary primitives:

./setup.sh

Then, in wrangler.toml, set the d1_databases.database_id to your D1 database id and kv_namespaces.rate_limiter to your rate limiter KV namespace id.

Then, create a .dev.vars file with your API keys:

CLOUDFLARE_ACCOUNT_ID=your-cloudflare-account-id # Required
GROQ_API_KEY=your-groq-api-key # Optional
OPENAI_API_KEY=your-openai-api-key # Optional
ANTHROPIC_API_KEY=your-anthropic-api-key # Optional

If you don't have these keys, /api/stream will fallback to Workers AI.

Run the dev server:

npm run dev

And access the app at http://localhost:5173/.

Deployment

Having the necessary primitives setup, first setup secrets:

npx wrangler secret put CLOUDFLARE_ACCOUNT_ID
npx wrangler secret put GROQ_API_KEY
npx wrangler secret put OPENAI_API_KEY
npx wrangler secret put ANTHROPIC_API_KEY

Then, deploy your app to Cloudflare Pages:

npm run deploy

Hybrid Search RAG

This project uses a combination of classical Full Text Search (sparse) against Cloudflare D1 and Hybrid Search with embeddings against Vectorize (dense) to provide the best of both worlds providing the most applicable context to the LLM.

The way it works is this:

  1. We take user input and we rewrite it to 5 different queries using an LLM
  2. We run each of these queries against our both datastores - D1 database using BM25 for full-text search and Vectorize for dense retrieval
  3. We take the results from both datastores and we merge them together using Reciprocal Rank Fusion which provides us with a single list of results
  4. We then take the top 10 results from this list and we pass them to the LLM to generate a response

License

This project is licensed under the terms of the MIT License.

Consulting

If you need help in building AI applications, please reach out to me on Twitter or via my website. Happy to help!

Nearby in the ranking
Similar items