Skip to content

This helps you to show your LeetCode Progress on any WebPage or Document

Notifications You must be signed in to change notification settings

devagn611/Leet_Code_Stat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Stats Card

Show your dynamically generated LeetCode stats on your GitHub profile or your website!

LeetCode and LeetCode CN are both supported.

Playground: Try It Now

LeetCode Stats_example

Features

  • 📈 Clean and simple LeetCode stats, for both us and cn sites
  • 🎨 Multiple themes and fonts - Theme, Font
  • 🪄 Fully customizable using CSS - Custom Stylesheets
  • ⚡️ Fast and global edge network - Cloudflare Workers
  • 🚫 No tracking, controlable cache - Cache
  • 🍀 Open source - MIT License
  • ⚙️ Extended-cards: activity, contest, heatmap

LeetCode Stats Card API Documentation

Introduction

Welcome to the LeetCode Stats Card API documentation. This API allows you to generate and embed customizable stat cards for LeetCode profiles.

Endpoints

Main Data Fetcher:

Workers: https://leet-card-gen.devagn.workers.dev/

https://leet-card-gen.devagn.workers.dev?username=YOUR_LEETCODE_USERNAME

Example: https://leet-card-gen.devagn.workers.dev?username=devagn_maniya

Extras for Card Generator

GET /api/cardgen

Generates a LeetCode stats card image.

Parameters:

  • username (required): LeetCode username
  • theme (required): Card theme (e.g., dark, light)
  • font (required): Font style for the card
  • extension (optional): File extension
  • site (optional): Site identifier

Returns: The stats card image data

GET /api/cardgenDetail

Generates embed code for the LeetCode stats card.

Parameters:

  • username (required): LeetCode username
  • theme (required): Card theme (e.g., dark, light)
  • font (required): Font style for the card
  • extension (optional): File extension
  • site (optional): Site identifier

Returns: JSON object containing embedHtml and markdown

GET /api/preview

Provides a preview of the stats card.

Parameters:

  • username (required): LeetCode username
  • theme (required): Card theme (e.g., dark, light)
  • font (required): Font style for the card
  • extension (optional): File extension
  • site (optional): Site identifier

Returns: The source of the embed code

Examples

Generating a card image:

fetch('https://leet-card-generator.onrender.com/api/cardgen?username=devagn_maniya&theme=dark&font=changa')
    .then(response => response.text())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Getting embed code:

fetch('https://leet-card-generator.onrender.com/api/cardgenDetail?username=devagn_maniya&theme=dark&font=changa')
    .then(response => response.json())
    .then(data => {
        console.log('Embed HTML:', data.embedHtml);
        console.log('Markdown:', data.markdown);
    })
    .catch(error => console.error('Error:', error));

Getting a preview:

fetch('https://leet-card-generator.onrender.com/api/preview?username=devagn_maniya&theme=dark&font=changa')
    .then(response => response.text())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Error Handling

If required parameters are missing or an error occurs, the API will return a JSON response with an error message:

{
    "error": "Username, theme, and font are required."
}

💻 Tech Stack:

NodeJS GraphQL HTML5 TailwindCSS JavaScript Cloudflare NPM

Credit

Maniya Devagn

JacobLinCool

🔗 Links

Portfolio

Freecodecamp

Leet-Code

About

This helps you to show your LeetCode Progress on any WebPage or Document

Resources

Stars

Watchers

Forks