SimpleOJ
Run C, C++, Python and Java code using NodeJS Child_Process
Install / Use
/learn @ah-naf/SimpleOJREADME
SimpleOJ
SimpleOJ is an interactive online platform for coding enthusiasts. It allows users to solve programming challenges and run code snippets in C, C++, Java, and Python.
You can use @ah_naf/runcode npm package to run C, C++, Python and Java code.
Demo
For a visual demonstration of SimpleOJ in action, check out our video demo:
<center> <a href="https://www.youtube.com/watch?v=Xfc7_3AgQOw"> <img src="https://img.youtube.com/vi/Xfc7_3AgQOw/0.jpg" alt="Route Demo" width="480" height="360"> </a> </center>Features
User Capabilities
- Authentication: Users can log in using Google authentication, powered by PassportJS.
- Problem Management: Authenticated users can add, edit, and delete programming problems, complete with custom test cases.
- Code Execution: All users can run their code on the problem page. Code submissions and verifications are available for signed-in users.
- Submission Feedback: After submitting code, users receive immediate feedback on whether their solution is accepted, incorrect, or has timed out (TLE).
- History: Users can view their past submissions for each problem and view their code.
- Status: Users can see everyones recent submissions.
Running Code
SimpleOJ uses Node.js child processes to execute C, C++, Java and Python code. The execution is managed in the backend, ensuring secure and isolated runtime environments for each code snippet.
Technology Stack
- Frontend: Developed with ReactJS for a dynamic user interface.
- Backend: Built on NodeJS with Express, offering a robust server-side framework.
- Database: MongoDB is used for data storage, providing flexibility and scalability.
- Authentication: PassportJS manages user authentication, ensuring secure logins.
- Concurrency Management: Bull Queue is utilized to handle concurrent code execution requests efficiently.
- Containerization: Docker is used for containerizing the application, ensuring a consistent environment across different machines.
Future Goals
- Complexity Analysis: I aim to incorporate memory complexity analysis for running code. Resources and learning are underway for this implementation.
Local Setup
To get SimpleOJ up and running on your local machine, follow these instructions:
Prerequisites
- Ensure Docker is installed on your machine.
- Node.js and npm should be installed for managing dependencies.
Steps
-
Install Docker: If you haven't already, install Docker following the instructions here.
-
Clone Repository: Clone this repository to your local machine using
git clone [repository-url]. -
Install Dependencies:
- Navigate to the
clientdirectory in the terminal and runnpm installto install all client-side dependencies. - Similarly, go to the
serverdirectory and runnpm installfor server-side dependencies.
- Navigate to the
-
Set Up Environment Variables:
- In the
serverdirectory, create a.envfile. - Add the following environment variables:
ReplaceGOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secretyour_google_client_idandyour_google_client_secretwith your actual Google client ID and secret.
- In the
-
Start the Application:
- From the root directory of the project, run
docker compose upin the terminal. This will set up the necessary Docker containers. - Optionally, you can run the client and server separately by navigating to their respective directories and executing
npm startin each.
- From the root directory of the project, run
-
Accessing SimpleOJ:
- Once everything is up and running, your local instance of SimpleOJ should be accessible. The client will typically run on
http://localhost:3000, and the server will run onhttp://localhost:5000.
- Once everything is up and running, your local instance of SimpleOJ should be accessible. The client will typically run on
Troubleshooting
- If you encounter any issues during the setup, ensure all the environment variables are correctly set and that Docker is running properly.
- For any dependency-related issues, try removing the
node_modulesfolder in the client and server directories, and runnpm installagain. gi
Support and Contact
For any assistance or inquiries, feel free to connect with me on LinkedIn.
Related Skills
bluebubbles
345.4kUse when you need to send or manage iMessages via BlueBubbles (recommended iMessage integration). Calls go through the generic message tool with channel="bluebubbles".
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
slack
345.4kUse when you need to control Slack from OpenClaw via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
