AI Code Explainer is a bilingual coding buddy that turns confusing code into friendly explanations. Paste any snippet, pick the tone you prefer, and get practical insights in English or Bengaliβall powered by Groqβs llama-3.1-8b-instant model.
- Built by Shihab Labs β Founder & Full-Stack Developer at Shihablabs bringing agency-grade product polish.
- Bilingual output β Switch between English and Bengali explanations without leaving the page.
- Custom teaching styles β Choose explanation depth, style (detailed, concise, beginner), target audience, and whether to include examples.
- Quick start snippets β One-click sample snippets help you test the flow instantly.
- Dark/light aware β Theme toggle with persisted preference plus responsive layout built on shadcn/ui components.
- Helpful feedback β Friendly loading states, validation, and actionable error messages keep the UX smooth.
- Framework: Next.js 16 (App Router, Route Handlers)
- UI: React 19 + shadcn/ui + Radix UI
- Language: TypeScript
- Styling: Tailwind CSS 4 +
tailwind-merge - Icons: lucide-react
- AI runtime: Groq API (
llama-3.1-8b-instant)
Follow the steps below to set up the project locally.
- Node.js 18 or newer
- pnpm 9+ (or npm/yarn if you prefer)
- A Groq API key with access to
llama-3.1-8b-instant
git clone https://github.com/maker-shihab/ai-code-explainer.git
cd ai-code-explainer
pnpm install # or npm install / yarn installCreate a .env.local file in the project root:
GROQ_API_KEY=your_groq_api_keyOptional integrations already scaffolded in lib/ can use:
DEEPSEEK_API_KEY=optional_if_you_enable_deepseek
GOOGLE_GEMINI_API_KEY=optional_if_you_enable_gemini
HUGGING_FACE_API_KEY=optional_if_you_enable_huggingfacepnpm dev
# or: npm run dev / yarn devThen visit http://localhost:3000.
pnpm buildβ create a production buildpnpm startβ run the production serverpnpm lintβ check code quality with ESLint
- Paste or type your code into the Your Code editor.
- Adjust filters to match your learning needs (language, depth, style, target audience, examples).
- Hit Explain Code and wait a moment while Groq generates the response.
- Review the explanation in the AI Explanation panel and tweak settings if youβd like a different tone.
Tip: Use the Quick Start buttons to prefill common React/Python/JavaScript snippets for demos.
Crafted by Shihab Labs β Founder & Full-Stack Developer at Shihablabs delivering fast, human-centered web tools.
- Python Β· Node.js Β· Express.js
- JavaScript Β· TypeScript
- React Β· Next.js
- Shopify Β· Liquid
- HTML5 Β· CSS3 Β· Git
- MongoDB Β· PostgreSQL
app/page.tsxβ Client-side UI with state, validation, and user interactions.components/filters/advanced-filters.tsxβ Reusable filter and preference controls.app/api/explain/route.tsβ Next.js route handler that sanitizes input and proxies Groq.lib/groq.tsβ GroqService wrapper that crafts bilingual prompts and calls the API.types/index.tsβ Shared TypeScript contracts for requests/responses.app/providers/theme-provider.tsx&components/ui/theme-toggle.tsxβ Theming logic with persisted preferences.
POST /api/explain
curl -X POST http://localhost:3000/api/explain \
-H "Content-Type: application/json" \
-d '{
"code": "const greet = (name) => `Hello, ${name}!`;",
"language": "english",
"explanationStyle": "beginner",
"includeExamples": true,
"programmingLanguage": "auto",
"explanationDepth": "basic",
"targetAudience": "student"
}'The project is optimized for Vercel (default Next.js hosting), but any platform that supports Next.js 16 will work:
- Set environment variables in your hosting dashboard (
GROQ_API_KEYat minimum). - Run the production build:
pnpm build. - Serve with
pnpm startor let Vercel handle the build & deploy pipeline automatically.
This project is licensed under the MIT License.