A real-time collaborative code editor built with React, Node.js, and Socket.IO that allows multiple users to write, edit, and execute code together in real-time.
- Real-time Collaboration: Multiple users can edit code simultaneously with live updates
- Code Execution: Execute code in multiple programming languages
- User Authentication: Secure login/register system with Google OAuth support
- Room Management: Create and join coding rooms with unique URLs
- Syntax Highlighting: Monaco Editor with syntax highlighting for various languages
- Responsive Design: Modern UI built with Tailwind CSS
- WebSocket Communication: Real-time updates using Socket.IO
- React 18 - UI framework
- Monaco Editor - Code editor component
- Socket.IO Client - Real-time communication
- React Router - Client-side routing
- Tailwind CSS - Styling framework
- Axios - HTTP client
- Node.js - Runtime environment
- Express.js - Web framework
- Socket.IO - Real-time bidirectional communication
- MongoDB - Database
- Mongoose - MongoDB ODM
- JWT - Authentication
- Passport.js - OAuth authentication
- bcryptjs - Password hashing
Before running this application, make sure you have the following installed:
- Node.js (v14 or higher)
- npm or yarn
- MongoDB (local or cloud instance)
- Google OAuth credentials (for authentication)
git clone https://github.com/SowmyaKurapati26/codeshare.git
cd codesharecd server
npm installcd ../client
npm installCreate a .env file in the server directory:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secretCreate a .env file in the client directory:
REACT_APP_API_URL=http://localhost:5000
REACT_APP_GOOGLE_CLIENT_ID=your_google_client_idcd server
npm run devcd client
npm startThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
codeshare/
βββ client/ # React frontend
β βββ public/
β β βββ components/ # Reusable components
β β βββ pages/ # Page components
β β βββ utils/ # Utility functions
β β βββ App.js # Main app component
β βββ package.json
βββ server/ # Node.js backend
β βββ models/ # MongoDB models
β βββ routes/ # API routes
β βββ sockets.js # Socket.IO configuration
β βββ index.js # Server entry point
β βββ package.json
βββ README.md
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/google- Google OAuth loginGET /api/auth/me- Get current user infoPOST /api/auth/logout- User logout
POST /api/room/create- Create a new roomGET /api/room/:roomId- Get room detailsDELETE /api/room/:roomId- Delete room
POST /api/execute- Execute code
- Build the frontend:
cd client
npm run build- Deploy to Vercel:
npm install -g vercel
vercel- Deploy to Netlify:
- Connect your GitHub repository
- Set build command:
npm run build - Set publish directory:
build
- Create a
Procfilein the server directory:
web: node index.js
- Deploy to Heroku:
heroku create your-app-name
git push heroku main- Set environment variables in your deployment platform:
MONGO_URIJWT_SECRETGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Monaco Editor for the code editor
- Socket.IO for real-time communication
- Tailwind CSS for styling
For questions, contributions, or collaboration, feel free to reach out:
π§ Email: kurapatisowmya1@gmail.com
Made with β€οΈ by Sowmya Kurapati.