Skip to content

shivam16s/leetcode-gfg-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ LeetCode & GFG β†’ GitHub Sync | Chrome Extension

Chrome Extension Manifest V3 GitHub API LeetCode GeeksforGeeks License

Automatically capture your accepted LeetCode & GeeksforGeeks submissions and push them to a GitHub repository β€” with full metadata, organized by platform and difficulty.

Features β€’ Architecture β€’ Installation β€’ How It Works β€’ Tech Stack


πŸ“‹ Problem Statement

Competitive programmers and interview preppers solve hundreds of problems, but:

  • ❌ Solutions are trapped inside LeetCode / GFG platforms
  • ❌ No easy way to showcase your work on GitHub
  • ❌ Manually copying code + creating files is tedious
  • ❌ You lose context β€” runtime stats, problem descriptions, difficulty tags

πŸ’‘ Solution

A Chrome extension that automatically detects when you submit an accepted solution on LeetCode or GeeksforGeeks and pushes it to your GitHub repo with:

  • Full source code in the correct file format
  • Auto-generated README with problem details, stats, and badges
  • Organized folder structure by platform and difficulty level
  • Zero manual effort β€” just solve and submit!

✨ Features

Core Features

Feature Description
πŸ”„ Auto-Sync Detects accepted submissions in real-time β€” no clicking needed
🌐 Dual Platform Supports both LeetCode and GeeksforGeeks
πŸ“ Smart Organization Files organized as LeetCode/Easy/0001-two-sum/solution.py and GFG/Medium/reverse-a-linked-list/solution.cpp
πŸ“ Rich READMEs Auto-generated with difficulty badges, tags, stats, problem description
🌐 18+ Languages Python, C++, Java, JavaScript, Go, Rust, TypeScript, and more
πŸ”€ Multi-Language Submit same problem in different languages β€” all solutions kept
πŸ“Š Full Metadata Runtime, memory, percentile beats, timestamps, problem links
βͺ Sync Past Submissions Backfill all your historical LeetCode solutions with one click

Robustness Features

Feature Description
πŸ“‘ Offline Queue Failed pushes are queued and auto-retried when back online
πŸ” Exponential Backoff Smart retry with increasing delays (5min β†’ 10min β†’ 20min)
πŸ—οΈ Auto-Create Repo Creates the GitHub repo automatically if it doesn't exist
πŸ›‘οΈ Duplicate Prevention Tracks submission IDs β€” never syncs the same submission twice
πŸ” Auto-Detect Branch Works with main, master, or any custom default branch
⚑ Rate Limit Aware Monitors GitHub API limits and delays requests when needed

UI Features

Feature Description
🎨 Premium Dark Theme Glassmorphism popup with smooth animations
πŸ“Š Dashboard Total syncs, difficulty breakdown with progress rings
πŸ“œ History Log Last 50 synced submissions with platform badges (LC/GFG)
πŸ”” Toast Notifications In-page success/failure alerts on LeetCode & GFG
βš™οΈ Settings Panel GitHub token, repo name, auto-sync toggle, past sync button

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Chrome Extension (Manifest V3)                   β”‚
β”‚                                                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Popup UI    β”‚   β”‚  Content Scripts    β”‚   β”‚  Background    β”‚ β”‚
β”‚  β”‚              β”‚   β”‚                    β”‚   β”‚  Service       β”‚ β”‚
β”‚  β”‚ β€’ Dashboard  β”‚   β”‚  LeetCode:         β”‚   β”‚  Worker        β”‚ β”‚
β”‚  β”‚ β€’ History    │◄─►│  β€’ inject.js       │──►│                β”‚ β”‚
β”‚  β”‚ β€’ Settings   β”‚   β”‚  β€’ content.js      β”‚   β”‚  β€’ GitHub API  β”‚ β”‚
β”‚  β”‚              β”‚   β”‚                    β”‚   β”‚  β€’ Offline Q   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  GeeksforGeeks:    β”‚   β”‚  β€’ Retry Logic β”‚ β”‚
β”‚                      β”‚  β€’ gfg_inject.js   │──►│  β€’ Past Sync   β”‚ β”‚
β”‚                      β”‚  β€’ gfg_content.js  β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚          β”‚
β”‚                                                 β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”‚
β”‚                                                 β”‚ GitHub API β”‚  β”‚
β”‚                                                 β”‚ (REST v3)  β”‚  β”‚
β”‚                                                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‚ Repository Structure Created on GitHub

your-solutions-repo/
β”œβ”€β”€ LeetCode/
β”‚   β”œβ”€β”€ Easy/
β”‚   β”‚   β”œβ”€β”€ 0001-two-sum/
β”‚   β”‚   β”‚   β”œβ”€β”€ README.md                ← Problem details + stats
β”‚   β”‚   β”‚   β”œβ”€β”€ solution.py              ← Your Python solution
β”‚   β”‚   β”‚   └── solution.cpp             ← Your C++ solution (multi-lang!)
β”‚   β”‚   └── 0070-climbing-stairs/
β”‚   β”‚       β”œβ”€β”€ README.md
β”‚   β”‚       └── solution.java
β”‚   β”œβ”€β”€ Medium/
β”‚   β”‚   └── 0056-merge-intervals/
β”‚   β”‚       β”œβ”€β”€ README.md
β”‚   β”‚       └── solution.cpp
β”‚   └── Hard/
β”‚       └── 0004-median-of-two-sorted-arrays/
β”‚           β”œβ”€β”€ README.md
β”‚           └── solution.java
└── GFG/
    β”œβ”€β”€ Easy/
    β”‚   └── reverse-a-string/
    β”‚       β”œβ”€β”€ README.md
    β”‚       └── solution.cpp
    β”œβ”€β”€ Medium/
    β”‚   └── topological-sort/
    β”‚       β”œβ”€β”€ README.md
    β”‚       └── solution.java
    └── Hard/
        └── longest-prefix-suffix/
            β”œβ”€β”€ README.md
            └── solution.py

πŸ› οΈ Tech Stack

Component Technology
Extension Chrome Manifest V3
Language Vanilla JavaScript (ES6+)
Styling CSS3 (Glassmorphism, Animations)
LeetCode Data GraphQL API (unofficial, session-based)
GFG Data __NEXT_DATA__ extraction + DOM scraping + XHR interception
GitHub Push GitHub REST API v3 (Contents API)
Storage chrome.storage.local
Retry chrome.alarms API

πŸ“¦ Installation

Developer Mode (Local)

  1. Clone this repository
    git clone https://github.com/shivam16s/leetcode-gfg-sync.git
  2. Open Chrome β†’ chrome://extensions/
  3. Enable Developer Mode (top-right toggle)
  4. Click "Load unpacked" β†’ select the cloned folder
  5. Click the extension icon β†’ go to Settings tab
  6. Enter your GitHub Personal Access Token (create one here with repo scope)
  7. Enter your target repository name
  8. Click "Save & Test Connection" β†’ should show βœ… green status
  9. Start solving problems on LeetCode or GFG β€” solutions auto-sync! πŸŽ‰

πŸ—‚οΈ Project Structure

leetcode-gfg-sync/
β”œβ”€β”€ manifest.json              # Extension configuration (Manifest V3)
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ inject.js              # LeetCode β€” intercepts submissions
β”‚   β”œβ”€β”€ content.js             # LeetCode β€” GraphQL fetch + toast
β”‚   β”œβ”€β”€ gfg_inject.js          # GFG β€” intercepts submissions
β”‚   β”œβ”€β”€ gfg_content.js         # GFG β€” __NEXT_DATA__ + DOM scraping
β”‚   └── background.js          # Service worker β€” GitHub API + queue
β”œβ”€β”€ popup/
β”‚   β”œβ”€β”€ popup.html             # 3-tab popup UI
β”‚   β”œβ”€β”€ popup.css              # Dark glassmorphism theme
β”‚   └── popup.js               # Popup logic & state
β”œβ”€β”€ styles/
β”‚   └── toast.css              # In-page notification styles
β”œβ”€β”€ icons/
β”‚   β”œβ”€β”€ icon16.png             # Toolbar icon
β”‚   β”œβ”€β”€ icon48.png             # Extensions page icon
β”‚   └── icon128.png            # Store icon
└── docs/
    β”œβ”€β”€ IMPLEMENTATION_PLAN.md # Technical architecture document
    └── TASKS.md               # Development milestone tracker

πŸ” Security & Privacy

  • Token stored locally β€” never sent anywhere except api.github.com
  • No external analytics β€” zero tracking, zero telemetry
  • Minimal permissions β€” only storage, activeTab, alarms
  • Open source β€” full code audit possible
  • CSP compliant β€” proper web_accessible_resources usage

🌍 Supported Languages (18+)

Language Extension Language Extension
Python .py TypeScript .ts
C++ .cpp C .c
Java .java C# .cs
JavaScript .js Go .go
Ruby .rb Swift .swift
Kotlin .kt Rust .rs
Scala .scala PHP .php
Dart .dart Racket .rkt
Erlang .erl Elixir .ex
MySQL .sql Pandas .py

πŸ—ΊοΈ Roadmap

  • Project ideation & architecture design
  • Core extension (manifest, content scripts, service worker)
  • LeetCode submission interception
  • GeeksforGeeks submission interception
  • GitHub API integration (create/update files)
  • Multi-language support per problem
  • Sync past LeetCode submissions
  • Popup UI (dashboard, history, settings)
  • Toast notifications on LeetCode & GFG pages
  • Offline queue & retry logic
  • Extension icons & branding
  • Chrome Web Store submission

πŸ“„ License

MIT License β€” feel free to fork, modify, and distribute.


Built with ❀️ for the competitive programming community

Stop manually copying code. Let the extension do it for you.

Releases

Packages

Contributors

Languages