Recruiter & Developer Portfolio

Privacy-First LeetCode Synchronization Engine

An automated monorepo application linking browser-intercepted LeetCode submissions directly to GitHub repositories, with serverless PostgreSQL benchmarking analytics and streak card generation.

AlgoLens v0.1.0

Locked ID: nemjhpfoimnonhdinemmpmfkkjokkcil

Core Application Highlights

🔄

Direct-to-GitHub Sync

Intercepts LeetCode submission payloads, scrapes code draft contents, and pushes clean files directly to the user's repository via GitHub REST APIs.

⏱️

Smart Focus Timer

Monitors solve durations using document visibility, focus/blur, and mouse/keyboard activity listeners, pausing automatically to prevent telemetry inflation.

📊

Dynamic Stats Cards

Compiles easy, medium, hard, and streak counts as query parameters inside Markdown SVG links, rendering real-time profile widgets without database reads.

🔒

Decentralized Storage

Personal Access Tokens (PATs) are isolated client-side inside chrome.storage.local. No user credentials or profiles are ever sent to the telemetry API.

Deduplicated Bulk Sync

Queries LeetCode's paginated GraphQL submission history, groups unique solved problems by language, diffs against existing repository files, and pushes in a rate-limited queue.

📈

Anonymized Telemetry

Aggregates community solve speeds and attempts anonymously. Calculates percentile curves dynamically to overlay benchmarks on profile SVG cards.

System Architecture & Engineering Decisions

💡 Why This Design Is Scalable & Secure

  • Zero Identity Database: The telemetry backend collects no usernames, emails, or profile info. System design complies with strict data safety regulations by storing all private configurations locally.
  • Stateless Rendering: The SVG stats generation endpoints process URL queries directly. This avoids expensive profile database queries, enabling high-performance card loads.
  • Anti-Sideloading Data Lock: By implementing Node key generators and defining a custom "key" in the manifest, the extension maintains a permanent Extension ID to secure storage data across developer upgrades.
graph TD
    subgraph Client [Chrome Extension Sandbox]
        Popup[Popup React UI]
        Interceptor[Main-world Fetch Interceptor]
        Content[Isolated-world Content Script]
        Worker[Background Service Worker]
    end

    subgraph GitHub [User Repository]
        GitHubAPI[GitHub REST API]
        RepoSolutions[leetcode/solutions/*]
        RepoReadme[leetcode/README.md]
    end

    subgraph Backend [FastAPI Telemetry Stack]
        FastAPI[FastAPI Telemetry API]
        Database[(SQLite / Neon PostgreSQL)]
    end

    LeetCode[LeetCode.com] -.-> Interceptor
    Interceptor -- "window.postMessage" --> Content
    Content -- "chrome.runtime.sendMessage" --> Worker
    Popup -- "chrome.runtime.sendMessage" --> Worker
    
    Worker -- "Secure Commit (PAT)" --> GitHubAPI
    Worker -- "Anonymous Submit Event" --> FastAPI
    
    FastAPI <--> Database
    RepoReadme -- "Fetch Streak Card SVG" --> FastAPI
          
sequenceDiagram
    autonumber
    actor User as User (leetcode.com)
    participant Page as Page DOM / Monaco Editor
    participant Int as Fetch Interceptor (MAIN World)
    participant Content as Content Script (ISOLATED World)
    participant Background as Service Worker (Background)
    participant GitHub as GitHub REST API
    participant Backend as FastAPI Telemetry API

    User->>Page: Type code & click "Submit"
    Int->>Int: Intercept post to /submit/ & extract typed_code
    Int-->>Content: window.postMessage(typed_code)
    LeetCode->>Page: Return submission status (Accepted)
    Content->>Content: Verify accepted state & finalize focus timer
    Content-->>Background: chrome.runtime.sendMessage(SubmissionPayload)
    
    rect rgb(28, 30, 36)
        Note over Background: Retrieve GitHub PAT & configuration from Storage
        par Background to GitHub
            Background->>GitHub: Create or Update problem code file (solutions/problem-slug.py)
            Background->>GitHub: Create/Update stats JSON metadata (data/problem-slug.json)
            Background->>GitHub: Fetch & Update repository index README.md
        and Background to Telemetry
            Background->>Backend: POST /api/submission-event (Anonymized analytics)
        end
    end
    
    GitHub-->>Background: Push Complete (SHA returned)
    Backend-->>Background: Analytics Recorded
    Background-->>User: Show Desktop Notification ("Success: Solution pushed!")
          
sequenceDiagram
    autonumber
    actor User as User (Popup UI)
    participant Popup as React Popup UI
    participant LeetCode as LeetCode GraphQL API
    participant Background as Service Worker (Background)
    participant GitHub as GitHub REST API

    User->>Popup: Open "Bulk Sync" tab & click "Scan Problems"
    
    rect rgb(28, 30, 36)
        Note over Popup: Query LeetCode GraphQL using active tab cookies
        loop Paginated Submissions Scan
            Popup->>LeetCode: Query submissionList(offset, limit)
            LeetCode-->>Popup: Return submissions page (status, lang, title, slug)
        end
        Note over Popup: Filter for "Accepted" status
        Note over Popup: Group by (titleSlug, lang) and select most recent
    end

    Popup->>GitHub: Fetch repository directory listing
    GitHub-->>Popup: Return existing files (e.g. solutions/*)
    Note over Popup: Exclude problems where solution file already exists
    
    Popup-->>User: Display list of pending solves (e.g., "12 solutions to sync")
    User->>Popup: Click "Start Sync"

    rect rgb(28, 30, 36)
        loop For each unsynced submission (with 1.5s delay to avoid rate limits)
            Popup->>LeetCode: Query submissionDetails(submissionId)
            LeetCode-->>Popup: Return source code & execution stats
            Popup-->>Background: chrome.runtime.sendMessage(SyncRequest)
            Background->>GitHub: Commit solution file, metadata JSON, and update index README
            GitHub-->>Background: Commit confirmed
            Background-->>Popup: Sync success response
            Popup->>Popup: Increment progress bar & update status table
        end
    end

    Popup-->>User: Display "Bulk Sync Completed!"
          

Sideloading Instructions

1

Download the Extension Bundle

Download the latest release zip from our GitHub Releases page. Extract the package on your local computer.

2

Load Unpacked in Google Chrome

Navigate to chrome://extensions/ in Chrome. Enable the Developer mode toggle in the top-right, click Load unpacked in the top-left, and select the extracted folder.

3

Lock Your Extension ID (Recommended)

To avoid losing your GitHub login details and streak settings during extension updates, run node generate-key.js in the extension folder and paste the generated public key into your manifest.json.