AI-powered code assistant
Chat with Llama 3.3 70B, get debugging help, and run multi-step code reviews - with persistent memory.
- Streaming AI Chat - Real-time streaming responses from Llama 3.3 70B via Workers AI
- Conversation Memory - Messages persist across page reloads using Durable Objects with SQLite
- Project Context - Set your project details so the AI gives tailored responses
- Multi-Step Code Review - Paste code and get a 3-step review via Cloudflare Workflows
- Landing + App - Marketing site at
/, assistant at/app/ - Dark/Light Theme - Toggle between themes with a Cloudflare-inspired palette
┌─────────────────────────────┐
│ Vercel (codistant.v-ai.org)│
│ / Landing page │
│ /app/ Chat UI │
└─────────────┬───────────────┘
│ fetch(API_BASE + /api/...)
┌─────────▼──────────┐
│ Cloudflare Worker │ cf-ai-codistant.*.workers.dev
└──┬─────────────┬───┘
│ │
┌──────▼───┐ ┌──────▼──────────────┐
│ Durable │ │ Workflow │
│ Object │ │ (CodeReview) │
│ Session │ │ Analyze → Issues → │
│ + SQLite │ │ Improvements │
└────┬─────┘ └─────────┬───────────┘
└────────┬─────────┘
┌──────▼──────┐
│ Workers AI │
│ Llama 3.3 │
└─────────────┘
| Component | Technology |
|---|---|
| Frontend | Static HTML/CSS/JS on Vercel (codistant.v-ai.org) |
| LLM | Llama 3.3 70B (@cf/meta/llama-3.3-70b-instruct-fp8-fast) via Workers AI |
| State/Memory | Durable Objects with embedded SQLite |
| Workflow | Cloudflare Workflows |
| Backend | Cloudflare Workers (TypeScript) |
- Node.js >= 18
- A Cloudflare account (free tier works)
- A Vercel account for the frontend
- Wrangler CLI (via
npx)
git clone https://github.com/VishalPatil18/codistant.git
cd codistant
npm installnpx wrangler loginnpm run devThis starts the Worker (and optionally serves frontend/ assets) at http://localhost:8787.
frontend/config.js uses a same-origin API base when the UI is served from port 8787. On Vercel / production it points at:
https://cf-ai-codistant.vishalrp18100.workers.dev
npm run deployLive API: https://cf-ai-codistant.<your-subdomain>.workers.dev
After CORS or API changes, redeploy the Worker before testing the Vercel site.
- Import the GitHub repo in Vercel
- Set Root Directory to
frontend - Framework Preset: Other (no build command)
- Attach domain
codistant.v-ai.org - Deploy
Routes:
| Path | File |
|---|---|
/ |
frontend/index.html (landing) |
/app/ |
frontend/app/index.html (chat) |
The Worker allows:
https://codistant.v-ai.org*.vercel.app(preview deployments)- Local static / wrangler origins (
localhost:8787,:3000,:5500)
Streaming chat responses also include Access-Control-Allow-Origin.
| Method | Path | Description |
|---|---|---|
POST |
/api/chat |
Send a chat message. Body: { message, sessionId }. Returns SSE stream. |
GET |
/api/history?sessionId=xxx |
Get conversation history for a session. |
DELETE |
/api/history |
Clear history. Body: { sessionId }. |
POST |
/api/context |
Set user context. Body: { sessionId, key, value }. |
GET |
/api/context?sessionId=xxx |
Get all saved context for a session. |
POST |
/api/review |
Start a code review workflow. Body: { sessionId, code, language }. Returns { instanceId }. |
GET |
/api/review?instanceId=xxx |
Poll code review workflow status. |
codistant/
├── src/
│ ├── index.ts # Worker entry point & API router
│ ├── cors.ts # Allowed origins / CORS headers
│ ├── chat-session.ts # Durable Object: conversation memory & AI chat
│ ├── code-review-workflow.ts # Workflow: 3-step code review
│ └── types.ts # Shared TypeScript types
├── frontend/
│ ├── index.html # Landing page
│ ├── landing.js # Landing theme + hero mock
│ ├── styles.css # Shared design system + landing styles
│ ├── config.js # CODISTANT_API_BASE
│ ├── logo.svg
│ ├── vercel.json
│ └── app/
│ ├── index.html # Chat UI
│ └── app.js # Client logic (SSE, sessions, markdown)
├── wrangler.toml
├── package.json
├── README.md
└── PROMPTS.md
- User sends a message from
/app/ - The browser calls the Worker
/api/chat - The Worker routes to the user's Durable Object (
sessionId) - The DO stores the message, builds a prompt, and streams Workers AI over SSE
- The full reply is saved to SQLite for later context
- User pastes code and clicks Run Code Review
- The Worker creates a Cloudflare Workflow instance
- Three sequential AI steps run (with retries): analyze → find issues → suggest improvements
- The browser polls until complete and shows the report
npm run deploy- publish Worker with latest CORS / API- Push or redeploy Vercel project (root
frontend) - Confirm
https://codistant.v-ai.org/(landing) and/app/(chat) - Smoke-test chat streaming, history, context, and code review from the Vercel origin
- Commit locally when you are ready (this repo does not auto-commit)
wrangler devsimulates Durable Objects / Workflows and proxies Workers AI (requireswrangler login)- SQLite data for local DO state lives under
.wrangler/ - Override the API target in the browser console if needed:
window.CODISTANT_API_BASE = "https://..."