LeetCode Platform is a comprehensive coding challenge platform that provides users with an interactive environment to solve algorithmic problems, track their progress, and enhance their coding skills. This platform combines the best features of coding platforms with AI-powered assistance and video tutorial integration.
Key Benefits:
- π― Structured coding challenges with multiple difficulty levels
- π€ AI-powered doubt resolution and learning assistance
- πΉ Integrated video tutorial system for better learning
- π Comprehensive progress tracking and user statistics
- π Secure authentication with role-based access control
- β‘ High-performance caching with Redis for optimal user experience
- Runtime: Node.js (v18+)
- Framework: Express.js
- Database: MongoDB with Mongoose
- Cache: Redis
- Authentication: JWT + Express Sessions
- File Storage: Cloudinary (for video content)
- Rate Limiting: Express Rate Limit + Redis
- AI Integration: Google Generative AI (@google/genai)
- Script Runner: Nodemon (development)
- Environment Management: dotenv
- Input Validation: validator.js
- Security: bcrypt, cors, cookie-parser
- β User Registration & Login: Secure authentication system
- π€ Profile Management: Complete user profile CRUD operations
- π Role-based Access: Admin and regular user roles
- π User Statistics: Track solved problems and performance metrics
- π Problem Creation: Admin can create coding challenges
- π·οΈ Categorized Problems: Easy, Medium, Hard difficulty levels
- π·οΈ Tagged Content: Array, LinkedList, DP, Graph, String, Stack, Queue, Heap, Tree
- π§ͺ Test Cases: Visible and hidden test cases for comprehensive evaluation
- π» Multi-language Support: Initial code templates and reference solutions
βΆοΈ Code Running: Test your code against visible test cases- βοΈ Code Submission: Submit solutions for evaluation
- π Execution Results: Detailed feedback on submission performance
- β‘ Rate Limiting: Prevents abuse with intelligent submission throttling
- π§ Doubt Resolution: AI chatbot for instant problem-solving assistance
- π‘ Learning Guidance: Contextual help for algorithmic challenges
- π Smart Responses: Google Generative AI integration for accurate solutions
- πΉ Video Content: Upload and manage educational video content
- π Problem Integration: Link videos to specific coding problems
- βοΈ Cloud Storage: Secure video hosting with Cloudinary
- ποΈ Content Management: Admin controls for video content lifecycle
- π‘οΈ JWT Authentication: Secure token-based authentication
- πͺ Session Management: Express sessions with secure cookie handling
- π« CORS Protection: Cross-origin request security
- β‘ Redis Caching: Enhanced performance with intelligent caching
- π¦ Rate Limiting: Prevents API abuse and ensures fair usage
- Node.js (v18 or higher)
- MongoDB (local or cloud instance)
- Redis server
- npm or yarn package manager
-
Clone the Repository
git clone <your-repository-url> cd Leetcodeβ
-
Install Dependencies
npm install
-
Environment Configuration Create a
.env
file in the root directory:# Database Configuration MONGODB_URI=mongodb://localhost:27017/leetcode-platform REDIS_URL=redis://localhost:6379 # Server Configuration PORT=5000 SESSION_SECRET=your-super-secret-session-key # JWT Configuration JWT_SECRET=your-jwt-secret-key # AI Configuration GOOGLE_AI_API_KEY=your-google-ai-api-key # Cloudinary Configuration (for video uploads) CLOUDINARY_CLOUD_NAME=your-cloudinary-name CLOUDINARY_API_KEY=your-cloudinary-api-key CLOUDINARY_API_SECRET=your-cloudinary-secret
-
Start Development Server
npm run dev
-
Verify Installation Visit
http://localhost:5000/test
to confirm the backend is running successfully.
# Development mode (with auto-restart)
npm run dev
# Production mode
npm start
-
Register a new user:
curl -X POST http://localhost:5000/user/register \ -H "Content-Type: application/json" \ -d '{"firstName":"John","lastName":"Doe","email":"john@example.com","password":"password123"}'
-
Login:
curl -X POST http://localhost:5000/user/login \ -H "Content-Type: application/json" \ -d '{"email":"john@example.com","password":"password123"}'
-
Get all problems:
curl -X GET http://localhost:5000/problem/getAllProblem \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
πΈ Screenshot Placeholder: Add application screenshots here
Leetcodeβ
/
βββ src/ # Source code
β βββ controller/ # Route controllers
β β βββ ai.controller.js # AI chatbot functionality
β β βββ problem.controller.js # Problem management
β β βββ submission.controller.js # Code execution & submission
β β βββ user.controller.js # User authentication & management
β β βββ video.controller.js # Video content management
β βββ middleware/ # Custom middleware
β β βββ adminMiddleware.js # Admin role verification
β β βββ redisRateLimiter.js # Request rate limiting
β β βββ userMiddleware.js # User authentication
β βββ model/ # Database models
β β βββ problem.js # Problem schema
β β βββ solutionVideo.js # Video metadata schema
β β βββ submission.js # Submission schema
β β βββ user.js # User schema
β βββ routes/ # API route definitions
β β βββ ai.js # AI chatbot routes
β β βββ problemCreator.js # Problem CRUD routes
β β βββ submission.js # Code execution routes
β β βββ userAuth.js # Authentication routes
β β βββ videoCreator.js # Video management routes
β βββ config/ # Configuration files
β β βββ db.js # MongoDB connection
β β βββ redis.js # Redis connection
β βββ utils/ # Utility functions
β β βββ problemUtility.js # Problem-specific utilities
β β βββ validator.js # Input validation utilities
β βββ index.js # Application entry point
βββ node_modules/ # Dependencies
βββ package.json # Project configuration
βββ package-lock.json # Dependency lock file
βββ README.md # Project documentation
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /user/register |
Register a new user | No |
POST | /user/login |
User login | No |
POST | /user/logout |
User logout | Yes |
GET | /user/check |
Verify user session | Yes |
GET | /user/getProfile |
Get user profile | Yes |
PUT | /user/updateProfile |
Update user profile | Yes |
DELETE | /user/deleteProfile |
Delete user account | Yes |
POST | /user/admin/register |
Admin registration | Admin |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /problem/create |
Create new problem | Admin |
PUT | /problem/update/:id |
Update problem | Admin |
DELETE | /problem/delete/:id |
Delete problem | Admin |
GET | /problem/getProblem/:id |
Get problem by ID | Yes |
GET | /problem/getAllProblem |
Get all problems | Yes |
GET | /problem/userProblem |
Get user's solved problems | Yes |
GET | /problem/submittedProblem/:pid |
Get submission history | Yes |
GET | /problem/userStats |
Get user statistics | Yes |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /submission/run/:id |
Run code against visible test cases | Yes |
POST | /submission/submit/:id |
Submit code for evaluation | Yes |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /ai/chat |
Chat with AI for doubt resolution | Yes |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
GET | /video/create/:id |
Generate upload signature | Admin |
POST | /video/save |
Save video metadata | Admin |
DELETE | /video/delete/:videoId |
Delete video content | Admin |
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and test thoroughly
- Commit with descriptive messages:
git commit -m 'Add amazing feature'
- Push to your branch:
git push origin feature/amazing-feature
- Open a Pull Request
- π Follow existing code style and conventions
- π§ͺ Write tests for new features
- π Update documentation for API changes
- π Test your changes locally before submitting
- π‘ Ensure backward compatibility for existing APIs
- Use ESLint for code formatting
- Write descriptive commit messages
- Add JSDoc comments for new functions
- Follow RESTful API design principles
Developer: Vipul Kumar
Email: vipulvipul65845@gmail.com
- π GitHub: @vipulkumar
- πΌ LinkedIn: linkedin.com/in/vipulkumar
- π Portfolio: vipulkumar.dev
- π§ Email: vipulvipul65845@gmail.com
β Star this repository if you found it helpful!
Built with β€οΈ for the coding community