A powerful real-time collaborative code editor that enables teams to code together seamlessly from anywhere in the world. Built with Next.js, Node.js, Socket.IO, and MongoDB.
- Real-time Collaboration: Code together with your team in real-time
- Multi-language Support: Support for Python, JavaScript, Java, C++, and more
- Instant Code Execution: Run code and see results immediately
- Live Code Preview: See changes as they happen
- User Authentication: Secure signup/login system
- Room-based Collaboration: Create and join collaboration spaces
- Active User Tracking: See who's currently in the room
- AI Code Completion: Powered by Mistral AI for intelligent code suggestions
- Real-time Cursor Tracking: See where other users are typing
- Code Syntax Highlighting: Beautiful syntax highlighting for all supported languages
- Responsive Design: Works perfectly on desktop and mobile devices
- Dark/Light Theme: Toggle between themes for comfortable coding
- WebSocket Communication: Real-time bidirectional communication
- RESTful API: Clean and well-documented API endpoints
- MongoDB Integration: Scalable database solution
- JWT Authentication: Secure token-based authentication
- Email Notifications: Welcome emails for new users
- Framework: Next.js 14 with React 18
- Language: TypeScript
- Styling: Tailwind CSS with custom components
- State Management: Recoil
- Code Editor: Monaco Editor with AI integration
- Real-time: Socket.io client
- UI Components: Radix UI primitives with custom styling
- Runtime: Node.js with Express
- Database: MongoDB with Mongoose ODM
- Authentication: JWT with bcrypt for password hashing
- Real-time: Socket.io server
- AI Integration: Mistral AI for code completion
- Email Service: Nodemailer for user notifications
- Real-time Communication: Handles live code synchronization
- Room Management: Manages collaboration spaces
- User Tracking: Tracks active users in real-time
- Mistral AI - Code completion and suggestions
- MongoDB Atlas - Cloud database service
Code Collab/
βββ client/ # Next.js frontend application
β βββ app/ # App router pages and components
β β βββ auth/ # Authentication pages (login/signup)
β β βββ collab/ # Collaboration features
β β β βββ create/ # Create new collaboration
β β β βββ join/ # Join existing collaboration
β β β βββ space/ # Main collaboration workspace
β β βββ states/ # Recoil state management
β βββ components/ # Reusable UI components
β β βββ custom/ # Custom components
β β βββ ui/ # Radix UI components
β βββ public/ # Static assets
βββ server/ # Express.js backend
β βββ api/ # API routes and models
β β βββ models/ # Database models
β β βββ user_routes.js
β β βββ collab_routes.js
β βββ helper/ # Utility functions
β βββ websocket/ # WebSocket server
βββ README.md
- Node.js (v18 or higher)
- npm, yarn, or pnpm
- MongoDB Atlas Database
- Mistral AI API key
- Git
Create .env files in both client/ and server/ directories:
NEXT_PUBLIC_API_URI=http://localhost:4000
NEXT_PUBLIC_WS_URI=http://localhost:4001PORT=4000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
MISTRAL_API_KEY=your_mistral_api_key
EMAIL_USER=your_email
EMAIL_PASS=your_email_passwordPORT=4001
API_BASE_URL=http://localhost:4000
CORS_ORIGIN=http://localhost:3000-
Clone the repository
git clone https://github.com/ShivaanjayNarula/Code-Collab.git cd Code-Collab -
Install client dependencies
cd client yarn install -
Install server dependencies
cd ../server npm install -
Install WebSocket server dependencies
cd websocket npm install
-
Start the backend server
cd server node --watch server.js -
Start the WebSocket server
cd server/websocket node ws-server.js -
Start the frontend application
cd client npm run dev
The application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:4000
- WebSocket Server: http://localhost:4001
- Visit the homepage and sign up for an account
- Create a new collaboration space or join an existing one
- Start coding with real-time collaboration!
- Click "Create Collab" on the homepage
- Choose a name for your collaboration space
- Share the generated link with your team members
- Use the collaboration link shared by your team
- Enter your credentials if prompted
- Start coding together in real-time!
POST /users/signup- User registrationPOST /users/login- User loginPOST /users/verify- Email verification
POST /collab/create- Create new collaborationGET /collab/getActiveUsers- Get active users in collaborationPOST /collab/activeHook- Update active user statusPOST /collab/leftHook- Update user leave status
POST /complete- Get AI-powered code suggestions
- JWT Authentication: Secure token-based authentication
- Password Hashing: Bcrypt for secure password storage
- CORS Protection: Cross-origin resource sharing protection
- Input Validation: Comprehensive input validation and sanitization
- Rate Limiting: Protection against abuse
- Responsive Design: Works on all device sizes
- Dark/Light Theme: Automatic theme switching
- Smooth Animations: Framer Motion for fluid interactions
- Toast Notifications: Real-time user feedback
- Loading States: Professional loading indicators
- Error Handling: User-friendly error messages
- 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.
- Next.js for the amazing React framework
- Monaco Editor for the code editor
- Socket.io for real-time communication
- Tailwind CSS for the utility-first CSS framework
- Radix UI for accessible UI primitives
- Mistral AI for AI code completion
If you encounter any issues or have questions, please:
- Check the Issues page
- Create a new issue with detailed information
- Contact the development team
Happy Coding Together! π