The app you’ll clone is a TanStack Start application deployed as a Cloudflare Worker using Alchemy. It’s built with:
- Cloudflare D1 (database)
- Cloudflare R2 (object storage)
- Cloudflare Queues (sending and receiving messages)
- Cloudflare Vectorize (vector database)
- Effect Atom (state management)
- Effect HTTP API (backend API)
- Effect OpenAI (@effect/ai-openai) (talking to OpenAI)
- LangChain (splitting text into chunks)
You’ll need two things to run the app:
- A free Cloudflare account (https://dash.cloudflare.com/sign-up).
- An OpenAI API key (https://platform.openai.com/api-keys). The app uses OpenAI’s embedding model to convert text into vectors and a text generation model to generate answers. This is the only part that costs money, but it’s minimal. Embedding the sample PDF and asking 20-30 questions will cost a few cents.
Note
I expect you to be familiar with the above tech stack. In the chapters ahead, I show complete code blocks but explain only the parts related to RAG.