Hono
GitHub Repository
You can find the project source code on GitHub.
This guide provides detailed, step-by-step instructions on how to use Upstash RAG Chat with Hono. You can also explore our Cloudflare Workers - Hono example for detailed, end-to-end examples and best practices.
Project Setup
Create a new Hono application with cloudflare-workers
template and install @upstash/rag-chat
package.
Setup Upstash Redis
Create a Redis database using Upstash Console or Upstash CLI and copy the UPSTASH_REDIS_REST_URL
and UPSTASH_REDIS_REST_TOKEN
into your .dev.vars
file.
Setup Upstash Vector
Create a Vector index using Upstash Console or Upstash CLI and copy the UPSTASH_VECTOR_REST_URL
and UPSTASH_VECTOR_REST_TOKEN
into your .dev.vars
file.
Setup QStash LLM
Navigate to QStash Console and copy the QSTASH_TOKEN
into your .dev.vars
file.
Create a Hono App
@upstash/redis/cloudflare
package and setting cache
to false
in the Index
constructor to be able to work in Cloudflare Workers, these are not related to Hono.Update /src/index.ts
:
Run
Run the Hono application locally:
Visit http://localhost:8787
Deploy
For deployment, use the wrangler
CLI to securely set environment variables. Run the following command for each secret:
Replace SECRET_NAME
with the actual name of each environment variable (e.g., UPSTASH_REDIS_REST_URL
).
Deploy the Hono application: