CodeBuddy is an AI-powered coding companion built with Next.js. It supports two workflows in one app:
- Code review with structured issues, explanations, and refactored output.
- Code translation between popular programming languages.
- Two modes in the same UI:
Code ReviewandCode Translator. - Syntax-highlighted code editor for input and output.
- Review results with severity, line references, summary, and suggested refactor.
- Translation flow that returns raw translated code.
- Responsive layout with light/dark theme support.
- Client-provided OpenAI API key stored in browser local storage.
- Next.js 16 (App Router)
- React 19 + TypeScript
- Tailwind CSS 4
- OpenAI SDK (
gpt-4o) - Framer Motion
- PrismJS + prism-react-renderer
- Node.js 20+
- npm
npm install
npm run devOpen http://localhost:3000.
- Enter your OpenAI API key in the top input.
- Choose
Code RevieworCode Translator. - Paste code and select language(s).
- Run the action and review the generated output.
The API key is saved in local storage under openai_api_key.
Request body:
{
"code": "string",
"language": "javascript",
"apiKey": "sk-..."
}Response shape:
{
"issues": [{ "line": 1, "message": "string", "severity": "low" }],
"refactoredCode": "string",
"explanation": "string"
}Request body:
{
"code": "string",
"sourceLanguage": "javascript",
"targetLanguage": "python",
"apiKey": "sk-..."
}Response shape:
{
"translatedCode": "string"
}npm run dev: Start development server.npm run build: Build production app.npm run start: Run production server.npm run lint: Run ESLint.
app/page.tsx: Main interface and mode switching.app/api/review/route.ts: Review API endpoint.app/api/translate/route.ts: Translation API endpoint.components/*: UI components for editor, review view, and translation flow.