https://github.com/rcosta358/cf_ai_code_reviewer
Lightweight AI code review application powered by Cloudflare Workers AI
https://github.com/rcosta358/cf_ai_code_reviewer
ai-code-review cloudflare cloudflare-workers cloudflare-workers-ai code-analysis code-review
Last synced: 11 days ago
JSON representation
Lightweight AI code review application powered by Cloudflare Workers AI
- Host: GitHub
- URL: https://github.com/rcosta358/cf_ai_code_reviewer
- Owner: rcosta358
- License: mit
- Created: 2026-04-25T11:33:04.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-27T12:39:59.000Z (about 2 months ago)
- Last Synced: 2026-04-27T14:20:11.929Z (about 2 months ago)
- Topics: ai-code-review, cloudflare, cloudflare-workers, cloudflare-workers-ai, code-analysis, code-review
- Language: TypeScript
- Homepage: https://ai-code-reviewer.r1c4rdco5t4-f9d.workers.dev
- Size: 377 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# AI Code Reviewer
**Lightweight AI code review application powered by Cloudflare Workers AI**


[](LICENSE)
[Demo](https://github.com/user-attachments/assets/e8d733ac-7d78-4a58-ac6c-d042df8c1aba)
---
This project was implemented for the Software Engineering Internship assignment, built with Codex using GPT-5.5 (Medium).
The prompts used can be found in [`PROMPTS.md`](./PROMPTS.md).
## Features
- Structured AI code review with actionable feedback
- Covers multiple aspects of code quality (correctness, security, maintainability, performance, style, documentation, and other)
- Each issue is annotated with an explanation, suggestion, severity, confidence level, and source code position
- Overall rating and summary of the review
- Persistent review storage
- Follow-up chat for follow-up questions and iterative review
## Workflow
1. User submits code
2. Backend sends code and system prompt to the LLM
3. LLM returns structured review in a JSON schema
4. Review is stored and displayed
5. User can use the chat to ask follow-up questions or provide additional context
Example of the structured review feedback returned by the LLM:
```json
{
"summary": "...",
"rating": 7.5,
"issues": [
{
"type": "correctness",
"severity": "high",
"message": "...",
"suggestion": "...",
"confidence": "high",
"location": { "line": 12, "column": 5 }
}
]
}
```
## Architecture
- **Frontend** (React, Vite, Worker Static Assets): user interface to paste code, view review results, manage sessions, and chat about a review
- **Backend** (Cloudflare Worker): handles API requests, validates payloads, calls the LLM, and stores/retrieves sessions
- **LLM** (Workers AI, Llama 3.3): performs code analysis and generates structured feedback
- **Database** (Cloudflare KV): stores reviews
- **Client Storage** (Local Storage): stores session id (for indexing in KV) and user preferences
```mermaid
flowchart LR
Start(( )) --> Frontend
Frontend --> CW["Cloudflare Worker"]
CW --> WAI["Workers AI"]
WAI --> Llama["Llama 3.3"]
CW --> KV["Cloudflare KV"]
Frontend --> LS["Local Storage"]
```
## Getting Started
### Deployed App
This app is deployed on Cloudflare Workers and can be accessed at:
https://ai-code-reviewer.r1c4rdco5t4-f9d.workers.dev
### Local Setup
Requirements:
- Node.js
- npm
- A Cloudflare account
Clone and install dependencies:
```sh
git clone https://github.com/rcosta358/cf_ai_code_reviewer
cd cf_ai_code_reviewer/app
npm install
```
You can set the `VITE_USE_MOCK_REVIEW` variable in `.env.development` to `true` to use a mock review response without calling Workers AI, which is useful for development without consuming AI credits.
Then, login to your Cloudflare account and create a new Cloudflare KV namespace:
```sh
npx wrangler login
npx wrangler kv namespace create SESSIONS_KV
```
Then, update `wrangler.jsonc` with the generated KV namespace id.
Finally, run the development server and open the app in your browser at `http://localhost:5173`:
```sh
npm run dev
```
To deploy the app to Cloudflare Workers, run:
```sh
npm run deploy
```
## References
- https://agents.cloudflare.com
- https://workers.cloudflare.com
- https://developers.cloudflare.com/workers-ai
- https://developers.cloudflare.com/kv