A browser extension that automatically pushes your successful LeetCode submissions to a GitHub repository.
- Automatically detects successful LeetCode submissions
- Extracts the problem name and submitted code
- AI-Powered Code Formatting (Optional) - Formats code and adds explanations, approach, and complexity analysis
- Pushes code to a GitHub repository named "leetcode"
- Supports multiple programming languages
- Simple configuration via extension popup
- Download or clone this repository
- Open Chrome/Edge and go to
chrome://extensions/(oredge://extensions/) - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked" and select the extension folder
- The extension should now appear in your extensions list
- Download or clone this repository
- Open Firefox and go to
about:debugging - Click "This Firefox" in the left sidebar
- Click "Load Temporary Add-on"
- Select the
manifest.jsonfile from the extension folder
Create a new repository on GitHub named exactly leetcode (case-sensitive).
- Go to GitHub Settings → Personal Access Tokens
- Click "Generate new token (classic)"
- Give it a descriptive name like "LeetCode Pusher"
- Select the
reposcope (full control of private repositories) - Click "Generate token"
- Important: Copy the token immediately - you won't be able to see it again!
- Go to OpenRouter Keys
- Sign up or log in
- Create a new API key
- Copy the key (starts with
sk-or-v1-)
- Click the extension icon in your browser toolbar
- Enter your GitHub username
- Enter your GitHub personal access token
- (Optional) Enter your OpenRouter API key for AI formatting
- Click "Save Settings"
- The extension will test your connection and show a success message
- Detection: The extension monitors LeetCode problem pages for successful submissions
- Extraction: When a submission succeeds, it extracts:
- Problem name (from URL slug)
- Your submitted code
- Programming language
- AI Formatting (Optional): If OpenRouter API key is configured:
- Code is sent to AI for formatting and documentation
- AI adds approach explanation, time/space complexity analysis
- Code is properly formatted with comments
- Upload: The code is automatically uploaded to your
leetcoderepository in asolutions/folder - Naming: Files are named like
two_sum.py,reverse_string.java, etc.
The extension automatically detects and handles these languages:
- JavaScript (.js)
- Python (.py)
- Java (.java)
- C++ (.cpp)
- C (.c)
- C# (.cs)
- PHP (.php)
- Ruby (.rb)
- Swift (.swift)
- Go (.go)
- Scala (.scala)
- Kotlin (.kt)
- Rust (.rs)
- TypeScript (.ts)
After successful submissions, your repository will look like:
leetcode/
├── solutions/
│ ├── two_sum.py
│ ├── valid_parentheses.java
│ ├── merge_two_sorted_lists.cpp
│ └── ...
└── README.md
- Make sure you're on a LeetCode problem page (
https://leetcode.com/problems/*) - Try refreshing the page after installing the extension
- Check that the extension has permission to access LeetCode
- Verify your GitHub token is correct and has
reposcope - Ensure you have a repository named exactly
leetcode - Check that your username is spelled correctly
- Try regenerating your token if it's expired
- The extension works with LeetCode's default code editors
- Some custom themes or browser extensions might interfere
- Try using the default LeetCode interface
manifest.json- Extension configurationcontent.js- Detects submissions on LeetCode pagesbackground.js- Handles GitHub API interactionspopup.html/js- Configuration interfaceicon48.png/icon128.png- Extension icons
- Load the extension in developer mode
- Open a LeetCode problem
- Submit a solution
- Check browser console for debug messages
- Verify the file appears in your GitHub repository
- Your GitHub token is stored locally in browser storage
- The extension only accesses LeetCode and GitHub APIs
- No data is sent to third-party servers
- Code is only uploaded to your specified GitHub repository
Feel free to open issues or submit pull requests to improve the extension!
This project is open source. Use at your own risk.