Skip to content

LeetBuddy is a Google Chrome Extension that users can open on any LeetCode problem, and unlock various tools, oriented around interview preparation and coding education, in order to learn and code more efficiently.

License

Notifications You must be signed in to change notification settings

LeetBuddyAI/LeetBuddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetBuddy Logo

LeetBuddy

AI-Powered LeetCode Assistant

License: MIT Chrome Web Store Node.js Version

Website β€’ Chrome Extension β€’ Report Bug β€’ Request Feature


Table of Contents


About

LeetBuddy is a free, open-source Chrome extension that provides AI-powered assistance for LeetCode problems. It helps developers improve their coding interview skills by offering contextual hints, explanations, edge case generation, and an interactive whiteboard - all without leaving the LeetCode page.

Why LeetBuddy?

  • Learn, Don't Cheat: Get hints and guidance without spoiling the solution
  • Context-Aware: Automatically understands the problem, your code, and your progress
  • 100% Free: No paywalls, subscriptions, or hidden costs
  • Open Source: Transparent, community-driven development
  • Privacy-Focused: No tracking or data collection

Features

πŸ€– Smart AI Assistant

  • Natural Language Chat: Ask questions in plain English
  • Context Detection: Automatically reads problem statements, constraints, and your code
  • Streaming Responses: Real-time AI responses for better UX

πŸ’‘ Intelligent Hints

  • Progressive Hints: Get just enough help without revealing the solution
  • Edge Case Generator: Discover test cases you might have missed
  • Complexity Analysis: Understand time/space complexity of your approach

✏️ Interactive Whiteboard

  • Visual Diagrams: Draw trees, graphs, arrays, and data structures
  • Image Recognition: AI analyzes your drawings to provide explanations
  • Persistent Sessions: Chat history saved per problem

🎨 Developer Experience

  • Multiple Modes: Chat and Whiteboard interfaces
  • Syntax Highlighting: Beautiful code rendering with Prism.js
  • Markdown Support: Rich text formatting in responses
  • Session Management: Conversations persist across page refreshes

Architecture

LeetBuddy uses a microservices architecture with Docker containerization:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         NGINX (Port 80)                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Static     β”‚ /health          β”‚ /api/LLM              β”‚  β”‚
β”‚  β”‚ Files      β”‚ (Health Check)   β”‚ (Extension API)       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚               β”‚                    β”‚
       β–Ό               β–Ό                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Website    β”‚ β”‚   Website    β”‚   β”‚  Extension   β”‚
β”‚   Frontend   β”‚ β”‚   Backend    β”‚   β”‚   Backend    β”‚
β”‚              β”‚ β”‚              β”‚   β”‚              β”‚
β”‚ React + Vite β”‚ β”‚ Express.js   β”‚   β”‚ Express.js   β”‚
β”‚ TailwindCSS  β”‚ β”‚ (Port 3001)  β”‚   β”‚ (Port 3002)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                                           β”‚
                                           β–Ό
                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                    β”‚    Redis     β”‚
                                    β”‚  (Upstash)   β”‚
                                    β”‚              β”‚
                                    β”‚ Chat Session β”‚
                                    β”‚  Management  β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                           β”‚
                                           β–Ό
                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                    β”‚ Google Geminiβ”‚
                                    β”‚     API      β”‚
                                    β”‚              β”‚
                                    β”‚  AI Model    β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Components

  1. Website Frontend: Marketing website built with React, Vite, and TailwindCSS
  2. Website Backend: Health checks and basic routing (Express.js)
  3. Extension Backend: LLM API endpoints with streaming support (Express.js)
  4. Chrome Extension: React-based extension with Chat and Whiteboard modes
  5. Redis: Session management for chat history (external via Upstash)
  6. NGINX: Reverse proxy and static file serving

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

Installation

  1. Clone the repository

    git clone https://github.com/LeetBuddyAI/LeetBuddy.git
    cd LeetBuddy
  2. Install dependencies

    npm run install:all

    This installs dependencies for:

    • Root project
    • Backend (backend/)
    • Website frontend (frontend/website/)
    • Extension frontend (frontend/extension/)

Configuration

  1. Copy the environment template

    cp .env.example .env
  2. Configure environment variables

    Edit .env with your settings:

    # Application Environment
    NODE_ENV=development
    PORT=10000
    
    # Website Backend
    CHROME_EXTENSION_ORIGIN=chrome-extension://your-extension-id
    
    # Extension Backend
    GEMINI_API_KEY=your-gemini-api-key
    MODEL=gemini-2.5-flash
    INSTRUCTIONS="You are a helpful coding assistant for LeetCode problems."
    
    # Backend Ports (internal to container)
    WEBSITE_PORT=3001
    EXTENSION_PORT=3002
    
    # Redis Configuration (for extension chat sessions)
    REDIS_URL=your-redis-url
    
    # Frontend Environment Variables
    VITE_SITE_URL=https://leetbuddy.app
    VITE_VIDEO_URL=https://example.com/demo-video.mp4
    VITE_CHROME_STORE_URL=https://chromewebstore.google.com/detail/nlemdecocfoaimdbfgpilfgdmcllhphn
    
    # Development NGINX Port
    NGINX_PORT=80

    Required API Keys:

Running Locally

Option 1: Quick Start (Recommended)

npm run fresh

This command will:

  1. Clean all dependencies and caches
  2. Reinstall all packages
  3. Rebuild Docker images from scratch
  4. Start all services

Access the application:

Option 2: Manual Docker Setup

# Build and start services
docker-compose up --build

# Or run in detached mode
docker-compose up -d --build

Option 3: Development Mode (Without Docker)

# Terminal 1 - Backend
npm run dev

# Terminal 2 - Website Frontend
npm run dev:website

# Terminal 3 - Extension Frontend
npm run dev:extension

Loading the Chrome Extension

  1. Build the extension:

    npm run build:extension
  2. Open Chrome and navigate to:

    chrome://extensions/
    
  3. Enable Developer mode (toggle in top right)

  4. Click "Load unpacked"

  5. Select the directory:

    frontend/extension/dist/
    
  6. The extension should now appear in your Chrome toolbar!

  7. Navigate to any LeetCode problem and click the LeetBuddy icon


Development

Project Structure

LeetBuddy/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ extension/           # Extension backend service
β”‚   β”‚   β”œβ”€β”€ controllers/     # Request handlers
β”‚   β”‚   β”œβ”€β”€ routes/          # API routes
β”‚   β”‚   └── services/        # Business logic (LLM, Redis)
β”‚   β”œβ”€β”€ website/             # Website backend service
β”‚   β”‚   β”œβ”€β”€ controllers/     # Health check controllers
β”‚   β”‚   └── routes/          # Health routes
β”‚   β”œβ”€β”€ shared/              # Shared utilities
β”‚   β”‚   β”œβ”€β”€ cors.js          # CORS configuration
β”‚   β”‚   β”œβ”€β”€ errorHandlers.js # Error handling middleware
β”‚   β”‚   β”œβ”€β”€ logger.js        # Logging utilities
β”‚   β”‚   β”œβ”€β”€ rateLimiter.js   # Rate limiting
β”‚   β”‚   β”œβ”€β”€ redis.js         # Redis client wrapper
β”‚   β”‚   └── security.js      # Helmet security config
β”‚   └── index.js             # Backend entry point
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ extension/           # Chrome extension
β”‚   β”‚   β”œβ”€β”€ public/          # Extension manifest & assets
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ background/  # Background script
β”‚   β”‚       β”œβ”€β”€ components/  # React components
β”‚   β”‚       β”œβ”€β”€ tabs/        # Chat & Whiteboard tabs
β”‚   β”‚       └── utils/       # Helper functions
β”‚   └── website/             # Marketing website
β”‚       └── src/
β”‚           β”œβ”€β”€ components/  # React components
β”‚           β”œβ”€β”€ pages/       # Page components
β”‚           β”œβ”€β”€ hooks/       # Custom React hooks
β”‚           └── data/        # Static data & SEO
β”œβ”€β”€ nginx/
β”‚   β”œβ”€β”€ default.conf         # Production nginx config
β”‚   └── default.conf.dev     # Development nginx config
β”œβ”€β”€ docker-compose.yml       # Docker orchestration
β”œβ”€β”€ Dockerfile               # Production Docker image
β”œβ”€β”€ Dockerfile.dev           # Development Docker image
β”œβ”€β”€ render.yaml              # Render.com deployment config
└── .env                     # Environment variables

Available Scripts

Root Level Scripts

# Development
npm run dev              # Start backend in development mode
npm run dev:website      # Start website frontend dev server
npm run dev:extension    # Start extension frontend dev server

# Building
npm run build            # Build website frontend
npm run build:website    # Build website frontend
npm run build:extension  # Build extension frontend
npm run build:all        # Build both frontends

# Installation
npm run install:all      # Install all dependencies
npm run install:backend  # Install backend dependencies only
npm run install:website  # Install website frontend dependencies
npm run install:extension # Install extension frontend dependencies

# Cleaning
npm run clean            # Remove node_modules, dist, lock files
npm run clean:modules    # Remove all node_modules
npm run clean:dist       # Remove all dist directories
npm run clean:locks      # Remove all package-lock files

# Reset & Rebuild
npm run reset            # Clean, reinstall, rebuild everything
npm run reset:hard       # Hard reset with cache clean
npm run fresh            # Hard reset + Docker rebuild (recommended)
npm run nuke             # Nuclear option: delete everything

# Docker
npm run docker:clean     # Remove Docker containers, volumes, images
npm run docker:reset     # Clean Docker and rebuild from scratch

# Testing
npm test                 # Run tests (placeholder)

Backend Scripts

cd backend
npm start               # Start production server
npm run dev             # Start with nodemon (auto-reload)
npm test                # Run backend tests

Frontend Website Scripts

cd frontend/website
npm run dev             # Start Vite dev server
npm run build           # Build for production
npm run preview         # Preview production build
npm run lint            # Run ESLint

Frontend Extension Scripts

cd frontend/extension
npm run dev             # Start Vite dev server with HMR
npm run build           # Build for production (creates dist/)
npm run preview         # Preview production build
npm run lint            # Run ESLint

Tech Stack

Frontend (Website)

  • Framework: React 19
  • Build Tool: Vite 6
  • Styling: TailwindCSS 4
  • Routing: React Router 7
  • Icons: Lucide React
  • SEO: Custom meta tags + JSON-LD structured data

Frontend (Extension)

  • Framework: React 19
  • Build Tool: Vite 6
  • Styling: TailwindCSS 4
  • Whiteboard: tldraw
  • Markdown: react-markdown + remark-gfm
  • Syntax Highlighting: Prism.js + prism-react-renderer
  • Icons: React Icons
  • State Management: React Context API
  • UUID: uuid v11

Backend

  • Runtime: Node.js 22+
  • Framework: Express.js 5
  • AI Model: Google Gemini 2.5 Flash (@google/genai)
  • Database: Redis (ioredis) via Upstash
  • Security:
    • Helmet (security headers)
    • CORS with origin validation
    • Rate limiting (express-rate-limit)
  • Utilities:
    • Compression
    • dotenv (environment variables)
    • Custom error handlers
    • Structured logging

Infrastructure

  • Containerization: Docker + Docker Compose
  • Reverse Proxy: NGINX
  • Deployment: Render.com
  • CDN: Cloudflare (for production)
  • External Services:
    • Upstash Redis (session management)
    • Google Gemini API (AI responses)

Development Tools

  • Linting: ESLint 9
  • Hot Reload: Vite HMR, Nodemon
  • Environment Management: dotenv

Deployment

Website & Backend

The website and backend are deployed on Render.com with automatic deployment from the main branch.

Production Deployment

  1. Push to main branch

    git push origin main
  2. Render.com automatically:

    • Detects changes
    • Builds Docker image using Dockerfile
    • Runs database migrations (if any)
    • Deploys to production
    • Runs health checks

Manual Deployment (Render.com)

  1. Configure Render service using render.yaml
  2. Set environment variables in Render dashboard (not synced from repo)
  3. Deploy manually from Render dashboard if needed

Environment Variables (Production)

Set these in Render.com dashboard:

NODE_ENV=production
PORT=10000
REDIS_URL=<your-upstash-redis-url>
GEMINI_API_KEY=<your-gemini-key>
CHROME_EXTENSION_ORIGIN=chrome-extension://nlemdecocfoaimdbfgpilfgdmcllhphn
MODEL=gemini-2.5-flash
INSTRUCTIONS="<your-custom-instructions>"
VITE_SITE_URL=https://leetbuddy.app
VITE_VIDEO_URL=<your-cdn-video-url>
VITE_CHROME_STORE_URL=https://chromewebstore.google.com/detail/nlemdecocfoaimdbfgpilfgdmcllhphn

Chrome Extension

Building for Production

  1. Build the extension

    npm run build:extension
  2. Create distribution package

    cd frontend/extension/dist
    zip -r ../extension.zip .
    cd ..

    This creates frontend/extension/extension.zip

Extension Manifest

Key settings in frontend/extension/public/manifest.json:

{
  "manifest_version": 3,
  "name": "LeetBuddy",
  "version": "1.1.1",
  "permissions": ["activeTab", "storage"],
  "host_permissions": ["https://leetcode.com/*"],
  "content_security_policy": {
    "extension_pages": "script-src 'self'; object-src 'self'"
  }
}

Contributing

We welcome contributions from the community! Here's how you can help:

How to Contribute

  1. Fork the repository

    git clone https://github.com/YOUR_USERNAME/LeetBuddy.git
  2. Create a feature branch

    git checkout -b feature/amazing-feature
  3. Make your changes

    • Follow existing code style
    • Write meaningful commit messages
    • Add comments for complex logic
    • Update documentation if needed
  4. Test your changes

    npm run fresh  # Full rebuild and test
  5. Commit your changes

    git add .
    git commit -m "Add amazing feature"
  6. Push to your fork

    git push origin feature/amazing-feature
  7. Open a Pull Request

    • Go to the original repository
    • Click "New Pull Request"
    • Select your fork and branch
    • Describe your changes in detail

Contribution Guidelines

  • Code Quality: Write clean, maintainable code
  • Documentation: Update README and code comments
  • Testing: Test thoroughly before submitting
  • Commits: Use clear, descriptive commit messages
  • Issues: Check existing issues before creating new ones
  • Respect: Be respectful and constructive in discussions

Areas for Contribution

  • πŸ› Bug Fixes: Fix bugs listed in Issues
  • ✨ Features: Implement new features or improve existing ones
  • πŸ“ Documentation: Improve README, code comments, or guides
  • 🎨 UI/UX: Enhance design and user experience
  • πŸ§ͺ Testing: Add unit tests, integration tests, or E2E tests
  • 🌐 Translations: Add support for multiple languages
  • β™Ώ Accessibility: Improve accessibility features

Development Tips

  • Use npm run fresh for a clean rebuild when switching branches
  • Test the extension in Chrome before submitting PRs
  • Check browser console for errors during development
  • Use npm run lint to catch style issues early

License

This project is licensed under the MIT License - see the LICENSE file for details.

What this means:

βœ… You can:

  • Use this code commercially
  • Modify the code
  • Distribute the code
  • Use it privately
  • Sublicense the code

❌ You must:

  • Include the original copyright notice
  • Include a copy of the MIT License

❌ Limitations:

  • The software is provided "as is", without warranty
  • Authors are not liable for any damages

Support

Getting Help

Reporting Bugs

When reporting bugs, please include:

  1. Description: What happened vs. what you expected
  2. Steps to Reproduce: Detailed steps to recreate the issue
  3. Environment:
    • OS (Windows/macOS/Linux)
    • Node.js version (node --version)
    • Chrome version
    • Extension version
  4. Screenshots: If applicable
  5. Error Messages: Console logs or error messages

Feature Requests

We love hearing your ideas! When requesting features:

  1. Search existing requests to avoid duplicates
  2. Describe the feature in detail
  3. Explain the use case - why is this needed?
  4. Provide examples - how would it work?

Acknowledgments

Built With

Core Team

  • Brian Manomaisupat - Frontend, Session management
  • Lucian Cheng - Frontend, API use, Hosting
  • Nicholas Jano - Backend, API use, Redis/Docker setup
  • Nathan Chan - Frontend, Input forms
  • Jay Liang - Marketing, Growth, QA

Special Thanks

  • The LeetCode community for inspiration
  • All users who provide feedback and bug reports
  • Open source contributors who make projects like this possible

Made with ❀️ by the LeetBuddy Team

Star this repo if you find it helpful! ⭐

Website β€’ Chrome Extension β€’ GitHub

About

LeetBuddy is a Google Chrome Extension that users can open on any LeetCode problem, and unlock various tools, oriented around interview preparation and coding education, in order to learn and code more efficiently.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published