Skip to content

About

πŸ€– An automated AI LeetCode mentor powered by n8n and DeepSeek. Intercepts accepted submissions, performs runtime & memory complexity reviews, and delivers optimal solution feedback straight to Telegram. Multi-user ready!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetCode Mentor Agent πŸ€–

An automated AI mentor that intercepts your accepted LeetCode submissions in real-time, requests a structured complexity & code review from DeepSeek Coder, and delivers a beautifully formatted report straight to your Telegram chat.

This version is designed as a multi-user ready system. The Chrome Extension allows each user to configure their own Telegram Chat ID and DeepSeek API Key, so you can share the extension with others without paying for their API usage!


πŸ› οΈ Prerequisites & Setup Guide

This project consists of two halves:

  1. The Chrome/Edge Extension (Client-side settings & trigger)
  2. The n8n Workflow (Server-side orchestrator)

πŸ‘€ Part 1: User Setup (Client-Side)

Each person who wants to use the extension should follow these steps:

Step 1: Set Up Telegram

To authorize the bot to send you messages:

  1. Open Telegram and search for the bot username provided by the host.
  2. Click Start (or send a message).
  3. Search for @userinfobot on Telegram and send it any message.
  4. Copy the Id (a string of numbers like 7731571949) that it sends back.

Step 2: Get a DeepSeek API Key

  1. Go to the DeepSeek Developer Platform.
  2. Create an account, navigate to API Keys, and generate a new key.
  3. Copy the key (it starts with sk-).

Step 3: Install and Configure the Extension

  1. Download the leetcode-mentor extension folder.
  2. Open Chrome or Edge and navigate to the extensions page:
    • Chrome: chrome://extensions/
    • Edge: edge://extensions/
  3. Toggle Developer mode (top-right corner) to ON.
  4. Click Load unpacked (top-left corner) and select the leetcode-mentor folder.
  5. In your browser toolbar, click the Puzzle Piece 🧩 icon, find LeetCode Mentor, and click the Pin (Eye) icon to show it on your bar.
  6. Click the robot icon in your toolbar to open the settings:
    • Paste your Telegram Chat ID from Step 1.
    • Paste your DeepSeek API Key from Step 2.
    • ⚠️ IMPORTANT: Do NOT include the word Bearer in this box. Just paste the raw key (e.g. sk-...).
  7. Click Save Settings.

πŸ–₯️ Part 2: Backend Setup (Host-Side)

If you are hosting the n8n server:

Step 1: Get the Telegram Bot Token

  1. Open Telegram, search for @BotFather, and send /newbot.
  2. Choose a name and username for your bot.
  3. Save the API Token BotFather gives you.

Step 2: Run and Configure n8n

  1. Launch n8n: Run the startup command in your terminal:
    npx n8n start
    (Open http://localhost:5678 in your browser once started).
  2. Import the Workflow:
    • Create a new, blank workflow in n8n.
    • Copy the entire content of n8n-workflow.json from this project folder.
    • Click inside your n8n workspace grid canvas and press Ctrl + V to paste it.
  3. Configure Bot Credentials:
    • Double-click the Telegram Send node.
    • Under Credential for Telegram API, click "Create New Credential" and paste your Telegram API Token from Step 1. Save it.
    • (Note: The Chat ID is now dynamic and is automatically extracted from the incoming extension webhook payload).
  4. Save and activate the workflow.

Step 3: Set Webhook Endpoint in Extension

  1. Copy the webhook URL from the Webhook Trigger node in n8n (use the Test URL for testing, and Production URL for permanent hosting).
  2. In the extension folder, open leetcode-mentor/content.js and set the URL on line 4:
    const N8N_WEBHOOK_URL = 'https://your-hosted-n8n-domain/webhook/leetcode-mentor';
  3. Save the file.

Step 4: Test the Setup πŸ§ͺ

  1. In n8n, click Listen for test event on the Webhook node (if testing).
  2. Open LeetCode, pick any problem (like Two Sum).
  3. Submit a correct solution.
  4. The Telegram bot will immediately send your review!

🎨 Premium Styling Features (Mobile & Desktop)

This workflow uses a clean HTML Parse Mode to deliver visually stunning cards to Telegram:

  • No Parser Crashes: Automatically translates raw < and > code brackets (like vector<int>) into HTML entities so the API does not error out.
  • Syntax Highlighted Code blocks: Optimal solutions are wrapped inside <pre><code class='language-[lang]'> for native syntax boxes in mobile and desktop.
  • Short Line Wrapping: Code lines are restricted to 45–50 characters so they don't break awkwardly on narrow mobile screens.
  • Dynamic Key Takeaway: Summarizes the single most important lesson from the problem in one sentence.
  • Motivational Quote: Appends an inspiring programming quote at the end of the review.

πŸ”’ Security Best Practices (Before Pushing to GitHub)

Before pushing this repository to a public GitHub repository, verify you haven't committed secrets:

  • n8n Workflow Configuration: The template file n8n-workflow.json is clean and uses placeholders (YOUR_TELEGRAM_CREDENTIAL_ID). Your Telegram Token and user API Keys are stored safely only inside n8n's local database and the Chrome Extension storage, keeping them out of your Git history!

About

πŸ€– An automated AI LeetCode mentor powered by n8n and DeepSeek. Intercepts accepted submissions, performs runtime & memory complexity reviews, and delivers optimal solution feedback straight to Telegram. Multi-user ready!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages