Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev Hive - Interview in real-time, code in sync

DevHive is a live collaborative code editor with built-in video calling. Run mock interviews, pair-program with your team, or grind DSA with friends — all face-to-face in one room.

Live Demo:

Learnify Architecture

Learnify Architecture


Features

  • Real-Time Code Collaboration — Monaco Editor synced live across all room participants via WebSocket
  • Video & Audio Calling — LiveKit-powered WebRTC integration directly inside coding rooms
  • WebSocket Messaging — STOMP over SockJS for bi-directional client-server communication
  • Redis Write-Through Cache — live code/language updates hit Redis first, avoiding DB writes on every keystroke
  • Scheduled DB Sync — background cron job (every 30s) persists cached Redis code back to the database
  • Redis Pub/Sub Broadcasting — decouples publisher/subscriber for horizontally scalable, multi-instance WebSocket delivery
  • Collision-Safe Room IDs — auto-generated unique room IDs with retry logic on conflict
  • Concurrency-Safe Joins — pessimistic locking prevents race conditions when multiple users join simultaneously
  • Reconnect Handling — rejoining users get re-synced state (USER_REJOIN) instead of duplicate participant entries
  • Live Room Events — real-time broadcasts for user joined, left, rejoined, and room closed
  • JWT Authentication — short-lived access tokens + long-lived refresh tokens (6 months) in HTTP-only cookies
  • Role-Based LiveKit Tokens — per-user JWT tokens with admin grants for room owners
  • Automatic Call Lifecycle Management — LiveKit room auto-created on call start, cleaned up on room end, participants auto-removed on leave
  • Cache-Aside Fallback — graceful handling and logging of Redis cache misses with DB fallback
  • Global Exception Handling — custom exceptions (ResourceNotFoundException, RoomNotAvailableException, AccessDeniedException) for consistent error responses
  • Modular Service Architecture — clean separation across Room, User, LiveKit, and Redis services

Tech Stack

Layer Technology
Frontend React, Vite, TailwindCSS
Code Editor Monaco Editor (@monaco-editor/react)
WebSocket Client SockJS + STOMP.js (@stomp/stompjs)
Video Calling WebRTC (SFU topology) via LiveKit
Backend Spring Boot
Real-time WebSocket + STOMP
Cache / Pub-Sub Redis
Database PostgreSQL (Spring Data JPA)
Auth JWT + Refresh Token (HttpOnly Cookie)

Architecture


API Reference

Auth — /auth

Method Endpoint Description
POST /auth/signup Register a new user
POST /auth/login Login; sets HttpOnly refresh token cookie
POST /auth/refresh Rotate access + refresh token
POST /auth/logout Revoke token + clear cookie

Rooms — /rooms

Method Endpoint Description
POST /rooms Create a room (caller becomes OWNER)
POST /rooms/{roomId}/join Join as EDITOR
GET /rooms/{roomId} Get room info (live code from Redis if available)
DELETE /rooms/{roomId}/end Owner ends room; final Redis → DB sync
DELETE /rooms/{roomId}/leave Participant leaves room

WebSocket

Direction Destination Description
Client → Server /app/code-update/{roomId} Send a code change; cached in Redis (ROOM_CODE_KEY, TTL via ROOM_TTL_HOURS) and republished
Client → Server /app/lang-update/{roomId} Change the room's active language; persisted via RoomService.langUpdate and republished
Server → Client /topic/room/{roomId} Receive code updates, language updates, join/leave events, video call events, room-end signal

LiveKit — /livekit

Method Endpoint Description
POST /livekit/token/{roomId} Validates membership and returns a LiveKit access token for the caller to join the room's video call
POST /livekit/start/{roomId} Validates membership, creates the LiveKit room, returns the initiator's token, and broadcasts a VC_STARTED event to /topic/room/{roomId}

Running Locally


About

DevHive is a live collaborative code editor with built-in video calling — run mock interviews, pair-program with your team, or grind DSA with friends, all face-to-face in one room.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages