Skip to content

NehaKale08/AI-Code-Explainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI Powered Code Explainer

Overview

AI Powered Code Explainer is a web application that explains Python and JavaScript code in simple English using Google's Gemini Large Language Model (LLM). The application accepts code snippets from users and generates easy-to-understand explanations along with functions used, variables used, key parts of the code, and time/space complexity.


Features

  • Explain Python code
  • Explain JavaScript code
  • AI-generated explanation in simple English
  • Displays Functions Used
  • Displays Variables Used
  • Highlights Key Parts of the Code
  • Estimates Time Complexity
  • Estimates Space Complexity
  • Suggests Optimized Code (when applicable)
  • Copy Explanation
  • Clear Input

Tech Stack

Frontend

  • HTML5
  • CSS3
  • JavaScript

Backend

  • Node.js
  • Express.js

AI Model

  • Google Gemini 2.5 Flash

Project Structure

AI-Code-Explainer
│
├── public
│   ├── index.html
│   ├── style.css
│   └── script.js
│
├── server.js
├── package.json
├── package-lock.json
├── README.md
└── .env.example

System Architecture

User
   │
   ▼
Frontend (HTML/CSS/JavaScript)
   │
HTTP Request
   │
   ▼
Node.js + Express Server
   │
Gemini API Request
   │
   ▼
Google Gemini LLM
   │
AI Response
   │
   ▼
Browser

AI Model Selection

Google Gemini 2.5 Flash was selected because it is:

  • Fast
  • Accurate
  • Easy to integrate
  • Suitable for explaining source code
  • Public Large Language Model

Technical Decisions

  • Express.js was used to create REST APIs.
  • HTML, CSS and JavaScript were chosen to keep the frontend lightweight.
  • Gemini API was used for AI-powered explanations.
  • Environment variables are stored in a .env file for security.

Installation

Clone the repository

git clone <repository-url>

Install dependencies

npm install

Create a .env file

GEMINI_API_KEY=YOUR_API_KEY

Run the project

node server.js

Open

http://localhost:3000

Example

Input

def add(a,b):
    return a+b

print(add(10,20))

Output

  • Explanation
  • Functions Used
  • Variables Used
  • Key Parts
  • Time Complexity
  • Space Complexity
  • Optimized Code (if applicable)

Future Enhancements

  • Syntax Highlighting
  • Download Explanation as PDF
  • Dark Mode
  • Multi-language Support
  • Code Comparison
  • File Upload Support

Screenshots

Home Page

Home

Python Example

Python

JavaScript Example

JavaScript

Optimized Code

Optimized

Author

Neha Kale

Bachelor of Engineering (Computer Engineering)

Savitribai Phule Pune University

About

An AI-powered web application that explains Python and JavaScript code using Google Gemini API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors