Skip to content

Repository files navigation

WeCode

Real-Time Collaborative Code Editor for Multi-User Pair Programming


Project Overview

WeCode is a web-based real-time collaborative code editor that enables multiple users to join a shared room and edit code together simultaneously.

The goal of this project is to remove friction from collaborative coding by allowing users to start working together instantly without any sign-up process or complex setup. A simple room ID is enough to begin collaboration.

Why this project exists

Most collaborative coding tools are either too heavy or require unnecessary onboarding steps such as authentication or account creation. WeCode focuses on simplicity, speed, and real-time interaction.

Problem it solves

  • Slow and complex onboarding in existing pair programming tools
  • Lack of lightweight tools for instant code sharing
  • Difficulty in conducting quick debugging or teaching sessions remotely

Key Features

  • Real-time collaborative code editing with multiple users
  • Room-based sessions using unique room IDs
  • Live user presence tracking inside each room
  • Join and leave notifications for participants
  • Copy room ID for easy sharing
  • Support for multiple programming languages and themes
  • Persistent editor preferences using local storage
  • File upload with preview and ability to append or replace content
  • Instant synchronization of code using WebSockets
  • Simple routing for room-based navigation
  • Docker support for containerized deployment

Architecture Summary

WeCode follows a simple two-layer architecture consisting of a frontend client and a backend server.

Frontend (Client)

The frontend is built using React and CodeMirror. It handles:

  • Code editor interface
  • Room creation and joining flow
  • File upload and preview functionality
  • Theme and language selection
  • WebSocket communication with the server

Backend (Server)

The backend is built using Node.js, Express, and Socket.IO. It is responsible for:

  • Managing WebSocket connections
  • Creating and handling rooms
  • Broadcasting code updates to connected users
  • Tracking active users in each room (stored in memory)

Data Flow

  1. A user joins or creates a room using a room ID
  2. The client establishes a WebSocket connection with the server
  3. The server assigns the user to a Socket.IO room
  4. Any code changes are broadcast to all users in that room
  5. New users receive the current code state when they join

Note: The application does not use a database. All state is temporary and stored in memory and active connections.


Tech Stack

Frontend

  • React 18
  • React Router
  • Recoil for state management
  • CodeMirror 5 for code editing
  • Socket.IO Client for real-time communication
  • React Hot Toast for notifications

Backend

  • Node.js
  • Express 4
  • Socket.IO 4

Dev Tools and Infrastructure

  • Docker and Docker Compose
  • Jest and React Testing Library
  • PM2 for process management

Day 1 – Project Setup & UI Foundation

  • Initialized React app and backend with Express
  • Set up folder structure (frontend + backend separation)
  • Created basic landing page UI
  • Added routing for Home and Editor pages
  • Installed core dependencies (Socket.IO, CodeMirror, Recoil)

Day 2 – Backend & Socket Setup

  • Created Express server
  • Integrated Socket.IO for real-time communication
  • Designed room-based architecture
  • Implemented user join/leave events
  • Established socket connection between client and server

Day 3 – Real-Time Code Editor

  • Integrated CodeMirror editor
  • Implemented live code synchronization
  • Added emit/listen events for code changes
  • Fixed infinite update loops using controlled state updates
  • Enabled multi-user real-time editing

Day 4 – Room System & User Presence

  • Implemented UUID-based room creation
  • Built join room functionality
  • Added live user list in each room
  • Displayed join/leave notifications
  • Improved socket room management logic

Day 5 – File Handling System

  • Added file upload feature
  • Implemented file preview before importing
  • Enabled append and replace options for file content in the editor
  • Handled large file inputs safely within editor state

Day 6 – Enhancements & UX Improvements

  • Added language switching support for the editor
  • Implemented theme customization (light and dark mode)
  • Integrated Recoil for global state management
  • Stored user preferences using localStorage for persistence
  • Improved UI responsiveness and overall editor behavior

Day 7 – Testing, Debugging & Deployment

  • Fixed socket synchronization bugs
  • Improved connection handling and error states
  • Dockerized the application
  • Tested multi-user collaboration flow
  • Final UI polish and performance improvements

Deployment Link: https://wecode-pushkar.onrender.com/

Releases

Packages

Contributors

Languages