Skip to content

zarifislam10/leetcode-ai-summarizer

Repository files navigation

LeetStar Logo

LEETST★R

The AI-powered companion that decodes LeetCode complexity in real-time.

Install ExtensionReport IssueSuggest Feature

Status Backend Azure OpenAI

Features

  • One-Click Analysis: Click the ★ star button on any LeetCode problem page for an instant AI-powered breakdown
  • Plain-English Summaries: Understand what the problem is actually asking without decoding the description
  • Data Structure Recommendations: Get the best algorithm/DS to use with a clear reason why
  • Practice First: Suggests an easier foundational problem to solve before tackling the current one
  • Summary History: View your past 20 analyzed problems, stored in MongoDB and synced via unique browser ID
  • Smart Caching: Client-side (7-day) and server-side caching to minimize API calls and speed up responses
  • Dark/Light Mode: Toggle between themes to match your LeetCode setup
  • Customizable View: Hide or show the Data Structure and Practice First sections
  • Copy to Clipboard: One-click copy on any summary

Demo

LeetStar Demo

Tech Stack

Frontend & Extension

JavaScript Chrome

Backend & AI

Python Flask OpenAI

Database & Infrastructure

MongoDB Azure GitHub Actions Docker

Architecture

LeetStar System Architecture

Quick Start

Installation (Users)

  1. Download the extension from the Chrome Web Store (coming soon)
  2. Navigate to any leetcode.com/problems/... page
  3. Click the ★ star button in the top-right corner
  4. Get your summary instantly

Local Development

1. Clone the repo

git clone https://github.com/zarifislam10/leetcode-ai-summarizer.git
cd leetcode-ai-summarizer

2. Backend Setup

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

Create a .env file in backend/:

OPENAI_API_KEY=sk-your-key-here
MONGODB_URI=mongodb+srv://<USERNAME>:<PASSWORD>@cluster.mongodb.net/leetstar

Run the server:

python app.py

The server runs on http://localhost:5000.

3. Load the Extension

  1. Open Chrome and go to chrome://extensions
  2. Enable Developer Mode (top right toggle)
  3. Click Load unpacked and select the root project folder
  4. Navigate to any LeetCode problem page
  5. Click the ★ star button

Note: For local development, update BACKEND_URL in content.js to http://localhost:5000/summarize.

Project Structure

leetcode-ai-summarizer/
├── .github/
│   └── workflows/
│       └── main_leetstar.yml    # CI/CD pipeline
├── backend/
│   ├── app.py                   # Flask API (summarize, history, health)
│   ├── requirements.txt         # Python dependencies
│   └── startup.txt              # Azure startup command
├── content.js                   # Chrome extension logic
├── styles.css                   # UI styles (dark/light mode)
├── manifest.json                # Chrome extension manifest (MV3)
└── README.md

API Routes

Method Route Description
GET /health Health check
POST /summarize Analyze a LeetCode problem via GPT-4o-mini
GET /history?uid= Get last 20 summaries for a user
DELETE /history?uid= Delete all history for a user
DELETE /history?uid=&slug= Delete a single history entry

Deployment

The backend is deployed on Azure App Service with CI/CD via GitHub Actions.

  • Every push to main triggers an automatic build and deploy
  • Azure's Oryx build engine installs Python dependencies on deployment
  • Environment variables (OPENAI_API_KEY, MONGODB_URI) are set in Azure App Settings

Security

  • API keys live only in environment variables, never in client code
  • OpenAI API key is server-side only; the extension never sees it
  • Problem text is capped at 3,000 characters before sending to OpenAI
  • Each browser install gets a unique anonymous ID (no personal data collected)

Roadmap

  • GPT-powered problem analysis
  • Azure deployment with CI/CD
  • MongoDB history with cross-device support
  • Client-side caching (7-day expiry)
  • Server-side caching (shared across users)
  • Dark/Light mode
  • Collapsible sections (Data Structure, Practice First)
  • Chrome Web Store publication
  • Rate limiting with Flask-Limiter
  • Redis caching layer
  • Datadog monitoring
  • Docker containerization
  • System design diagram

Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m "add your feature")
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

Acknowledgments

Evolution

v1.0 (March 2025): Client-side proof-of-concept focused on real-time extraction.

v2.0 (Current): Re-architected with a Flask backend, MongoDB persistence, Azure CI/CD deployment, and a polished dark/light UI.


Made with ★ for LeetCoders everywhere

About

Full-stack AI companion for LeetCode featuring automated problem summarization, algorithmic strategy generation, and cross-device history syncing.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors