CloudMind Tutor is an AI-powered educational assistant designed to help developers learn Cloudflare's ecosystem (Workers, R2, Durable Objects). It serves as a real-time, low-latency coding companion that runs entirely on the Edge.
Live Demo: (https://cf_ai_cloudmind_tutor.hydro5monster.workers.dev)
This project is a serverless AI agent built exclusively on the Cloudflare Developer Platform. Unlike standard chatbots that forget you after every message, CloudMind Tutor remembers the context of your conversation.
- Brain (AI): Workers AI running the Llama 3.3 model (
@cf/meta/llama-3.3-70b-instruct-fp8-fast). - Memory (State): Durable Objects store chat history for persistent session context.
- Speed (Real-time): WebSockets provide a persistent connection for instant messaging.
- Context Aware: The bot remembers earlier messages so follow-up questions work naturally.
- Instant Feedback: Persistent WebSocket connections eliminate HTTP overhead, keeping latency ultra-low.
- Markdown & Code Highlighting: Responses include beautifully formatted code blocks for easy reading.
- Streaming Responses: The AI types out answers in real-time, mimicking a human thought process.
This project was architected specifically to optimize for Edge Latency and Data Sovereignty.
- Zero-Latency "Cold Starts": Unlike traditional serverless functions that shut down after use, our Durable Object maintains a "hot" WebSocket connection. This eliminates the handshake overhead for every message, making the chat feel instantaneous.
- Privacy-First AI: By using Workers AI directly on Cloudflare, user data never leaves the ecosystem. We do not make API calls to third-party providers, ensuring better privacy and control.
- Edge Storage: Conversation history is stored physically near the user in the Durable Object, rather than in a centralized database.
CloudMind Tutor is an AI-powered educational assistant designed to help developers learn Cloudflare's ecosystem (Workers, R2, Durable Objects). It serves as a real-time, low-latency coding companion that runs entirely on the Edge.
CloudMind Tutor is an AI-powered educational assistant built to help developers learn the Cloudflare ecosystem (Workers, R2, Durable Objects). It’s a real-time, context-aware coding tutor that runs entirely on the Edge.
Live Demo: https://cf_ai_cloudmind_tutor.hydro5monster.workers.dev
This project solves a common problem: learning a new platform is hard. CloudMind Tutor acts as a knowledgeable peer that:
- Teaches concepts: Explains complex topics like Durable Objects in simple terms.
- Writes code: Generates syntax-highlighted, copy-paste ready code snippets.
- Suggests topics: Dynamic Topic Chips shuffle through ideas (Workers, R2, KV) so you always know what to ask next.
This application is serverless and runs on Cloudflare's global network.
| Component | Technology | Why I Chose It |
|---|---|---|
| The Brain | Workers AI (Llama 3.3 70B) | I used the 70B model for expert-level coding advice and optimized the stream to handle its size smoothly. |
| The Memory | Durable Objects | Durable Objects let me store chat history with the user session, preserving context. |
| The Speed | WebSockets | Persistent WebSockets provide low latency compared to HTTP polling. |
| The UI | Vanilla HTML/JS | Zero frameworks: fast, clean client rendering with Markdown and syntax highlighting. |
-
Persistent context memory
- CloudMind uses Durable Objects to keep a sliding window of the conversation, enabling natural follow-ups.
-
Robust real-time streaming
- A raw stream parser using
TextDecoderprocesses server-sent events from the AI so large-model output streams reliably.
- A raw stream parser using
-
Smart UI / UX
- Dynamic Topic Chips: Buttons above the chat bar shuffle automatically to suggest next topics.
- One-Click Copy: Every code block includes a copy button for convenience.
- Session isolation: Each user gets a unique Session ID so chats remain private.
- Node.js (v18+)
- Wrangler CLI (
npm install -g wrangler) - A Cloudflare Account
- Clone the repo
git clone https://github.com/hydro5monster/cf_ai_cloudmind_tutor.git
cd cf_ai_cloudmind_tutor- Install dependencies
npm install- Check configuration
Ensure your
wrangler.json(orwrangler.toml) has the AI and Durable Object bindings:
{
"name": "cf_ai_cloudmind_tutor",
"ai": { "binding": "AI" },
"durable_objects": { "bindings": [{ "name": "CHAT_SESSION", "class_name": "ChatSession" }] }
}- Run development server
npx wrangler devOpen http://localhost:8787 in your browser.
- Deploy
npx wrangler deployDurable Objects were chosen because the WebSocket connection can live inside the object. This colocates chat state and the connection on the edge, reducing latency versus fetching history from a remote database per message.
MIT License. Built for the Cloudflare AI Challenge.