Skip to content

Kanyarasi2026/code-battle-grounds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

62 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

βš”οΈ Code Battlegrounds

React TypeScript Vite Node.js Socket.IO Supabase License Vercel

A real-time collaborative code editor where developers battle it out, practice for interviews, and write code together

Built for HackCU12 by Sneha Nagaraju, Meghasrivardhan Pulakhandam, and Gunabhiram Aruru

🌐 Live Demo β€’ πŸ’» Quick Start β€’ πŸ“š Documentation β€’ πŸš€ Deploy


✨ Try it Live!

🌐 https://code-battle-grounds.vercel.app/

Features You Can Explore

  • βš”οΈ Real-time Collaborative Coding β€” Write code together with live cursor presence via Socket.IO
  • 🏫 Classrooms β€” Faculty create sessions, students join with a room code
  • πŸ“ Assessment Mode β€” Timed coding assessments with integrity tracking
  • 🧠 AI-Powered Hints β€” Gemini-driven tiered hints that nudge, not spoil
  • πŸŽ™οΈ Mock Interviews β€” Voice-based interview practice with ElevenLabs TTS
  • πŸ—£οΈ Voice & Text Chatbot β€” Conversational AI assistant powered by ElevenLabs for natural speech interaction
  • πŸ‹οΈ Algorithm Challenges β€” Curated DSA problem sets (Blind 75, NeetCode, etc.)
  • πŸ” Secure Auth β€” Google OAuth via Supabase
  • πŸ“± Fully Responsive β€” Works seamlessly on desktop, tablet, and mobile
  • πŸͺ„ Antigravity Effects β€” Fluid UI animations powered by the Antigravity library, bringing the interface to life

🎯 Features

Feature Description
πŸ”„ Real-time Collaboration Multiple users edit the same file live β€” code changes sync instantly via Socket.IO
🏫 Classrooms Faculty create rooms, share codes with students β€” everyone sees the same editor in real-time
πŸ“ Assessment Mode Faculty create timed assessments; students take them with transparent integrity tracking
πŸ›‘οΈ Integrity Insights Factual session timeline β€” tab switches, copy/paste events, neutral activity log for faculty review
πŸ’‘ AI Hints Tiered hints via Gemini API + ElevenLabs TTS read-aloud β€” nudges, not answers
πŸ—£οΈ Voice & Text Chatbot Full-featured conversational chatbot with both voice and text input/output β€” powered by ElevenLabs, one of the best speech-to-text and text-to-speech models available
πŸŽ™οΈ Mock Interviews Voice-based interview simulation with AI-powered speech
πŸ‹οΈ Algorithm Challenges Curated problem sets β€” Blind 75, NeetCode 150, topic-based collections
πŸͺ„ Antigravity Effects Smooth, physics-inspired UI animations via Antigravity β€” dramatically improved user experience and visual polish
⚑ Multi-Language Execution Run Python, JavaScript, C++, Java, and C
🎚️ Custom stdin Provide input to your programs before execution
πŸ‘₯ Role-Based Access Separate flows for students vs. faculty, professionals vs. academic users
πŸ“Š Progress Tracking Track solved problems, streaks, and challenge completion
πŸŒ™ Dark Mode Sleek dark grayscale theme with glassmorphism UI

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      User Browser           β”‚
β”‚  (React 19 + TypeScript)    β”‚
β”‚  Monaco Editor Β· GSAP Β· FM  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚ HTTP/REST + WebSocket
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Backend API                   │────▢│   Supabase                  β”‚
β”‚  (Node.js + Express + TS)       │◀────│  PostgreSQL + Auth + OAuth  β”‚
β”‚  - Socket.IO (real-time sync)   β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚  - Room Manager (in-memory)     β”‚
β”‚  - Rate Limiting + Validation   β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                 │────▢│   Judge0 API                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚  (Code Execution Engine)    β”‚
                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                   ────▢│   Gemini API (AI Hints)     β”‚
                                        β”‚   ElevenLabs (Voice TTS)    β”‚
                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

User Flow:

  1. User visits Code Battlegrounds and authenticates with Google OAuth
  2. Selects role β€” Academic (Student/Faculty) or Professional
  3. Chooses a feature β€” Classrooms, Assessments, Challenges, Interviews, Practice Sets
  4. Faculty creates a classroom β†’ shares the room code β†’ students join
  5. Code changes sync in real-time across all connected clients
  6. Execute code against Judge0, get AI hints from Gemini, hear hints read aloud

πŸ“Š Core Pages & Features

Page Route Description
Landing /login Animated landing page with Google OAuth
Role Selection /role Choose Academic or Professional pathway
Academic Features /features/academic Classrooms, Assessments, Integrity (faculty)
Professional Features /features/professional Challenges, Interviews, Pair Programming, Practice Sets
Classrooms /classrooms Faculty creates rooms, students join with code
Code Editor /editor/:roomId Monaco editor with real-time sync, execution, AI hints
Assessment Mode /assess Faculty creates / student takes timed assessments
Algorithm Challenges /practice DSA problems by topic and difficulty
Curated Practice Sets /sets Blind 75, NeetCode 150, and more
Mock Interviews /interview Voice-based interview simulation
Progress Tracking /progress Stats, streaks, solved problems
Integrity Timeline /integrity Session activity log for faculty

πŸ”§ Tech Stack

Category Technology
Frontend React 19, TypeScript, Vite 5, SCSS (BEM)
Editor Monaco Editor (VS Code engine in browser)
Real-time Socket.IO (WebSocket transport)
Animations Framer Motion, GSAP, Antigravity
Auth Supabase (Google OAuth)
Styling SCSS, CSS Variables, Glassmorphism dark theme
State React Context + Hooks
Backend Node.js, Express, TypeScript
Database Supabase (PostgreSQL)
Code Execution Judge0 API
AI Hints Gemini API (gemini-3-flash)
Voice & Text Chatbot ElevenLabs (industry-leading STT + TTS) + Browser SpeechSynthesis fallback
Antigravity Antigravity β€” physics-based animation library for fluid UI interactions
Validation Joi
Rate Limiting rate-limiter-flexible
Logging Winston
Testing Vitest + Testing Library
Deployment Vercel (frontend), Docker (backend)

πŸ“ˆ Performance Metrics

Metric Value
Page Load Time < 2 seconds
First Contentful Paint < 1.2 seconds
Lighthouse Score 90+ (Performance)
WebSocket Latency < 50ms (local)
Code Execution Roundtrip < 3 seconds
Bundle Size ~150KB (gzipped)
Max Clients per Room 50

πŸš€ Getting Started

Prerequisites

1. Clone the repo

git clone https://github.com/Kanyarasi2026/code-battle-grounds.git
cd code-battle-grounds

2. Backend setup

cd backend
npm install

Create a .env file inside backend/:

PORT=3001
CORS_ORIGINS=http://localhost:5173

SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

JUDGE0_URL=your_judge0_base_url

Start the backend:

npm run dev

3. Frontend setup

cd frontend
npm install

Create a .env file inside frontend/:

VITE_SUPABASE_URL=your_supabase_project_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key

VITE_SOCKET_URL=http://localhost:3001

VITE_GEMINI_API_KEY=your_gemini_api_key
VITE_ELEVENLABS_API_KEY=your_elevenlabs_api_key

Start the frontend:

npm run dev

Open http://localhost:5173 in your browser.

4. Supabase setup

In your Supabase project:

  1. Enable Google as an OAuth provider under Authentication > Providers.
  2. Add http://localhost:5173 to your allowed redirect URLs.
  3. Run any database migrations found in backend/migrations/.

πŸ§ͺ Testing

Frontend tests

cd frontend
npm test

For coverage:

npm run test:coverage

Backend tests

cd backend
npm test

For coverage:

npm run test:coverage

πŸ“š Project Structure

code-battle-grounds/
β”œβ”€β”€ frontend/                  React + Vite app
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        Reusable UI (Button, Card, Input, Avatar, etc.)
β”‚   β”‚   β”‚   β”œβ”€β”€ ai/            AI hint components
β”‚   β”‚   β”‚   β”œβ”€β”€ editor/        Monaco editor integration
β”‚   β”‚   β”‚   β”œβ”€β”€ effects/       ParticleField, visual effects
β”‚   β”‚   β”‚   β”œβ”€β”€ integrity/     Integrity tracking components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/        AuthLayout, navigation
β”‚   β”‚   β”‚   β”œβ”€β”€ output/        Code execution output display
β”‚   β”‚   β”‚   └── ui/            Button, Card, Input, Avatar, Kbd
β”‚   β”‚   β”œβ”€β”€ context/           AuthContext, RoomContext, NavigationStack
β”‚   β”‚   β”œβ”€β”€ pages/             Route-level page components
β”‚   β”‚   β”‚   β”œβ”€β”€ classrooms/    Faculty create / student join classrooms
β”‚   β”‚   β”‚   β”œβ”€β”€ assessment/    Student & faculty assessment views
β”‚   β”‚   β”‚   β”œβ”€β”€ challenges/    Algorithm challenge browser & solver
β”‚   β”‚   β”‚   β”œβ”€β”€ code-editor/   Main collaborative editor page
β”‚   β”‚   β”‚   β”œβ”€β”€ curated-practice/  Blind 75, NeetCode, practice sets
β”‚   β”‚   β”‚   β”œβ”€β”€ features/      Mock interview, pair programming, etc.
β”‚   β”‚   β”‚   └── landing/       Landing page with OAuth
β”‚   β”‚   β”œβ”€β”€ sections/          Hero, Features, CTA sections
β”‚   β”‚   β”œβ”€β”€ services/          API service layer
β”‚   β”‚   β”œβ”€β”€ socket/            Socket.IO client + actions
β”‚   β”‚   β”œβ”€β”€ styles/            Global SCSS variables
β”‚   β”‚   └── types/             TypeScript type definitions
β”‚   └── public/                Static assets
β”‚
β”œβ”€β”€ backend/                   Express + Socket.IO server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/       Route handlers
β”‚   β”‚   β”œβ”€β”€ middleware/        Auth, validation, rate limiting, error handling
β”‚   β”‚   β”œβ”€β”€ routes/            REST API routes
β”‚   β”‚   β”œβ”€β”€ services/          Business logic (profiles, etc.)
β”‚   β”‚   β”œβ”€β”€ utils/             RoomManager, Logger, RoleManager
β”‚   β”‚   └── types/             TypeScript type definitions
β”‚   └── migrations/            SQL migration files
β”‚
└── README.md

🌐 Deployment

Currently Deployed on Vercel βœ…

  • 🌐 Live URL: https://code-battle-grounds.vercel.app
  • πŸ”„ Auto-deploys on push to main branch
  • ⚑ Global CDN for optimal performance
  • πŸ“Š Built-in analytics and monitoring

Backend

The backend can be deployed via Docker using the included Dockerfile, or on platforms like Railway, Render, or Fly.io.


πŸ”— API Integration

The frontend communicates with the backend for:

  • Real-time collaboration β€” Socket.IO WebSocket events (code sync, presence)
  • Code execution β€” REST endpoint β†’ Judge0 API
  • Room management β€” Create/join/validate rooms
  • Authentication β€” Supabase OAuth + JWT tokens
  • AI hints β€” Gemini API via frontend (with ElevenLabs TTS or browser fallback)
  • Assessments β€” CRUD operations for faculty assessment management

🀝 Contributing

Contributions are welcome and appreciated! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ‘₯ Authors

Name Links
Sneha Nagaraju Portfolio Β· LinkedIn Β· GitHub
Meghasrivardhan Pulakhandam Portfolio Β· LinkedIn Β· GitHub
Gunabhiram Aruru Portfolio Β· LinkedIn Β· GitHub

Made for HackCU12

⭐ If you find Code Battlegrounds useful, give it a star!

🌐 Try Live Demo

Releases

No releases published

Packages

 
 
 

Contributors