A production-quality collaborative code editor that enables multiple users to write, edit, and execute code together in real-time.
Live Demo | Documentation | Deployment Guide
- Multi-user editing - Multiple users can code together simultaneously
- Live synchronization - See changes as they happen (< 100ms latency)
- User presence - See who's online with color-coded indicators
- Room-based sessions - Private collaboration spaces with unique IDs
- VS Code-powered - Built on Monaco Editor (same as VS Code)
- 9+ Languages - JavaScript, TypeScript, Python, Java, C++, Go, Rust, HTML, CSS
- Syntax highlighting - Full language support with IntelliSense
- Theme toggle - Light and dark modes with persistent preferences
- Run JavaScript & Python - Execute code directly in the browser
- Real-time output sync - See execution results across all users
- Resizable console - Drag-to-resize output panel
- Error handling - Clear error messages and execution feedback
- Auto-save - Automatically saves every 10 seconds
- Version history - Track all changes with timestamps
- One-click restore - Revert to any previous version
- PostgreSQL storage - Reliable database persistence
- Beautiful design - Gradient backgrounds, smooth animations
- Responsive layout - Works on desktop and tablet
- Toast notifications - Real-time feedback for all actions
- Accessibility - ARIA labels, keyboard shortcuts, screen reader support
- Rate limiting - Prevent API abuse (100 req/15min)
- Input validation - Zod schemas for all endpoints
- Helmet.js - Security headers configured
- Redis caching - Fast document retrieval
- Gzip compression - Optimized data transfer
- React 18 - UI library with hooks
- TypeScript - Type-safe JavaScript
- Vite - Lightning-fast build tool
- Monaco Editor - VS Code's editor component
- Socket.io Client - Real-time communication
- Tailwind CSS - Utility-first styling
- React Hot Toast - Beautiful notifications
- Node.js - Runtime environment
- Express - Web framework
- Socket.io - WebSocket server
- TypeScript - Type safety
- Prisma - Type-safe ORM
- PostgreSQL - Relational database
- Redis - Caching layer
- Winston - Logging
- Zod - Schema validation
- Helmet - Security middleware
- Docker - Containerization
- Railway - Backend hosting
- Vercel - Frontend hosting
- GitHub Actions - CI/CD (planned)
Real-time collaborative editing with syntax highlighting
Track and restore previous versions
Run code and see output in real-time
Multiple users editing simultaneously
- Node.js >= 18.0.0
- PostgreSQL 15+
- Redis 7+
- npm or yarn
-
Clone the repository
git clone https://github.com/yourusername/Real_time_colab.git cd Real_time_colab -
Set up the database
# Start Docker containers docker-compose up -d -
Install dependencies
# Install server dependencies cd server npm install # Install client dependencies cd ../client npm install
-
Configure environment variables
# Server (.env) cd server cp .env.example .env # Edit .env with your configuration DATABASE_URL="postgresql://postgres:password@localhost:5432/codeeditor" REDIS_URL="redis://localhost:6379" CORS_ORIGIN="http://localhost:5173"
-
Run database migrations
cd server npx prisma migrate dev npx prisma generate -
Start development servers
# Terminal 1: Start backend cd server npm run dev # Terminal 2: Start frontend cd client npm run dev
-
Open your browser
http://localhost:5173
- Enter a username
- Click "Create Room"
- Share the room ID with collaborators
- Enter your username
- Enter the room ID
- Click "Join Room"
- Select your programming language
- Start typing in the editor
- Changes sync automatically to all users
- Write JavaScript or Python code
- Click the "Run" button
- View output in the console below
- Documents auto-save every 10 seconds
- Or press
Cmd+S/Ctrl+Sto save manually - Changes persist across sessions
- Click "Version History" in the sidebar
- Browse previous versions with timestamps
- Preview any version
- Click "Restore" to revert
βββββββββββββββ βββββββββββββββ
β Vercel β β Railway β
β (Frontend) ββββββββββΆβ (Backend) β
βββββββββββββββ βββββββββββββββ
β
ββββββββββββ΄βββββββββββ
β β
ββββββΌβββββ ββββββΌβββββ
β PostgreSQL β β Redis β
β (Documents) β β (Cache)β
βββββββββββββββ βββββββββββ
1. User Joins Room:
Client β Socket.io β Server β Database β Cache β Broadcast to Room
2. Code Changes:
User types β Debounce (300ms) β Socket β Server β Broadcast β Other Users
3. Document Save:
Auto-save (10s) β REST API β Database β Redis Cache β Version Created
-- Documents table
Document {
id String @id @uuid
title String
content Text
language String
roomId String @unique
createdAt DateTime
updatedAt DateTime
versions DocumentVersion[]
}
-- Version history
DocumentVersion {
id String @id @uuid
documentId String
content Text
versionNumber Int
createdAt DateTime
}NODE_ENV=development
PORT=3001
DATABASE_URL=postgresql://user:pass@localhost:5432/db
REDIS_URL=redis://localhost:6379
CORS_ORIGIN=http://localhost:5173
LOG_LEVEL=infoVITE_API_URL=http://localhost:3001
VITE_SOCKET_URL=http://localhost:3001See DEPLOYMENT.md for detailed deployment instructions.
Backend (Railway):
- Connect GitHub repository
- Add PostgreSQL and Redis databases
- Configure environment variables
- Deploy automatically
Frontend (Vercel):
- Connect GitHub repository
- Set build configuration
- Add environment variables
- Deploy with one click
- Create and join rooms
- Multi-user real-time sync
- Code execution (JS & Python)
- Document auto-save
- Version history and restore
- Reconnection after disconnect
- Theme switching
- Language switching
# Test with multiple concurrent users
# Open 5+ browser tabs and test real-time syncContributions are welcome! Please follow these steps:
- Fork the repository
- Create a 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
- Use TypeScript strict mode
- Follow ESLint configuration
- Add comments for complex logic
- Write meaningful commit messages
Real_time_colab/
βββ client/ # React frontend
β βββ src/
β β βββ components/ # React components
β β βββ hooks/ # Custom hooks
β β βββ services/ # API services
β β βββ App.tsx # Main app component
β βββ package.json
β βββ vite.config.ts
β
βββ server/ # Node.js backend
β βββ src/
β β βββ config/ # Configuration files
β β βββ routes/ # API routes
β β βββ services/ # Business logic
β β βββ models/ # Database models
β β βββ index.ts # Server entry point
β βββ prisma/ # Database schema
β βββ package.json
β βββ tsconfig.json
β
βββ docker-compose.yml # Docker configuration
βββ DEPLOYMENT.md # Deployment guide
βββ README.md # This file
- Code Execution: Only JavaScript and Python are supported
- File Size: Document content limited to 1MB
- Concurrent Users: Optimized for 2-10 users per room
- Cursor Tracking: Remote cursor positions not yet implemented
- Offline Mode: Requires active internet connection
- Remote cursor tracking
- Chat functionality
- File upload/download
- Collaborative whiteboard
- Admin dashboard
- User authentication
- Private rooms with passwords
- Mobile app (React Native)
- VSCode extension
This project is licensed under the MIT License - see the LICENSE file for details.
- Monaco Editor - VS Code's amazing editor
- Socket.io - Real-time engine
- Tailwind CSS - Beautiful styling
- Railway & Vercel - Hosting platforms
If you found this project helpful, please give it a β star!
Built with β€οΈ using React, TypeScript, and Socket.io