Creating a Minimum Viable Product (MVP) for an Online Judge platform using the MERN (MongoDB, Express.js, React.js, Node.js) stack. The platform allows users to participate in coding challenges, submit solutions, and receive automated evaluations.
The MVP Online Judge platform enables user registration, problem listing, problem details viewing, code submission, solution evaluation, and leaderboard display. It focuses on simplicity and usability, catering to users with basic coding skills. Mainly the focus would be to first implement a basic system where people can submit code in a selected set of programming languages which the system supports and get scored/evaluated based on it.
-
User Registration
- Users can register by providing basic details such as name, email, and password.
- Simplified registration process without email verification for faster onboarding.
-
Problem Listing:
- The platform displays a curated list of coding problems for users to solve.
- Each problem is categorized by difficulty level to guide users.
-
Problem Details Viewing:
- Users can view detailed descriptions of each problem, including the statement and input/output specifications.
-
Code Submission:
- Users can submit their solutions to the provided problems.
- Solutions can be entered directly into a text editor on the platform.
-
Solution Evaluation:
- Submitted solutions are automatically evaluated against predefined test cases.
- Verdicts (e.g., "Accepted," "Wrong Answer", βTLEβ) are generated based on evaluation results.
-
Leaderboard:
- An optional feature displays a simple leaderboard ranking users based on their solved problems.
- Users can see their ranking relative to other participants.
-
Concurrent Requests Handling:
- To ensure smooth performance during peak usage, asynchronous processing and submission queuing are implemented.
- Each submission is acknowledged immediately, maintaining fairness and user experience.
-
Security and Code Execution Efficiency:
- Containerization using Docker isolates code execution environments, enhancing security and efficiency.
- Resource limits and time constraints prevent abuse and ensure timely evaluations.
- MongoDB is used for data storage with collections for users, problems, test cases, and solutions.
- Document structures are simple and intuitive, focusing on essential fields for MVP functionality.
Collections:
- Users
- userId: String (Unique identifier for each user)
- password: String (Hashed password for user authentication)
- email: String (User's email address)
- fullName: String (User's full name)
- dob: Date (User's date of birth)
- Problems
- problemId: String (Unique identifier for each problem)
- name: String (Name/title of the problem)
- statement: String (Description/statement of the problem)
- code: String (Code snippet or template for the problem, if applicable)
- difficulty: String (Optional field indicating the difficulty level of the problem)
- Test Cases
- testCaseId: String (Unique identifier for each test case)
- problemId: String (Foreign key referencing the associated problem)
- input: String (Input data for the test case)
- output: String (Expected output for the given input)
- Submissions
- submissionId: String (Unique identifier for each solution)
- problemId: String (Foreign key referencing the associated problem)
- userId: String (Foreign key referencing the user who submitted the solution)
- verdict: String (Verdict/result of the solution evaluation, e.g., "Accepted," "Wrong Answer")
- submittedAt: Date (Timestamp indicating when the solution was submitted)
- Express.js handles API endpoints for user management, problem listing, submission handling, and leaderboard display at the backend.
- Using JWT Tokens for authentication and later down the line using OAuth directly.
- React.js frontend provides a simple user interface with screens for:
- Problem listing
- Problem details viewing
- Code submission.
- Using UI Library like Chakra UI for components to be minimalistic and user-friendly, facilitating easy navigation and interaction.
- Scores will be evaluated for each submission upon which the ranking would be calculated with a simple table sorted by the scores, submittedAt time and other factors.
- Docker to be used for isolation of compilation of each submission
- Docker containers are employed to isolate code execution environments.
- Pre-configured containers for popular programming languages ensure compatibility and efficiency.
- Time limits and resource constraints prevent excessive resource consumption and execution delays.
- Caching & Plagiarism Checking