You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
A comprehensive REST API that provides access to both LeetCode and CodeChef data. Get user profiles, problem details, contest information, ratings, and more from both platforms!
Features
LeetCode Data: User profiles, badges, solved problems, contest history, submissions
CodeChef Data: User profiles, ratings, rankings, contest statistics (returns 0 if no contests)
Problem Data: Daily questions, problem lists with filtering, detailed problem info
Discussion Data: Trending discussions, topics, and comments
Advanced Features: Rate limiting, error handling, CORS support, compression
Quick Start
Installation
# Clone the repositorygit clone<your-repo-url>cd leetcode-api# Install dependenciesnpm install# Start the servernpm start# For development with auto-reloadnpm run dev
limit: Number of problems to return (max 100, default 20)
skip: Number of problems to skip (default 0)
tags: Filter by tags (use + to separate multiple tags)
difficulty: Filter by difficulty (EASY, MEDIUM, HARD)
Example Queries
# Get user profilecurl http://localhost:3000/john_doe# Get daily questioncurl http://localhost:3000/daily# Get 10 easy array problemscurl"http://localhost:3000/problems?difficulty=EASY&tags=array&limit=10"# Get trending discussionscurl"http://localhost:3000/trendingDiscuss?first=5"
Rate Limiting
100 requests per 15 minutes per IP address
Rate limit headers included in responses:
X-RateLimit-Limit: Request limit
X-RateLimit-Remaining: Remaining requests
X-RateLimit-Reset: Reset time
Environment Variables
Create a.env file for configuration:
PORT=3000NODE_ENV=development
Error Handling
The API includes comprehensive error handling for:
Invalid usernames
Non-existent users
Malformed requests
Rate limiting
Network errors
GraphQL errors
Technologies Used
Node.js - Runtime environment
Express.js - Web framework
Axios - HTTP client for GraphQL requests
CORS - Cross-origin resource sharing
Helmet - Security headers
Compression - Response compression
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
License
MIT License - see LICENSE file for details
Support
For issues and questions:
Create an issue on GitHub
Check the API documentation athttp://localhost:3000/