A comprehensive online judge platform that allows users to solve programming problems in C++, Java, and Python with real-time compilation and execution.
- Multi-language Support: C++, Java, and Python compilation and execution
- Real-time Code Execution: Instant feedback on code compilation and execution
- Problem Management: Browse, filter, and solve programming problems
- Submission Tracking: Track all your submissions with detailed results
- Test Case Validation: Automatic validation against hidden test cases
- User Authentication: Secure user registration and login system
- Monaco Editor: Professional code editor with syntax highlighting
- Language Toggle: Easy switching between C++, Java, and Python
- Code Templates: Pre-filled code templates for each language
- Custom Input Testing: Test your code with custom inputs before submission
- Difficulty Levels: Easy, Medium, and Hard problems
- Tag System: Problems categorized by algorithms and data structures
- Detailed Descriptions: Comprehensive problem statements with examples
- Sample I/O: Sample inputs and outputs for better understanding
- Statistics: View acceptance rates and submission counts
- Instant Processing: Fast compilation and execution of code
- Detailed Results: Get comprehensive feedback on your submissions
- Status Tracking: Real-time status updates (Pending, Accepted, Wrong Answer, etc.)
- Execution Metrics: View execution time and memory usage
- Error Messages: Detailed error information for debugging
- Node.js with Express.js framework
- MongoDB with Mongoose ODM
- JWT for authentication
- bcryptjs for password hashing
- Child Process for code execution
- File System operations for temporary file management
- React 19 with functional components and hooks
- React Router DOM for client-side routing
- Monaco Editor for code editing
- Tailwind CSS for responsive styling
- Axios for API communication
- React Hot Toast for notifications
- Vite for fast development and building
- C++: GCC with C++17 standard
- Java: JDK 11+ with automatic class detection
- Python: Python 3.x interpreter
- Node.js (v14 or higher)
- MongoDB (local or cloud instance)
- GCC compiler (for C++)
- Java JDK (for Java)
- Python 3.x (for Python)
-
Navigate to the backend directory:
cd auth-backend -
Install dependencies:
npm install
-
Create a
.envfile with the following variables:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key PORT=5000 NODE_ENV=development
-
Seed the database with sample problems:
node seed.js
-
Start the development server:
npm run dev
-
Navigate to the frontend directory:
cd auth-frontend -
Install dependencies:
npm install
-
Create a
.envfile:VITE_API_URL=http://localhost:5000/api
-
Start the development server:
npm run dev
POST /api/users/register- User registrationPOST /api/users/login- User loginGET /api/users/profile- Get user profile (protected)
GET /api/problems- Get all problems with filteringGET /api/problems/:id- Get specific problemPOST /api/problems- Create new problem (admin only)PUT /api/problems/:id- Update problem (admin only)DELETE /api/problems/:id- Delete problem (admin only)GET /api/problems/stats- Get problem statistics
POST /api/submissions- Submit solutionPOST /api/submissions/test- Test code without submissionGET /api/submissions/:id- Get submission detailsGET /api/submissions/user/:userId- Get user's submissionsGET /api/submissions/problem/:problemId- Get problem submissions (admin)GET /api/submissions/stats- Get submission statistics
- Register/Login: Create an account or login to existing account
- Browse Problems: Navigate to the problems page to see available challenges
- Filter Problems: Use difficulty and tag filters to find suitable problems
- Solve Problems: Click on a problem to view details and start coding
- Choose Language: Select your preferred programming language (C++/Java/Python)
- Write Code: Use the Monaco editor to write your solution
- Test Code: Use custom input to test your code before submission
- Submit Solution: Submit your code for evaluation
- View Results: Check your submission status and results
- Track Progress: View all your submissions in the submissions page
- Login as Admin: Use admin credentials to access admin features
- Create Problems: Add new programming problems with test cases
- Manage Problems: Edit or delete existing problems
- Monitor Submissions: View all submissions for problems
- Review Statistics: Access platform-wide statistics
After running the seed script, you can login as admin using:
- Email: admin@onlinejudge.com
- Password: admin123
The platform implements several security measures:
- Process Isolation: Each code execution runs in a separate process
- Time Limits: Configurable execution time limits to prevent infinite loops
- Memory Limits: Memory usage restrictions (future enhancement)
- Temporary Files: Automatic cleanup of temporary compilation files
- Input Sanitization: Proper validation of user inputs
The platform comes with 5 pre-configured problems:
- Two Sum (Easy) - Hash table problem
- Reverse Integer (Medium) - Math problem
- Valid Parentheses (Easy) - Stack problem
- Longest Common Subsequence (Hard) - Dynamic programming
- Fibonacci Number (Easy) - Math/DP/Recursion
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Make your changes
- Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Create a Pull Request
- Docker containers for safer code execution
- Memory usage monitoring
- Contest system with time-based competitions
- Plagiarism detection
- Discussion forums for problems
- Editorial solutions
- Rating system for users
- More programming languages (C#, Go, Rust)
- Code sharing and collaboration features
- Mobile responsive improvements
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email your questions or create an issue in the repository.
- MongoDB for the database solution
- Monaco Editor for the code editing experience
- The open-source community for various packages and tools used