A coding practice platform with containerized code execution, test cases, and leaderboard functionality.
- About
- Features
- Tech Stack
- Screenshots
- Installation
- API Endpoints
- Containerized Code Execution
- Database Models
- Future Enhancements
- Contributing
- License
Mini LeetCode is a web-based coding practice platform designed to help developers improve their programming skills by solving coding challenges. The platform provides a secure environment for code execution using containerization technology, supports multiple programming languages, and includes features like user authentication, problem solving, and leaderboards.
- User Authentication: Secure registration and login system with JWT tokens
- Coding Problems: Problems categorized by difficulty levels (Easy, Medium, Hard)
- Multi-language Support: Write solutions in JavaScript, Python, Java, or C++
- Secure Code Execution: Containerized execution environment for safety
- Test Case Validation: Automated testing of user submissions against predefined test cases
- Leaderboard System: Track and compare your progress with other users
- Submission History: View and review your previous submissions
- Modern UI: Clean and responsive interface built with React and Material-UI
- Node.js with Express.js - Fast, unopinionated web framework
- MongoDB with Mongoose - Flexible NoSQL database
- Docker - Containerization for secure code execution
- JWT - Secure authentication mechanism
- React.js - Component-based UI library
- Material-UI - Modern React UI framework
- Monaco Editor - Code editor with syntax highlighting
- React Router - Declarative routing for React
(Add screenshots of your application here)
- Node.js (v14 or higher)
- MongoDB (local or cloud instance)
- Docker Desktop
- npm or yarn
-
Clone the repository:
git clone https://github.com/itsaahsan/Mini-LeetCode.git cd Mini-LeetCode
-
Install backend dependencies:
npm install
-
Install frontend dependencies:
cd client && npm install
-
Set up environment variables:
- Create a
.env
file in the root directory - Add your
MONGO_URI
andJWT_SECRET
- Create a
-
Start Docker Desktop and ensure it's running
-
Run the development server:
cd .. && npm run dev
-
Open your browser and navigate to
http://localhost:3000
POST /api/auth/register
- Register a new userPOST /api/auth/login
- Login userGET /api/auth/profile
- Get user profile (protected)
GET /api/problems
- Get all problemsGET /api/problems/:id
- Get problem by IDPOST /api/problems
- Create a new problem (protected)
POST /api/submissions
- Submit code for a problem (protected)GET /api/submissions
- Get user submissions (protected)GET /api/submissions/:id
- Get submission by ID (protected)
GET /api/leaderboard
- Get leaderboard
POST /api/code/execute
- Execute code with test cases (protected)
The application uses Docker to execute user code in isolated containers for security. This approach provides:
- Isolation: Each code execution runs in its own container
- Resource Limits: Memory and CPU usage are controlled
- Security: Network access is disabled to prevent malicious code
- Multi-language Support: Supports JavaScript (Node.js), Python, Java, and C++
Each code execution is limited by:
- Memory: 100MB
- Network: Disabled
- Time: Docker default timeout
- username
- password (hashed)
- score
- problemsSolved
- createdAt
- title
- description
- difficulty (Easy, Medium, Hard)
- points
- testCases (array)
- constraints
- examples
- tags
- createdAt
- userId (reference to User)
- problemId (reference to Problem)
- code
- language
- status (Pending, Accepted, Wrong Answer, etc.)
- executionTime
- memoryUsage
- testCasesPassed
- totalTestCases
- submittedAt
- Real-time code execution with timeouts
- More sophisticated test case validation
- Syntax highlighting in code editor
- Discussion forums for problems
- Company-specific interview questions
- Progress tracking and statistics
- Dark mode support
- Mobile-responsive design
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/YourFeature
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/YourFeature
) - Open a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by [Ahsan]