Here's how you can get the project running on your own computer.
You'll need to have Node.js and npm installed. You can download them from nodejs.org.
You'll also need a code editor, like Visual Studio Code.
First, you'll need to download the code from GitHub. You can do this by opening up a terminal (on Linux/macOS) or PowerShell (on Windows) and running the following command:
git clone https://github.com/shubham-x06/leetcode_ai_extension.git
Next, you'll need to install all the dependencies for both the frontend and the backend.
For the backend:
cd leetcode_ai_extension/backend
npm install
The backend needs an API key to talk to the AI.
An API key is like a password that lets your code use someone else's service.
In this case, it's the GROQ_API_KEY
.
You'll need to add to a file called .env.example
in the backend folder your API key:
GROQ_API_KEY=YOUR_API_KEY_HERE
You can get an API key from groq.com.
Now you can build and run the backend server.
npm run dev
You should see a message in your terminal that says:
Server running at http://localhost:3001
Finally, you'll need to load the extension into your browser.
- Open Chrome and go to
chrome://extensions
. - Turn on Developer mode in the top right corner.
- Click Load unpacked and select the frontend folder from the project.
Now, when you go to a LeetCode problem page, you should see the AI hint widget!
Error: Could not connect to backend server
- This means that the backend server isn't running.
Make sure you've run
npm run dev
in the backend folder and that you see the "Server running" message.
Error: Failed to get hint from AI
- This could mean that your API key is incorrect or that there's a problem with the AI service.
Double-check your
.env
file and make sure your API key is correct.