A modern, real-time collaborative code editor that allows multiple users to edit the same file simultaneously with conflict resolution using Operational Transformation (OT).
- Multiple users can join the same room and edit files together
- Real-time synchronization of all changes
- User presence indicators with colored cursors
- Live user list showing who's online
- Implements OT algorithms to handle concurrent edits
- Automatic conflict resolution without data loss
- Version control to maintain document consistency
- Handles insertions, deletions, and cursor movements
- JavaScript (.js, .jsx) - Full syntax highlighting and IntelliSense
- TypeScript (.ts, .tsx) - Full syntax highlighting and IntelliSense
- Python (.py) - Full syntax highlighting and IntelliSense
- C/C++ (.c, .cpp, .cc, .cxx) - Full syntax highlighting
- Additional Languages: HTML, CSS, JSON, Markdown, Java, and more
- Backend: Node.js + TypeScript + Express + Socket.io
- Frontend: React + TypeScript + Monaco Editor (VS Code editor)
- Real-time Communication: WebSockets via Socket.io
- Conflict Resolution: Custom Operational Transformation implementation
- Styling: Styled Components
- Code Editor: Monaco Editor (same engine as VS Code)
- Node.js (v16 or higher)
- npm or yarn
-
Install server dependencies:
npm run install:all
-
Start the development server:
npm run dev
This will start:
- Backend server on
http://localhost:3001 - Frontend development server on
http://localhost:3000
- Backend server on
-
Open your browser and navigate to
http://localhost:3000
npm run build
npm start- Join a Room: Enter a room ID, your name, and the file you want to edit
- Start Coding: The editor supports full syntax highlighting for multiple languages
- Collaborate: Invite others to join the same room ID to collaborate in real-time
- See Live Changes: Watch as other users type, with their cursors visible in different colors
- Uses WebSocket connections for instant communication
- Operational Transformation ensures consistency across all clients
- Document versioning prevents conflicts and data loss
- Insert Operations: Handle concurrent text insertions
- Delete Operations: Manage concurrent deletions
- Position Transformation: Adjust cursor positions based on remote changes
- Version Control: Track document versions to maintain consistency
- Create new files with proper syntax highlighting
- Persistent file storage on the server
- Support for multiple file types and extensions
| Language | Extensions | Features |
|---|---|---|
| JavaScript | .js, .jsx | Syntax highlighting, IntelliSense, Error detection |
| TypeScript | .ts, .tsx | Syntax highlighting, IntelliSense, Type checking |
| Python | .py | Syntax highlighting, IntelliSense, PEP 8 formatting |
| C/C++ | .c, .cpp, .cc, .cxx | Syntax highlighting, IntelliSense |
| HTML | .html | Syntax highlighting, Tag completion |
| CSS | .css | Syntax highlighting, Property completion |
| JSON | .json | Syntax highlighting, Validation |
| Markdown | .md | Syntax highlighting, Preview support |
GET /api/files- List all filesPOST /api/files- Create a new fileGET /api/files/:fileName- Get file content
join-room- Join a collaboration roomoperation- Send text operation (insert/delete)cursor-position- Update cursor position
document-state- Initial document state and user listoperation- Receive text operation from other userscursor-update- Receive cursor position updatesuser-joined/user-left- User presence updates
├── src/server/ # Backend TypeScript code
│ ├── index.ts # Main server file
│ ├── OperationalTransform.ts # OT implementation
│ └── DocumentManager.ts # File management
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── types/ # TypeScript type definitions
│ │ └── App.tsx # Main React component
│ └── public/ # Static assets
└── documents/ # Stored files (created automatically)
- CodeEditor: Monaco-based editor with real-time collaboration
- Sidebar: File browser and creation interface
- UserList: Shows online users and their status
- JoinRoomModal: Room joining interface
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details
- Voice/Video chat integration
- Code execution and debugging
- Git integration
- Plugin system for additional languages
- Mobile responsive design
- User authentication and permissions
- Room persistence and history
- Advanced OT algorithms (e.g., ShareJS integration)