A modern, AI-powered code review tool built with Next.js 14, Monaco Editor, and OpenAI. Select code, ask questions, and get intelligent feedback in real-time.
# Install dependencies
npm install
# Start development server
npm run dev
# Open http://localhost:3000- Monaco Editor - Full VS Code editing experience with syntax highlighting for 18+ languages
- AI Code Review - Get intelligent feedback on selected code using OpenAI GPT-4
- Multiple Threads - Create independent review threads for different code sections
- Visual Indicators - See which code has active threads with gutter highlights
- Thread Management - Resolve, reopen, and delete review threads
- Conversation History - Follow-up questions maintain context within threads
- Keyboard Shortcuts - Enter to send, Cmd/Ctrl+Enter for multi-line
Create a .env.local file in the project root:
# Use mock provider (no API key needed - great for demos)
AI_PROVIDER=mock
# OR use OpenAI (requires API key)
AI_PROVIDER=openai
OPENAI_API_KEY=sk-your-api-key-here
OPENAI_MODEL=gpt-4o-mini # or gpt-4o for better quality| Provider | Description | API Key Required |
|---|---|---|
mock |
Returns simulated responses for testing/demos | No |
openai |
Uses OpenAI's GPT models for real AI reviews | Yes |
app/
├── page.tsx # Main application with state management
├── api/ai/route.ts # AI endpoint (Node.js runtime)
├── layout.tsx # Root layout with dark mode
└── globals.css # Tailwind + custom styles
components/
├── Editor/
│ └── CodeEditor.tsx # Monaco wrapper with thread decorations
├── Threads/
│ ├── ThreadPanel.tsx # Thread list + conversation view
│ ├── ThreadCard.tsx # Thread preview cards
│ ├── MessageBubble.tsx # Chat message display
│ └── ThreadInput.tsx # Message input with keyboard shortcuts
├── Toolbar/
│ └── Toolbar.tsx # Language selector + Ask AI button
└── ui/ # shadcn/ui components
lib/ai/
├── index.ts # AI provider factory
├── types.ts # TypeScript interfaces
├── providers/
│ ├── mock.ts # Mock provider for testing
│ └── openai.ts # OpenAI integration
└── prompts/
└── code-review.ts # Prompt engineering
hooks/
├── useThreads.ts # Thread state management
└── useAI.ts # AI API interaction
Each thread tracks its own loading state independently, allowing users to switch between threads and ask questions while another thread is processing.
The AI layer uses a factory pattern with pluggable providers, making it easy to:
- Test with mock responses (no API costs)
- Switch between OpenAI models
- Add new providers (Anthropic, Ollama, etc.)
Thread indicators are rendered using Monaco's decoration API, providing:
- Gutter dots for threads
- Line highlighting for selected code
- Hover tooltips with thread info
- Click-to-navigate functionality
- Empty code gracefully handled
- Long code selections truncated with "Show more" toggle
- No selection shows helpful tooltip on Ask AI button
- Error messages displayed inline and as auto-dismissing toasts
| Decision | Trade-off | Reason |
|---|---|---|
| In-memory storage | Data lost on refresh | MVP speed, no backend complexity |
| Single file only | No multi-file projects | Focused on core review experience |
| No authentication | Anyone can use | Prototype scope |
| Node.js runtime | Slightly slower than Edge | OpenAI SDK compatibility |
- Supabase Integration - Persist threads and conversations across sessions
- Streaming Responses - Real-time AI output as it generates
- Diff View - Show suggested code changes with accept/reject
- Multi-file Support - Review entire projects with file tree
- Collaborative Features - Share review sessions via URL
- Export Functionality - Generate markdown report of all threads
- Language Auto-Detection - Automatically detect code language
- Framework: Next.js 14 (App Router)
- Editor: Monaco Editor (VS Code's editor)
- Styling: Tailwind CSS + shadcn/ui
- AI: OpenAI GPT-4o-mini (configurable)
- Language: TypeScript
This project was built using Claude Code (Anthropic's AI coding assistant) for:
- Rapid prototyping and iteration
- Component architecture decisions
- TypeScript type definitions
- Bug fixing and debugging
- Documentation generation
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # Run TypeScript compilerMIT