{"id":23125714,"url":"https://github.com/codehiveofficial/codehive-server","last_synced_at":"2026-02-28T03:37:41.373Z","repository":{"id":262847690,"uuid":"888550307","full_name":"codehiveofficial/codehive-server","owner":"codehiveofficial","description":"The backend of Codehive is built using Node.js and Express, designed to provide a real-time collaborative coding environment. It enables seamless communication (video calling and chat), dynamic room management and code synchronization using Socket.IO.","archived":false,"fork":false,"pushed_at":"2024-11-30T14:09:19.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-31T07:21:27.371Z","etag":null,"topics":["axios","chat-application","express-js","node-cron","socket-io","uuid","video-calling"],"latest_commit_sha":null,"homepage":"https://codehive-server.onrender.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codehiveofficial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-14T15:37:05.000Z","updated_at":"2024-11-30T14:09:22.000Z","dependencies_parsed_at":"2024-11-15T00:46:27.649Z","dependency_job_id":"ce15b586-0209-45b9-88a4-8c74e9cdf3d8","html_url":"https://github.com/codehiveofficial/codehive-server","commit_stats":null,"previous_names":["codehiveofficial/codehive-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codehiveofficial","download_url":"https://codeload.github.com/codehiveofficial/codehive-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252826514,"owners_count":21810122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axios","chat-application","express-js","node-cron","socket-io","uuid","video-calling"],"created_at":"2024-12-17T08:14:43.667Z","updated_at":"2026-02-28T03:37:36.341Z","avatar_url":"https://github.com/codehiveofficial.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backend for Codehive 🚀  \n\n## Introduction 🌟  \nThe backend of Codehive is built using **Node.js** and **Express**, designed to provide a real-time collaborative coding environment. It enables seamless communication (video calling and chat), dynamic room management and code synchronization using **Socket.IO**. Additionally, the backend ensures robust functionality with periodic health checks and task scheduling.\n\n\n## Features ✨  \n\n1. **Real-Time Collaboration**  \n   - Synchronize code changes across all users in a room in real time.  \n   - Broadcast cursor positions to enhance teamwork and visibility.  \n\n2. **Room Management**  \n   - Create unique rooms using **UUID** for collaborative sessions.  \n   - Manage participants, including handling joins, leaves and disconnections.  \n\n3. **Integrated Communication**  \n   - Supports video and audio toggling, ensuring a smooth virtual coding experience.  \n\n4. **Health Monitoring**  \n   - Periodic server health checks via a dummy route using **Node-Cron**.  \n\n5. **Scalable Architecture**  \n   - Seamless integration with frontend through environment variables for flexible deployments.  \n\n\n## Backend Specifics 🔧  \n\n### Tech Stack  \n\n- **Core Frameworks and Libraries**:  \n  - [Express](https://expressjs.com/): Lightweight web framework for server-side operations.  \n  - [Socket.IO](https://socket.io/): Enables real-time, bidirectional communication.  \n  - [Node-Cron](https://www.npmjs.com/package/node-cron): Schedules periodic tasks like health checks.  \n  - [Axios](https://axios-http.com/): Simplifies HTTP requests for external APIs.  \n  - [UUID](https://www.npmjs.com/package/uuid): Generates unique identifiers for rooms.  \n\n- **Utilities**:  \n  - **CORS**: Ensures secure communication between the frontend and backend.  \n  - **dotenv**: Manages environment variables for flexible configuration.  \n\n### Key Functionalities  \n\n1. **Socket.IO Events**  \n   - `chat_message`: Facilitates real-time messaging among users.  \n   - `create_room`: Dynamically creates rooms with a unique ID.  \n   - `join_room`: Allows users to join existing rooms and synchronizes room data.  \n   - `code_change`: Updates code across participants in real time.  \n   - `toggle_video` and `toggle_audio`: Handles user media preferences.  \n   - `disconnect`: Cleans up rooms and user data upon disconnection.  \n\n2. **API Endpoints**  \n   - `GET /`: Verifies server availability with a basic response.  \n   - `GET /keep-alive`: Keeps the server active by simulating requests.  \n\n3. **Cron Jobs**  \n   - Executes a scheduled health check every 8 minutes to ensure server reliability.  \n\n\n## Installation and Getting Started 🛠️  \n\nFollow the steps below to set up and run the backend server for Codehive:  \n\n### Prerequisites  \n\n- Node.js (v16+ recommended)  \n- npm or yarn  \n- A `.env` file with the following environment variables:\n\n  ```env  \n  FRONTEND_URL=\u003cFrontend_URL\u003e  \n  BACKEND_URL=\u003cBackend_URL\u003e\n  ```  \n\n### Steps  \n\n1. **Clone the Repository**  \n   ```bash  \n   git clone https://github.com/codehiveofficial/codehive-server.git\n   cd codehive-server\n   ```  \n\n2. **Install Dependencies**  \n   ```bash  \n   # Using npm  \n   npm install  \n\n   # Or using yarn  \n   yarn install  \n   ```  \n\n3. **Set Up Environment Variables**  \n   Create a `.env` file in the root directory and add the required environment variables as shown above.  \n\n4. **Run the Development Server**  \n   ```bash  \n   node server.js\n   ```  \n   The server will run at the specified `PORT` (default: 5000). You can check its status by visiting `http://localhost:5000`.  \n\n5. **Verify the Setup**  \n   Access the `/` endpoint in your browser or via Postman to confirm the server is up and running.  \n\n## Server is ready 🤟\nBy completing these steps, your backend will be fully operational and ready to support the Codehive platform. 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodehiveofficial%2Fcodehive-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodehiveofficial%2Fcodehive-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodehiveofficial%2Fcodehive-server/lists"}