A modern, feature-rich web-based code editor with real-time collaboration, AI-powered code assistance, and enterprise-grade security features. Perfect for remote pair programming, team coding sessions, and interactive code learning.
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running the Application
- Usage Guide
- API Documentation
- Development
- Contributing
- Deployment
- Troubleshooting
- Resources
- License
- Author
- Syntax Highlighting: Support for 20+ programming languages (JavaScript, Python, Java, C++, Rust, Go, Dart, PHP, Ruby, Haskell, Kotlin, Shell, Swift, XML, YAML, Perl, R, and more)
- Monaco Editor Integration: Professional-grade editor from VS Code
- Multiple Themes: Choose from various color schemes for comfortable coding
- Code Navigation:
- Word wrap and customizable line numbering
- Bracket matching with auto-highlighting
- Automatic indentation
- File explorer panel for intuitive file navigation
- Real-time Syntax Validation: Immediate error detection
- Code Formatting: Built-in code beautification
- Google Gemini AI Integration: Advanced code generation and suggestions
- Error Quick-Fix: Automatic suggestions for syntax errors
- Code Snippets: Pre-built snippets for common coding patterns
- AI Documentation: Auto-generate comprehensive code documentation
- Code Explanation: Get detailed explanations for complex code blocks
- Performance Optimization Suggestions: AI-driven performance analysis
- Multi-User Editing: Multiple users can edit the same file simultaneously
- Live Cursor Tracking: See other users' cursor positions in real-time
- Presence Awareness: Visual indicators showing who's currently editing
- Yjs CRDT: Conflict-free collaborative editing using Yjs protocol
- In-Editor Comments: Team discussions without leaving the editor
- Activity Feed: Track all changes and comments in real-time
- Email-Based Authentication: Secure login system with email verification
- JWT Tokens: Secure session management with JSON Web Tokens
- Two-Factor Authentication (2FA):
- OTP via email
- TOTP support for authenticator apps
- Password Management:
- Secure password hashing with bcrypt
- Forgot password recovery
- Password reset functionality
- Role-Based Access Control: Manage user permissions
- Private & Public Workspaces: Control collaboration scope
- Rate Limiting: Protect against brute force attacks
- Cloud Storage: Save and manage your code snippets
- Version History: Track changes over time
- Code Export: Download code in multiple formats
- Session Management: Auto-save functionality
- User Profiles: Personalized user dashboard
- Workspace Management: Create and organize multiple coding spaces
- User Galleries: Share code with community
- User Statistics: Track coding activity and progress
- Email Notifications: Stay updated with important activities
- Framework: React 18.3.1
- Build Tool: Vite
- Editor: Monaco Editor (VS Code's editor)
- Styling: Tailwind CSS 4.0.1
- Real-time Sync:
- Socket.io-client 4.8.1
- Yjs 0.x (CRDT for collaborative editing)
- Authentication:
- Google OAuth 2.0 (React OAuth)
- AppWrite
- UI Libraries:
- React Icons
- React Toastify (notifications)
- GSAP (animations)
- Routing: React Router DOM 7.1.4
- HTTP Client: Axios
- Runtime: Node.js
- Framework: Express.js 4.21.2
- WebSocket: Socket.io 4.8.1
- Database: MongoDB with Mongoose 8.9.5
- Authentication:
- JWT (jsonwebtoken 9.0.2)
- OTP (otp-generator 4.0.1)
- Bcrypt 6.0.0 for password hashing
- Email Service:
- Nodemailer 8.0.4
- Resend 6.4.2
- Twilio 5.4.3
- Validation: Joi 17.13.3
- CORS: Express CORS 2.8.5
- Environment: dotenv 16.4.7
- Framework: Flask
- AI Model: Google Gemini 1.5 Flash
- API Integration: google-generativeai
- CORS Support: Flask-CORS
- Code Quality: ESLint, Prettier
- Package Manager: npm/pnpm (for frontend and backend)
- Task Runner: Trunk (for workflow automation)
- Monorepo Support: Yarn workspaces compatible
codeEditor/
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # Reusable React components
β β β βββ aiSupport/ # AI assistance component
β β β βββ auth/ # Authentication components (login, signup, OTP, 2FA)
β β β βββ dropdown/ # Dropdown menu component
β β β βββ errorSuggetion/ # Error suggestion display
β β β βββ live chat/ # Real-time chat feature
β β β βββ mousePointer/ # Shared mouse cursor tracking
β β β βββ navbar/ # Navigation bar
β β βββ languages/ # Language support configurations
β β β βββ c/, cpp/, dart/, go/, haskell/, java/
β β β βββ kotlin/, perl/, php/, python/, r/
β β β βββ Ruby/, rust/, shell/, swift/, xml/, yaml/
β β βββ pages/ # Page components
β β β βββ about/ # About page
β β β βββ editor/ # Main editor page
β β β βββ home/ # Landing page
β β β βββ UserProfile/ # User profile pages
β β βββ themes/ # Editor theme configurations
β β βββ syntax/ # Syntax highlighting rules
β β βββ App.jsx # Main app component
β β βββ main.jsx # Entry point
β βββ package.json # Frontend dependencies
β βββ vite.config.js # Vite configuration
β βββ tailwind.config.js # Tailwind CSS config
β βββ eslint.config.js # ESLint configuration
β βββ vercel.json # Vercel deployment config
β
βββ backend/ # Node.js/Express backend
β βββ src/
β β βββ controller/ # Business logic controllers
β β β βββ user.controller.js # User management logic
β β βββ routes/ # API routes
β β β βββ user.routes.js # User endpoints
β β βββ Models/ # MongoDB schemas
β β β βββ User.model.js # User schema
β β β βββ OTP.model.js # OTP storage schema
β β β βββ RoomSession.model.js # Collaborative room data
β β β βββ codeSave.model.js # Code storage schema
β β βββ DB/
β β β βββ db.js # Database connection
β β βββ Middleware/
β β β βββ Auth.js # JWT authentication middleware
β β β βββ checking_parameters.js # Request validation
β β βββ app.js # Express app setup
β β βββ index.js # Server entry point
β β βββ sockethandel.js # WebSocket handlers for real-time collaboration
β βββ package.json # Backend dependencies
β βββ .env # Environment variables (create this)
β βββ Procfile # Heroku deployment config
β
βββ flask/ # Python AI/ML backend
β βββ app.py # Flask application
β βββ requirements.txt # Python dependencies
β βββ Procfile # Deployment config
β βββ pyvenv.cfg # Python virtual environment config
β
βββ .trunk/ # Trunk development tools
β βββ configs/ # Tool configurations
β β βββ .isort.cfg # Import sorting
β β βββ .markdownlint.yaml # Markdown linting
β β βββ ruff.toml # Python linting
β β βββ svgo.config.mjs # SVG optimization
β βββ tools.yaml # Tool definitions
β βββ plugins/ # Custom plugins
β
βββ .github/ # GitHub configuration (if present)
βββ .gitignore # Git ignore rules
βββ trunk.yaml # Trunk workflow config
βββ package.json # Monorepo root (if applicable)
βββ pnpm-lock.yaml # Lock file for pnpm
βββ README.md # This file
βββ vercel.json # Vercel deployment config
Before you begin, ensure you have the following installed:
- Node.js (v16.x or higher) - Download
- npm (v7.x or higher) or yarn/pnpm
- Python (3.8 or higher) - Download
- MongoDB (local or cloud instance like MongoDB Atlas)
- Git
- VS Code or any code editor
- Google Generative AI API Key (for AI features) - Get here
- AppWrite Account (for authentication) - Get here
- Twilio Account (optional, for SMS) - Get here
git clone https://github.com/Vaibhaviitian/codeeditor
cd codeEditorcd frontend
npm install
# or
pnpm installcd ../backend
npm install
# or
pnpm installcd ../flask
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
.\venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtCreate a .env file in the backend directory:
# Server Configuration
PORT=3000
NODE_ENV=development
# Database
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/codeeditor
# JWT
JWT_SECRET=your_jwt_secret_key_here
JWT_EXPIRE=7d
# Mail Service
MAIL_SERVICE=gmail
MAIL_USER=your-email@gmail.com
MAIL_PASSWORD=your-app-password
# OTP Configuration
OTP_EXPIRE=10m
OTP_RESEND_TIME=1m
# Resend Email Service
RESEND_API_KEY=your_resend_api_key
# Twilio Configuration
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=+1234567890
# AppWrite
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
APPWRITE_PROJECT_ID=your_project_id
APPWRITE_API_KEY=your_api_key
# CORS
FRONTEND_URL=http://localhost:5173
# Socket.io Configuration
SOCKET_IO_PORT=3001
SOCKET_IO_CORS_ORIGIN=*
# Client Configuration
VITE_BACKEND_URL=http://localhost:3000
VITE_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
VITE_APPWRITE_PROJECT_ID=your_project_id
VITE_GOOGLE_OAUTH_CLIENT_ID=your_google_client_id.apps.googleusercontent.comCreate a .env file in the frontend directory:
VITE_BACKEND_URL=http://localhost:3000
VITE_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
VITE_APPWRITE_PROJECT_ID=your_project_id
VITE_GOOGLE_OAUTH_CLIENT_ID=your_google_client_id.apps.googleusercontent.com
VITE_API_BASE_URL=http://localhost:3000/apiCreate a .env file in the flask directory or update app.py:
GEMINI_API_KEY=your_google_gemini_api_key
FLASK_ENV=development
FLASK_PORT=5000You need three terminal windows to run all services:
cd frontend
npm run devThe frontend will start at http://localhost:5173
cd backend
npm run devThe backend will start at http://localhost:3000
cd flask
# Activate virtual environment (if not already activated)
# Windows:
.\venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Run Flask
python app.pyThe Flask service will start at http://localhost:5000
Open your browser and navigate to: http://localhost:5173/
- Click on Sign Up on the landing page
- Enter your email and create a strong password
- Verify your email with the OTP sent to your inbox
- Set up 2FA (optional but recommended)
- Navigate to the Editor page
- Click New Session to create a new coding workspace
- Choose your programming language
- Start coding!
- Create or open an existing session
- Click Share button
- Copy the session link or room ID
- Share with team members
- Collaborators can join in real-time
- Write or paste code in the editor
- Click the AI Assistant icon
- Choose from options:
- Explain Code: Get explanation of selected code
- Generate from Prompt: Ask AI to generate code
- Fix Errors: Get suggestions for syntax errors
- Optimize: Get performance optimization tips
- Highlight code with your mouse
- Click Add Comment
- Type your comment
- Hit Enter to post
- Team members will see real-time updates
- Click Save button
- Give your code snippet a name
- Choose privacy level (Private/Public)
- Code is automatically backed up
POST /api/haxplore/user/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "secure_password",
"name": "John Doe"
}
POST /api/haxplore/user/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "secure_password"
}
Response: { token: "jwt_token", user: {...} }
POST /api/haxplore/user/request-otp
Content-Type: application/json
{
"email": "user@example.com"
}
POST /api/haxplore/user/verify-otp
Content-Type: application/json
{
"email": "user@example.com",
"otp": "123456"
}
POST /api/haxplore/user/forgot-password
Content-Type: application/json
{
"email": "user@example.com"
}
socket.emit('joinRoom', { roomID: 'room_123' });
socket.on('init', (state) => { /* Initialize editor state */ });// Send code updates
socket.emit('yjs-update', { roomID: 'room_123', update: [...], username: 'user' });
// Receive updates
socket.on('yjs-update', (update) => { /* Apply changes */ });socket.emit('awareness-update', { roomID: 'room_123', update: {...} });
socket.on('awareness-update', (data) => { /* Update user cursors */ });POST http://localhost:5000/generate_code
Content-Type: application/json
{
"code_prompt": "Create a function to reverse a string in Python"
}
Response: { generated_code: "def reverse_string..." }
# Install all dependencies
npm install
# Format code across all packages
npm run format
# Run linting
npm run lint
# Build for production
npm run build
# Run tests (if available)
npm run test- Create a feature branch:
git checkout -b feature/your-feature - Make your changes: Follow the code style guidelines
- Test locally: Ensure all three services run correctly
- Commit changes:
git commit -m "feat: add your feature" - Push to GitHub:
git push origin feature/your-feature - Create a Pull Request: Describe your changes clearly
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
pm2 start backend/src/index.js |
Production server (with PM2) |
- Use Prettier for formatting:
npm run format - Follow ESLint rules:
npm run lint - Use meaningful variable names
- Add comments for complex logic
- Keep functions small and focused
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Be respectful and constructive in discussions
# Install Vercel CLI
npm i -g vercel
# Deploy
cd frontend
vercel# Install Heroku CLI
# Visit: https://devcenter.heroku.com/articles/heroku-cli
# Login to Heroku
heroku login
# Create app
heroku create your-app-name
# Set environment variables
heroku config:set MONGODB_URI=your_mongodb_uri
# Deploy
git push heroku main# Push to Railway
railway upProblem: CORS error or connection refused
- Check if backend is running on
http://localhost:3000 - Verify
VITE_BACKEND_URLin.env - Check browser console for specific errors
Problem: Changes not syncing between users
- Ensure all users are in the same room ID
- Check Socket.io connection in browser DevTools
- Verify firewall isn't blocking WebSocket connections
Problem: AI suggestions not appearing
- Verify Google Gemini API key in Flask
.env - Check Flask server is running on port 5000
- Check Flask logs for API errors
Problem: Login/OTP not working
- Verify MongoDB is running
- Check email service credentials in
.env - Check browser console for error messages
Problem: MongoDB connection error
- Verify MongoDB is running locally or Atlas URL is correct
- Check network connectivity
- Verify credentials in
MONGODB_URI
- React Documentation
- Express.js Guide
- Flask Documentation
- Monaco Editor
- Socket.io Documentation
- Yjs Documentation
- MongoDB Documentation
- Tailwind CSS
πΉ Demo Video: Watch on Google Drive
π GitHub Repository: View on GitHub
This project is licensed under the ISC License - see the LICENSE file for details.
Vaibhav Aryan
- GitHub: @Vaibhaviitian
- Email: Contact via GitHub
- Thank you to all contributors
- Google Gemini AI for AI features
- Monaco Editor team
- Socket.io community
- All open-source projects used
- Installed Node.js and Python
- Cloned the repository
- Created MongoDB database
- Set up all
.envfiles - Installed frontend dependencies
- Installed backend dependencies
- Set up Flask virtual environment
- Started all three services
- Successfully accessed
http://localhost:5173 - Created an account
- Created your first coding session
If you have any questions or issues:
- Check the Troubleshooting section
- Search existing GitHub issues
- Create a new GitHub issue with detailed description
- Connect on LinkedIn/Twitter for discussions
Last Updated: April 2026 Version: 1.0.0
- Dark and light mode toggle.
- Customizable color themes.
- Collapsible sidebar for maximizing workspace.
- Simple and intuitive user interface for seamless interaction.
You can view a live demo of the editor - https://codeeditor-ten-zeta.vercel.app/
You can view a submitted ppt demo of this editor here.
- AI-driven auto-completion for function names and variables.
- Activity log to track recent edits and user actions.
- Password reset functionality.