A beginner-friendly AI-powered service that explains C++ code.
Built with Groq API (free), Gradio (web UI), and Python (backend)
- 🎯 Beginner-Focused: Explains code simply, without technical jargon
- ⚡ Fast: Groq API provides responses in < 1 second
- 🆓 Free: 14,400+ free API requests/day
- 🏗️ Clean Architecture: Modular design (UI, Core Logic, LLM layers)
- 🧪 Well-Tested: Includes verification script
- Python 3.6+
- Free Groq API key
# 1. Clone repository
git clone https://github.com/Yossef-moftah-dev/Code-Explainer
cd Code-Explainer
# 2. Run setup script
chmod +x setup.sh
./setup.sh# 1. Clone repository
git clone https://github.com/Yossef-moftah-dev/Code-Explainer
cd Code-Explainer
# 2. Run setup script
./setup.sh┌─────────────────────────────────────────┐
│ Presentation (Gradio UI) │
│ src/main.py │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Core Logic (Processing) │
│ src/core/processor.py │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Infrastructure (Groq API + Prompting) │
│ src/llm/client.py, src/llm/prompts.py │
└─────────────────────────────────────────┘
| File | Purpose |
|---|---|
src/main.py |
Gradio UI + orchestration |
src/core/processor.py |
Input validation & output formatting |
src/llm/client.py |
Groq API gateway |
src/llm/prompts.py |
RTCCF prompt engineering |
- Frontend: Gradio - Easy web UI
- Backend: Python 3.8+
- LLM: Groq API - Fast inference
- Model: Kimi k2 (or alternatives)
- Prompt Engineering: RTCCF framework with few-shot learning
See .env.example for template.
CodeExplainer/
├── src/
│ ├── main.py # Entry point
│ ├── core/
│ │ └── processor.py # Input/output processing
│ └── llm/
│ ├── client.py # Groq API client
│ └── prompts.py # Prompt templates
├── .env.example # Configuration template
├── requirements.txt # Dependencies
├── setup.sh # Automated setup
├── README.md # GitHub README
- Copy
.env.example→.env - Add your Groq API key
- Find other model on Groq webiste
- Update model in
.env - Restart app
Edit src/main.py:
app.launch(server_port=7861) # Change portTopics covered:
- ✅ Layered architecture
- ✅ Design patterns (Facade, Adapter, Strategy)
- ✅ Prompt engineering (RTCCF framework)
- ✅ API integration
- ✅ Python best practices
- ✅ Error handling
Built with ❤️ for C++ learners everywhere
⭐ If you find this helpful, please star the repository!