I was curious about how Codeforces worked, so created my own version! Welcome to Codespaces—your social problem solving playground! 🧑💻✨
-
✏️ Create Your Own Problems: Feeling creative? You can also create and manage your own coding problems! 🎨
-
🔍 Codeforces Problem Scraping: Users can just enter a Codeforces problem link and watch the magic happen! The problem statement and test cases are automatically parsed and shared across all the users int the room. 🌟
-
🚀 Code Evaluation: Evaluate code submissions on the fly!
-
👩👨💻 Collaborative Coding: Team up with your friends and solve problems together in real-time with up to 10 users.
-
🎤 Group Voice Chat: Integrated group voice chat for seamless collaboration using WebRTC.
-
📦 Problem Packages: Easily store and manage problem packages.
-
🧮🖼️ Math and Image Rendering: Supports rendering math equations and images (or any media) in problem statements.
-
⚡ Caching: Lightning-fast caching for problem statements and packages using Redis.
Can be used to host contests completely locally(for the most part)
Check out the demo here. 🍿
Hosting is down at the moment cause I lost access to my EC2 instance :(
Here's a high-level architecture of our cute little system. 🥰
- Every new submission triggers a new Docker container (Alpine Linux). 🐳
- The container:
- Compiles and runs the program.
- Pulls the test data from the database if it’s not cached.
- Compares the program output to the expected output.
- Sends a verdict (AC/WA/CR/TLE/RTE).
- Programs have a 2-second time limit; if they don't finish in time, they get a TLE (Time Limit Exceeded) verdict. ⏰
-
🎤 Group Voice Chat: Implemented using WebRTC to reduce server load. Chat with your whole group while you code!
-
🐳 Docker API: Used to spawn containers on the fly for code evaluation.
-
🤝 Collaborative Features: Utilized WebSockets (Socket.IO) for real-time collaboration.
-
⛏ Web scraping: Used BeautifulSoup with a custom scraper to scrape problems from codeforces.
-
📦 Problem Packages: Stored in MongoDB for easy management.
- Includes:
- Problem Statements (Interpreted)
- Sample test data
- Main test data (for evaluating submissions)
- Expected outputs for the main tests
- Includes:
-
⚡ Redis Caching: Cached problem packages and test data to limit database hits.
-
🧮 Math Rendering: Used KaTeX for rendering math equations.
-
🚫 Rate Limiting: Added to each compilation API call to prevent abuse.
- Only supports C++ for now. 🖋️
To use this project, follow these steps:
- Clone the repository:
git clone https://github.com/nubskr/codespace.git cd codespace
- Install dependencies:
npm install
- Start the server:
npm start
- Open the application in your browser.
- You need Docker and Redis installed in the backend to use the submission functionality.
- The
./Docker
directory contains the Docker image I made to evaluate the submissions.