A modern, full-featured online code editor platform built with the MERN stack (MongoDB, Express.js, React, Node.js) featuring Monaco Editor for an exceptional coding experience.
- Monaco Editor Integration - Professional code editing with syntax highlighting, autocomplete, and error marking
- Multi-language Support - Support for 18+ programming languages including JavaScript, Python, Java, C++, and more
- Real-time Code Execution - Execute code online using Judge0 API with input/output support
- JWT Authentication - Secure user authentication and authorization
- Code Snippet Management - Save, organize, and manage your code snippets
- Public/Private Sharing - Share code snippets publicly or keep them private
- User Profiles - Customizable user profiles with preferences
- Code Execution History - Track execution results, timing, and memory usage
- Folder Organization - Organize code snippets into folders
- Tagging System - Tag and categorize your code snippets
- Search & Filter - Advanced search and filtering capabilities
- Responsive Design - Modern, responsive UI that works on all devices
- Dark/Light Theme - Toggle between dark and light themes
- Code Templates - Pre-built code templates for quick start
- Node.js - JavaScript runtime
- Express.js - Web application framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - JSON Web Tokens for authentication
- bcryptjs - Password hashing
- Axios - HTTP client for API calls
- React - JavaScript library for building user interfaces
- Monaco Editor - Professional code editor (same as VS Code)
- React Router - Client-side routing
- Styled Components - CSS-in-JS styling
- React Icons - Icon library
- React Hot Toast - Toast notifications
- Judge0 API - Online code execution engine
- RapidAPI - API marketplace for Judge0
Before running this application, make sure you have the following installed:
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn package manager
git clone <repository-url>
cd codecraft2# Install server dependencies
npm install
# Install client dependencies
cd client
npm install
cd ..Create a .env file in the root directory:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/codecraft_editor
JWT_SECRET=your_super_secret_jwt_key_here_change_in_production
NODE_ENV=development
JUDGE0_API_URL=https://judge0-ce.p.rapidapi.com
RAPIDAPI_KEY=your_rapidapi_key_here
RAPIDAPI_HOST=judge0-ce.p.rapidapi.comMake sure MongoDB is running on your system:
# On Windows
net start MongoDB
# On macOS/Linux
sudo systemctl start mongod# Run both server and client concurrently
npm run dev
# Or run them separately:
# Terminal 1 - Server
npm run server
# Terminal 2 - Client
npm run client# Build the client
npm run build
# Start the server
npm startcodecraft2/
βββ server/ # Backend server
β βββ index.js # Main server file
β βββ models/ # MongoDB models
β β βββ User.js # User model
β β βββ Code.js # Code snippet model
β βββ routes/ # API routes
β β βββ auth.js # Authentication routes
β β βββ code.js # Code management routes
β β βββ user.js # User profile routes
β βββ middleware/ # Custom middleware
β βββ auth.js # JWT authentication middleware
βββ client/ # Frontend React app
β βββ public/ # Static files
β βββ src/ # Source code
β β βββ components/ # React components
β β β βββ auth/ # Authentication components
β β β βββ editor/ # Code editor components
β β β βββ layout/ # Layout components
β β β βββ common/ # Common components
β β βββ contexts/ # React contexts
β β βββ App.js # Main app component
β βββ package.json # Client dependencies
βββ package.json # Server dependencies
βββ README.md # Project documentation
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current userPOST /api/auth/logout- User logout
POST /api/code/execute- Execute codePOST /api/code/save- Save code snippetGET /api/code/my-codes- Get user's code snippetsGET /api/code/public- Get public code snippetsGET /api/code/:id- Get specific code snippetPUT /api/code/:id- Update code snippetDELETE /api/code/:id- Delete code snippet
GET /api/user/profile- Get user profilePUT /api/user/profile- Update user profilePUT /api/user/preferences- Update user preferencesGET /api/user/stats- Get user statistics
- Monaco Editor with full VS Code-like experience
- Syntax highlighting for 18+ programming languages
- Auto-completion and IntelliSense
- Error marking and debugging support
- Multiple themes (dark/light)
- Customizable settings (font size, tab size, etc.)
- Real-time execution using Judge0 API
- Input/output support for interactive programs
- Execution statistics (time, memory usage)
- Error handling with detailed error messages
- Multiple language support for execution
- Secure authentication with JWT tokens
- User profiles with customizable preferences
- Code snippet organization with folders and tags
- Public/private sharing options
- Execution history tracking
- JWT Authentication for secure API access
- Password hashing with bcryptjs
- Input validation and sanitization
- Rate limiting to prevent abuse
- CORS configuration for cross-origin requests
- Helmet.js for security headers
- Create a Heroku account
- Install Heroku CLI
- Create a new Heroku app
- Set environment variables in Heroku dashboard
- Deploy using Git:
heroku create your-app-name
git push heroku main- Install Vercel CLI
- Deploy the client folder:
cd client
vercel- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Monaco Editor - Professional code editor
- Judge0 - Online code execution engine
- React - Frontend framework
- Express.js - Backend framework
- MongoDB - Database
If you have any questions or need help, please open an issue on GitHub or contact the development team.
Happy Coding! π