A collaborative, real-time code-pairing platform with a Monaco-based editor, ShareDB-powered Operational Transformation (OT) synchronization, server-side code execution for selected languages, and an integrated draggable/resizable WebRTC video preview. Designed for pair programming, interviews, and teaching.
Live demo: code-crew-nu.vercel.app
CodeCrew enables multiple users to edit code in the same Monaco editor instance in real time, see peer cursors and selections, run code against custom test input on the server, and communicate via a floating WebRTC video call. Sessions are private — only users with the session URL can join.
- Collaborative Monaco editor with cursor presence and remote highlights
- Per-session input/output panels (live-synced)
- Server-side "Run Code" that compiles/executes and returns output
- Floating draggable & resizable video component (touch-friendly)
- Invite link for private sessions
- Responsive UI with mobile bottom-sheet behaviour for side panels
Frontend
- React (functional components + hooks)
- Monaco Editor (
react-monaco-editor) - Ant Design (
antd) UI react-draggable,re-resizable- CSS Modules
Backend
- Node.js + Express
- ShareDB (Operational Transformation backend)
- WebSocket (
ws) +@teamwork/websocket-json-streamfor ShareDB - Child process execution (
child_process.exec) for code runner - Simple video signaling via WebSocket
Dev / Infra
- Dockerfile included for backend environment
- Optional STUN/TURN for reliable WebRTC NAT traversal
- Uses ShareDB +
json0to represent and apply small insert/remove ops instead of full-document diffs. - A text-binding layer (adapted
text-diff-binding/StringBinding) converts Monaco editor changes →json0operations and applies remote ops back into Monaco while transforming cursor positions. - Presence (peer cursors/selections) is implemented via Monaco decorations and updated after operations to preserve correctness.
- Peer-to-peer media via WebRTC APIs:
- Create
RTCPeerConnection. - Acquire local media:
navigator.mediaDevices.getUserMedia(). - Offer/answer SDP exchange over a signaling WebSocket.
- Exchange ICE candidates over signaling.
- Create
- UI offers a draggable/resizable floating preview. On mobile, the preview defaults to a smaller anchored thumbnail and can be maximized.
- Flow:
- Frontend posts
{ code, input, lang, id }to/code/run. - Server writes ephemeral files (e.g.
Main.cpp,input.txt) into./<id>/. - Executes language-specific command (g++, javac/java, python3).
- Returns
stdoutorstderrto client, then deletes the ephemeral directory.
- Frontend posts
- Important: The provided runner is a demonstration. Running untrusted code requires strict sandboxing (see Security).
- C++ (
g++) - Java (
javac+java) - Python 3 (
python3)
- Node.js (v16+ recommended)
- npm
- For compiling languages locally (C++/Java):
build-essential,default-jre,default-jdk - (Optional) Docker for containerized backend
# from repository root
cd editor
npm install
npm start
# default: http://localhost:3000cd editor-backend npm install npm run dev
REACT_APP_API_URL=http://localhost:8080
REACT_APP_SIGNALING_WS=ws://localhost:8080/foo