Skip to content
vivekcode12345Public

About

Real-time collaborative code editor with Yjs CRDT sync, live cursors, sandboxed execution, session replay and interview mode.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

43 Commits

Folders and files

Repository files navigation

PairPad

Real-time collaborative coding, technical interviews, and session replay — in one browser workspace.

PairPad is a full-stack collaboration platform where developers can edit code together, run programs safely, conduct structured interviews, talk over WebRTC video, and replay the session afterward.

It is designed to feel like a practical engineering product rather than a demo: realtime state synchronization, role-aware workflows, bounded resources, reconnect handling, responsive layouts, and graceful failure states are all part of the implementation.

View source on GitHub →

React Node.js Socket.IO Yjs WebRTC Vite

Portfolio note: PairPad demonstrates frontend product thinking, realtime systems design, WebRTC signaling, security-conscious API boundaries, responsive UX, and end-to-end feature ownership.


Why recruiters should care

PairPad brings together several engineering problems that are usually shown in separate projects:

  • Realtime collaboration: concurrent editor changes and presence state synchronize through Yjs and Socket.IO.
  • Product workflow depth: normal rooms, interviewer/candidate roles, timers, submissions, reports, and replay are connected end to end.
  • Browser media engineering: peer-to-peer audio/video includes device selection, track replacement, mute/camera state, reconnect recovery, ICE configuration, diagnostics, and mobile controls.
  • Safe execution boundaries: user programs are sent to Wandbox rather than executed directly inside the application server.
  • Reliability work: malformed payload validation, rate limiting, bounded recordings, timeout handling, retry states, stale-request protection, and graceful offline/error UI.
  • Responsive interaction design: the room, interview, replay, navbar, drawers, tabs, bottom sheets, safe areas, and touch targets are designed for narrow screens as well as desktop.

Product tour

Experience What users can do
Collaborative room Join by room ID, edit together in Monaco, see live users/cursors, change language, run code, and share replay links.
Interview mode Create a private interview, invite a candidate, configure a problem and duration, collaborate in a shared editor, run samples, submit solutions, and review the report.
Video calling Join an optional call from a normal room or interview, toggle mic/camera, select devices, view connection status, recover from reconnects, and use STUN/TURN configuration.
Session replay Reconstruct code changes, joins, leaves, language changes, runs, and interview marks with timeline controls, speed changes, event navigation, and output history.
Responsive workspace Use mobile tabs, drawers, bottom sheets, safe-area spacing, touch-friendly controls, and landscape layouts without changing collaboration behavior.

Technical highlights

Realtime collaboration

  • Monaco Editor with Yjs CRDT synchronization through y-monaco.
  • Awareness state for collaborators, cursors, selections, and presence.
  • Socket.IO rooms for low-latency room and interview events.
  • Shared frontend socket lifecycle with reconnect handling.
  • Query-driven navigation for room, interview, replay, and home experiences.

Structured technical interviews

  • Separate interviewer and candidate flows.
  • Private interviewer/candidate keys and role-aware server authorization.
  • Problem selection, allowed durations, countdown state, submission limits, cooldowns, and judging.
  • Candidate confidentiality: hidden test inputs and expected outputs stay server-side.
  • Interviewer report with submissions, verdicts, final code, replay access, JSON download, and print support.
  • Interview video dock that stays mounted across lobby, running, mobile tab changes, and ended/report states.

WebRTC calling

  • Peer-to-peer mesh calling with Socket.IO signaling.
  • Camera and microphone permission flow initiated by an explicit user gesture.
  • Mic/camera toggles, mute indicators, device enumeration, device persistence, and track replacement.
  • Remote audio autoplay recovery and user unlock action.
  • ICE server loading with STUN fallback and optional static or time-limited TURN credentials.
  • Connection quality diagnostics, reconnect/ICE restart handling, mic-level meter, and track-ended recovery.
  • Responsive call UI for normal rooms and interviews, including mobile drawers/sheets and desktop dock behavior.

Replay and reliability

  • Bounded replay event counts and recording bytes.
  • Retention and finished-recording limits.
  • Separate replay/report rate limiting with Retry-After responses.
  • Input validation for room IDs, replay IDs, signaling payloads, and oversized data.
  • Explicit handling for invalid IDs, missing recordings, rate limits, offline requests, timeouts, and server errors.
  • Replay intentionally records coding/session events, not video media streams.

Architecture

flowchart LR
  Browser[React browser client]
  Router[Query-based app router]
  Room[Collaborative room]
  Interview[Interview workspace]
  Replay[Replay viewer]
  Socket[Socket.IO]
  Server[Node.js + Express + Socket.IO]
  Yjs[Yjs document + awareness]
  Memory[(Bounded in-memory rooms)]
  API[Replay / report / ICE API]
  Sandbox[Wandbox execution service]
  Media[WebRTC media peers]

  Browser --> Router
  Router --> Room
  Router --> Interview
  Router --> Replay
  Room <--> Socket
  Interview <--> Socket
  Socket <--> Server
  Server <--> Memory
  Server <--> Yjs
  Room <--> Media
  Interview <--> Media
  Replay --> API
  Interview --> API
  API --> Server
  Server --> Sandbox
Loading

Repository structure

Collaborate-code/
├── Backend/
│   ├── index.js                 Socket.IO events and server lifecycle
│   ├── config/constants.js      Limits, timeouts, and feature constants
│   ├── routes/api.js            Replay, report, and ICE endpoints
│   ├── services/wandbox.js      External code execution and judging
│   ├── utils/validation.js      Validation and timing-safe helpers
│   └── problems.js              Interview problem definitions
├── Frontend/
│   ├── src/App.jsx              Query-based screen routing
│   ├── src/Home.jsx             Landing page and entry workflows
│   ├── src/Room.jsx             Collaborative room lifecycle
│   ├── src/Interview.jsx        Interview lifecycle and editor
│   ├── src/Replay.jsx           Replay timeline and viewer
│   ├── src/components/          Reusable UI, video, navbar, and dock components
│   ├── src/hooks/useCall.js     Shared WebRTC call engine
│   ├── src/yjsProvider.js       Yjs document/socket integration
│   └── src/styles/              Design system and responsive layouts
├── package.json                 Backend scripts and dependencies
└── README.md

Stack

Layer Technologies
UI React 19, CSS custom properties, responsive CSS
Editor Monaco Editor, @monaco-editor/react
Realtime state Yjs, y-monaco, y-protocols, Socket.IO
Calling WebRTC, STUN/TURN, Socket.IO signaling
Backend Node.js, Express 5, Socket.IO
Execution Axios + Wandbox API
Tooling Vite, ESLint, npm

Run locally

Requirements

  • Node.js 20+
  • npm
  • Network access for Wandbox execution/judging

Install

git clone https://github.com/vivekcode12345/collaborate-code.git
cd collaborate-code
npm install
cd Frontend
npm install
cd ..

Start development servers

Terminal 1 — backend:

npm start

Terminal 2 — frontend:

cd Frontend
npm run dev

Open http://localhost:5173.

Vite proxies /socket.io and /api to http://localhost:5000 during local development.

Useful scripts

# Repository root
npm start
npm run dev
npm run build

# Frontend
cd Frontend
npm run dev
npm run lint
npm run build
npm run preview

Environment configuration

Copy the frontend example file when needed:

cp Frontend/.env.example Frontend/.env

Frontend

Variable Purpose
VITE_SOCKET_URL Backend URL when the frontend is hosted separately; leave empty for local Vite proxying.
VITE_GITHUB_URL Optional GitHub URL displayed in the Home footer/navbar.

Backend

Variable Purpose
PORT Server port; defaults to 5000.
ALLOWED_ORIGIN Socket.IO CORS origin; defaults to * for local development.
TURN_URLS Comma-separated turn:/turns: server URLs.
TURN_SECRET Enables short-lived HMAC-SHA1 TURN credentials.
TURN_USERNAME / TURN_CREDENTIAL Static TURN credentials when TURN_SECRET is not used.
REPLAY_MAX_EVENTS Maximum retained replay events.
REPLAY_RATE_MAX / REPLAY_RATE_WINDOW_MS Replay/report API rate-limit settings.
INTERVIEW_MAX_SUBMISSIONS Submission cap per interview.

Main routes and APIs

Browser routes

/?room=<room-id>&name=<display-name>
/?interview=<room-id>
/?replay=<room-id>

HTTP endpoints

Method Endpoint Purpose
GET /api/replay/:roomId Fetch a finished room recording.
GET /api/interview/:roomId/report Fetch a finished interview report.
GET /api/ice-config Return STUN/TURN configuration for WebRTC.

Realtime room, interview, and video operations use Socket.IO.

Engineering safeguards

  • Server-side payload validation and bounded update sizes.
  • Replay event, byte, retention, and finished-recording limits.
  • Separate rate limiters for replay/report and ICE configuration requests.
  • Per-socket video signaling rate limits.
  • Interview submission caps, cooldowns, and judge timeouts.
  • Timing-safe comparison for protected interviewer/candidate keys.
  • Hidden interview tests never sent to the candidate.
  • Explicit error states instead of silent success fallbacks.
  • In-memory state is bounded and intentionally cleared when the backend restarts.

Validation

The current frontend validation commands are:

cd Frontend
npm run lint
npm run build

Browser smoke validation has covered:

  • Two-party interview audio/video with fake camera and microphone streams.
  • Remote video frame progression and inbound audio bytes/energy.
  • Interview lobby-to-running call persistence.
  • Mobile portrait/landscape geometry and zero horizontal overflow.
  • Candidate DOM confidentiality checks.
  • Browser page-error and console-error scans.
  • Normal-room call regression checks.

Real devices, echo cancellation in a physical environment, Safari/Firefox behavior, Bluetooth headsets, mobile software keyboards, and TURN relay traversal require manual or environment-specific validation.

Product decisions worth discussing

  • Why Yjs? CRDT-based updates make simultaneous editing mergeable without a central per-keystroke conflict resolver.
  • Why WebRTC mesh? It keeps media peer-to-peer and avoids a media server for the small interview-room use case.
  • Why Wandbox? It provides a sandboxed execution boundary instead of running untrusted code directly on the application host.
  • Why in-memory state? The project prioritizes a focused, deployable prototype architecture with explicit bounds; durable persistence can be added as a next step.

Roadmap

  • Add persistent storage for rooms, recordings, reports, and interview metadata.
  • Add automated CI coverage for Socket.IO workflows and API limits.
  • Add a media-server option for larger calls beyond mesh-friendly group sizes.
  • Add authenticated accounts and project/session history.
  • Add deployment presets with production CORS, secrets, logging, and observability.

About the project

PairPad was built to explore the intersection of collaborative editing, realtime systems, browser media, developer tooling, and product-quality UX.

If you are reviewing this project, the best walkthrough is:

  1. Open two browser contexts and join the same room.
  2. Edit the Monaco document from both sides.
  3. Join the video call and test mute/camera/device controls.
  4. Create an interview and open the candidate link separately.
  5. Run a sample, submit a solution, and inspect the report.
  6. Open the replay and scrub through the recorded coding session.

Built for thoughtful technical conversations.

About

Real-time collaborative code editor with Yjs CRDT sync, live cursors, sandboxed execution, session replay and interview mode.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages