Skip to content

Aaradhyanegi009/LeetcodeAI

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  LeetLog AI

Solve a LeetCode problem โ†’ Auto-publish a blog post to Dev.to, Hashnode, Medium, or your own site โ€” in seconds.

License: MIT PRs Welcome GSSoC Python FastAPI


๐Ÿ“– What is LeetLog AI?

LeetLog AI is a Chrome Extension + Python backend that watches your LeetCode session and, the moment you solve a problem, automatically generates a professional, beginner-friendly blog post using Google Gemini AI and publishes it to your selected blogging platforms on your behalf.

No copy-paste. No formatting. Just solve, and let the AI do the rest.


โœจ Features

Feature Description
๐Ÿค– AI Blog Generation Gemini generates a structured post: explanation, intuition, approach, code, complexity analysis
๐Ÿ“ค Multi-platform publishing Posts can be published to Dev.to, Hashnode, Medium, or a custom blog webhook
๐Ÿงญ Platform selection Choose publishing targets from the extension popup before generating a post
๐Ÿ“Š Per-platform status The backend reports success or failure for each selected platform independently
โšก One-click from Extension Click "Generate Blog" in the popup โ€” that's it
๐Ÿ” Smart Code Extraction Scrapes your solution code and problem details directly from the LeetCode page
๐Ÿง‘โ€๐Ÿ’ป Author Attribution Automatically picks up your LeetCode username for the post footer

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Chrome Extension      โ”‚        โ”‚   FastAPI Backend (Python)  โ”‚
โ”‚                         โ”‚        โ”‚                             โ”‚
โ”‚  content.js             โ”‚โ”€โ”€POSTโ”€โ”€โ–ถ  /generate-blog             โ”‚
โ”‚  (scrapes LeetCode page)โ”‚        โ”‚       โ”‚                     โ”‚
โ”‚                         โ”‚        โ”‚       โ–ผ                     โ”‚
โ”‚  background.js          โ”‚        โ”‚   ai.py (Gemini API)        โ”‚
โ”‚  (sends to backend)     โ”‚        โ”‚       โ”‚                     โ”‚
โ”‚                         โ”‚        โ”‚       โ–ผ                     โ”‚
โ”‚  popup.html / popup.js  โ”‚โ—€โ”€JSONโ”€โ”€โ”‚   devto.py (publishers)     โ”‚
โ”‚  (shows status)         โ”‚        โ”‚                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.10+
  • Google Chrome (for the extension)
  • A Google Gemini API Key
  • At least one publishing API key:
    • Dev.to API Key (Account โ†’ Settings โ†’ API Keys)
    • Hashnode token + publication ID
    • Medium integration token + user ID
    • A custom webhook URL for personal blogs

1. Clone the Repository

git clone https://github.com/vanshaggarwal27/LeetcodeAI
cd LeetcodeAI

2. Set Up the Backend

cd backend
python -m venv venv

# Windows
venv\Scripts\activate

# macOS / Linux
source venv/bin/activate

pip install -r requirements.txt

Create your .env file

# backend/.env
GEMINI_API_KEY=your_google_gemini_api_key_here
DEVTO_API_KEY=your_devto_api_key_here
HASHNODE_TOKEN=your_hashnode_token_here
HASHNODE_PUBLICATION_ID=your_hashnode_publication_id_here
MEDIUM_TOKEN=your_medium_integration_token_here
MEDIUM_USER_ID=your_medium_user_id_here
BLOG_WEBHOOK_URL=https://your-blog.example.com/api/publish

โš ๏ธ Never commit your .env file. It is already listed in .gitignore.

Run the server

python main.py

The server will start at http://localhost:10000.


3. Load the Chrome Extension

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable Developer mode (top-right toggle)
  3. Click "Load unpacked"
  4. Select the extension/ folder from this repository

The LeetLog AI extension icon will appear in your toolbar.


4. Use It!

  1. Go to any LeetCode problem page (e.g., https://leetcode.com/problems/two-sum/)
  2. Write or paste your solution
  3. Click the LeetLog AI extension icon
  4. Click "Generate Blog"
  5. Select one or more platforms in the popup
  6. Wait a few seconds โ€” the popup will show which platforms published successfully โœ…

๐Ÿ“ Project Structure

LeetcodeAI/
โ”‚
โ”œโ”€โ”€ backend/                  # Python FastAPI server
โ”‚   โ”œโ”€โ”€ main.py               # API routes (/generate-blog)
โ”‚   โ”œโ”€โ”€ ai.py                 # Gemini AI blog generation logic
โ”‚   โ”œโ”€โ”€ devto.py              # Publishing provider registry and clients
โ”‚   โ”œโ”€โ”€ requirements.txt      # Python dependencies
โ”‚   โ””โ”€โ”€ .env                  # โš ๏ธ Your secrets (NOT committed)
โ”‚
โ”œโ”€โ”€ extension/                # Chrome Extension (MV3)
โ”‚   โ”œโ”€โ”€ manifest.json         # Extension config
โ”‚   โ”œโ”€โ”€ content.js            # Scrapes LeetCode page data
โ”‚   โ”œโ”€โ”€ background.js         # Service worker โ€” calls backend
โ”‚   โ”œโ”€โ”€ popup.html            # Extension popup UI
โ”‚   โ””โ”€โ”€ popup.js              # Popup event logic
โ”‚
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ CONTRIBUTING.md
โ””โ”€โ”€ README.md

๐Ÿ”ฎ Future Scope (Ideas for Open Source Contributors)

Here is a checklist of features that would be incredibly useful for the community. We welcome contributions for these!

  • WhatsApp Reminder Service: Send automated daily reminders to solve LeetCode problems using the Twilio API.
  • Automated Call Alerts: Trigger automated phone calls using ElevenLabs and Twilio if a user hasn't solved their daily problem by a specific time.
  • Multi-platform Publishing: Add support for publishing to Medium, Hashnode, or an existing personal blog/website.
  • Customizable Prompts: Allow users to configure the prompt used by Gemini so they can customize the tone and style of the generated blog post.
  • Support for Other Coding Platforms: Extend support to platforms like HackerRank, Codeforces, or GeeksforGeeks.
  • Dashboard/Stats Page: Create a simple dashboard to track the number of problems solved, posts published, and consistency streaks.
  • Social Sharing: Automatically share the published Dev.to post to Twitter/X or LinkedIn.

๐ŸŒ Deploying the Backend

The backend can be deployed for free on Render.

  1. Push your code to GitHub
  2. Create a new Web Service on Render
  3. Set Build Command: pip install -r requirements.txt
  4. Set Start Command: uvicorn main:app --host 0.0.0.0 --port 10000
  5. Add your environment variables (GEMINI_API_KEY and the API keys for your selected publishing platforms) in the Render dashboard
  6. Copy your public Render URL and update API_URL in extension/background.js

๐Ÿค Contributing

We โค๏ธ contributions! LeetLog AI is part of GSSoC 2025 and welcomes developers of all experience levels.

Please read our CONTRIBUTING.md for:

  • How to set up your development environment
  • Guidelines for submitting issues and pull requests
  • Code style standards

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


๐Ÿ™ Acknowledgements

  • Google Gemini โ€” AI blog generation
  • Dev.to API, Hashnode, Medium, and custom webhooks โ€” Publishing platforms
  • FastAPI โ€” Backend framework
  • All GSSoC contributors ๐Ÿ’ช

About

proj1

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 57.2%
  • JavaScript 30.5%
  • HTML 12.3%