Skip to content

Latest commit

Β 

History

History
151 lines (117 loc) Β· 4.52 KB

File metadata and controls

151 lines (117 loc) Β· 4.52 KB

πŸ‘¨β€πŸ’» CodeSphere – Real-Time Collaborative Code Editor

πŸš€ A powerful and modern online code editor that supports both solo and collaborative coding experiences – built with the Monaco Editor, featuring real-time cursor sync, chat, and future-ready video call integration.


✨ Features

  • πŸ› οΈ Custom Rooms

    • Solo Mode – Create a personal coding space to write and execute code privately.
    • Collaborative Mode – Invite others to your room and code together in real-time.
  • πŸ” Secure User Authentication

    • JWT Authentication with Access & Refresh Tokens for secure login sessions.
    • Automatic token refresh without forcing users to log in repeatedly.
  • 🧠 Built with:

    • JavaScript, Vite, Tailwind CSS
    • Docker, Monaco Editor
  • πŸ’¬ Integrated Chat

    • Communicate with your collaborators directly inside the room using WebSocket-based chat.
  • πŸ–±οΈ Monaco Editor

    • Live cursor synchronization for multiple users.
    • IntelliSense, syntax highlighting, and theming powered by Monaco.
  • οΏ½ Isolated Code Execution

    • Uses a dedicated Code Executor microservice with Docker to safely execute user code in a sandboxed environment.
    • Supports Python, JavaScript, Java, and C++.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Frontend   β”‚ ───► β”‚   Backend   β”‚ ───► β”‚  Code Executor   β”‚
β”‚  (Render)   β”‚      β”‚  (Render)   β”‚      β”‚  (Render/Docker) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚  MongoDB  β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Service Description
Frontend React + Vite app with Monaco Editor
Backend Node.js/Express API with WebSocket support
Code Executor Isolated Docker service for running user code

πŸ”­ Future Plans

  • πŸŽ₯ Webcam Video Calling – Built-in video call for pair programming.
  • πŸ“ Multi-file Support – Upload folders and edit multiple files.
  • πŸ“Š AI Code Assistant – AI-powered code completion and debugging.

πŸ§ͺ Tech Stack

Layer Technology
Frontend JavaScript, Vite, Tailwind CSS
Editor Monaco Editor
Chat & Sync WebSockets
Backend Node.js, Express
Execution Docker (Code Executor Service)
Database MongoDB
Hosting Render (All Services)

πŸš€ Deployment Guide

Project Structure

CodeSphere/
β”œβ”€β”€ frontend/         β†’ Render Web Service (Static Site)
β”œβ”€β”€ backend/          β†’ Render Web Service (Node.js)
└── code-executor/    β†’ Render Web Service (Docker)

Step 1: Deploy Code Executor

  1. Create a new Web Service on Render
  2. Set Root Directory to code-executor
  3. Set Environment to Docker
  4. Deploy and copy the service URL

Step 2: Deploy Backend

  1. Create a new Web Service on Render
  2. Set Root Directory to backend
  3. Add environment variables:
    MONGO_URI=your_mongodb_connection_string
    CODE_EXECUTOR_URL=https://your-code-executor.onrender.com
    JWT_SECRET=your_jwt_secret
    
  4. Deploy

Step 3: Deploy Frontend

  1. Create a new Static Site on Render
  2. Set Root Directory to frontend
  3. Add environment variable:
    VITE_BACKEND_URL=https://your-backend.onrender.com
    
  4. Deploy

πŸ§‘β€πŸ’» Local Development

# Clone the repository
git clone https://github.com/Sahilagarwal623/CodeSphere.git
cd CodeSphere

# Terminal 1: Start Code Executor
cd code-executor
npm install
npm start

# Terminal 2: Start Backend
cd backend
npm install
npm start

# Terminal 3: Start Frontend
cd frontend
npm install
npm run dev

Environment Variables

Backend (.env)

MONGO_URI=mongodb://localhost:27017/codesphere
CODE_EXECUTOR_URL=http://localhost:3001
JWT_SECRET=your_secret

Frontend (.env)

VITE_BACKEND_URL=http://localhost:5000