Seamlessly sync your LeetCode solutions directly to GitHub with automated Big-O complexity analysis and rich Markdown documentation.
- ⚡ Instant Auto-Sync: Automatically detects accepted submissions on LeetCode and commits your solution directly to your GitHub repository in real time.
- 🧠 Hybrid Big-O Analyzer:
- Local AST Analyzer: Fast, built-in structural analyzer for estimating Time & Space complexities offline.
- Gemini AI Engine: Optional AI integration for high-accuracy Big-O complexity analysis on complex data structures and Pro-level algorithms.
- 📁 Smart Folder Organization: Solution files are neatly grouped by difficulty (
Easy/,Medium/,Hard/) with standard language file extensions. - 📝 Rich Problem Documentation: Every committed solution includes a dedicated
README.mdfeaturing:- Formatted problem description & constraints
- Submission stats (Runtime & Memory percentiles)
- Time & Space Big-O complexity breakdown
- Direct links back to the LeetCode problem
- 🎨 Glassmorphic UI & Custom Themes: Includes Dark, Light, and Cyberpunk themes, live solution streak tracking, and interactive counters.
- 🔒 100% Client-Side Privacy: Communicates directly with the official GitHub API via Personal Access Tokens (PAT). No middleman servers, analytics, or data collection.
Follow these quick steps to install and configure CodeHub in your Chrome browser:
Clone this repository locally using Git:
git clone https://github.com/your-username/CodeHub.gitOr click Code -> Download ZIP on GitHub and extract the contents to a folder on your computer.
- Open Google Chrome and navigate to
chrome://extensions/. - Toggle Developer mode ON in the top-right corner.
- Click the Load unpacked button in the top-left corner.
- Select the
CodeHubroot folder (wheremanifest.jsonis located). - CodeHub is now installed! Pin it to your browser toolbar for easy access.
CodeHub uses a GitHub Personal Access Token to commit code directly to your repository:
- Go to your GitHub account -> Settings -> Developer Settings -> Personal Access Tokens -> Tokens (classic).
- Click Generate new token (classic).
- Set the Note to
CodeHub Extension. - Select the
reposcope checkbox (this grants permission to push solutions to your repositories). - Click Generate token and copy your generated token string (
ghp_...).
- Click the CodeHub extension icon in your Chrome toolbar.
- Click Get Started to open the welcome setup page.
- Paste your GitHub Personal Access Token and click Validate.
- Select an existing repository from your account or enter a new repository name (e.g.,
leetcode-solutions) to create one automatically. - Click Finish Setup. You are now ready to auto-sync!
CodeHub includes a built-in offline AST complexity analyzer by default. To unlock AI-powered Big-O analysis for complex algorithms:
- Get a free API Key from Google AI Studio.
- Open the CodeHub extension popup.
- Paste your API key in the AI Big-O Engine input field on the home screen or inside Settings.
- Click Save Key.
CodeHub/
├── manifest.json # Extension Manifest V3 configuration
├── assets/ # Branding icons (16px, 48px, 128px)
├── popup/ # Extension Popup UI
│ ├── popup.html # Main dashboard & settings HTML
│ ├── popup.css # Glassmorphic styling & theme engine
│ └── popup.js # Popup UI controller & state handlers
├── scripts/ # Core Service Workers & Modules
│ ├── background.js # Ephemeral Service Worker (GitHub API & Messaging)
│ ├── content.js # Content script loader
│ ├── leetcode.js # LeetCode DOM observer & submission detector
│ ├── github.js # GitHub REST API client module
│ └── storage.js # Chrome storage local wrapper module
├── welcome/ # First-time onboarding flow
│ ├── welcome.html # Multi-step setup wizard
│ ├── welcome.css # Onboarding page styling
│ └── welcome.js # Token verification & repo selection
├── LICENSE # Open-source MIT License
└── README.md # Project documentation & setup guide
- Platform: Chrome Extension Manifest V3 (MV3)
- Frontend: Vanilla HTML5, CSS3 (Glassmorphism design system), ES6 Modules
- API Integration: GitHub REST API v3, Google Gemini API
- State Management:
chrome.storage.localasynchronous persistence - DOM Detection: Event-driven submit tracking +
MutationObserveron LeetCode DOM
CodeHub is built with privacy and security as top priorities:
- No External Backends: All network calls originate from your browser directly to
api.github.comorgenerativelanguage.googleapis.com. - Token Security: Tokens are stored locally in your browser's encrypted
chrome.storage.localspace. - Sanitized Inputs: Path normalization prevents path traversal vulnerabilities, and markdown output is safely sanitized.
This project is licensed under the MIT License. Feel free to use, modify, and contribute to this repository.