β οΈ Work in Progress β This project is under active development. Three full debate experiences, the entire AI layer, and a complete identity/progression system (profiles, history, leaderboard) are functional and tested. Mobile responsiveness, content moderation, and a public social feed are not yet built, and deployment is intentionally saved for last. Expect frequent changes between sessions.
A real-time debate platform built around three distinct ways to debate: practice solo against an AI opponent and get a coaching report, go free-form against another person with live AI scoring and an AI prep coach, or compete head-to-head in a structured, timed Oxford-style match with an AI moderator and a final AI verdict. Built end-to-end as a learning project to explore full-stack architecture, real-time systems, and applied AI (RAG, memory, and multi-persona AI behavior) without relying on paid APIs.
| Feature | Status |
|---|---|
| User registration & login (JWT + refresh tokens) | β Working |
| MongoDB schemas (User, Debate, Argument, Vote, CompetitiveMatch, MatchMessage, SoloSession) | β Working |
| Redis pub/sub adapter for Socket.io (horizontal scaling ready) | β Working |
| Real-time WebSocket communication | β Working |
/home landing hub + /practice sub-choice page after login |
β Working |
| Feature | Status |
|---|---|
| Pick a topic and a side, AI argues the opposite | β Working |
| 3-minute timed round, live back-and-forth chat with AI opponent | β Working |
| AI generates sharp, on-topic rebuttals each turn | β Working |
| AI-generated strengths & weaknesses coaching report at the end | β Working |
| No prep assistance in this mode (intentional β it's the test, not the practice) | β Working |
| Feature | Status |
|---|---|
| Create/join free-form FOR vs AGAINST debate rooms | β Working |
| Real-time argument submission | β Working |
| Live audience-style vote counting | β Working |
| AI argument quality scoring (0β10) via Groq | β Working |
| Logical fallacy detection | β Working |
| Stance-aware scoring β penalizes well-written arguments posted on the wrong side | β Working |
| AI Debate Prep Chatbot (streaming, RAG + memory powered) | β Working |
| Spectator mode β watch live, vote, without participating | β Working |
| Explicit join-vs-watch choice screen on entering a room | β Working |
| "End Debate" + post-debate stats page (avg scores, most-upvoted, AI summary) | β Working |
| Feature | Status |
|---|---|
| Create/join competitive matches | β Working |
| Structured 3-round format: Opening β Rebuttal β Closing | β Working |
| Live synced countdown timer per round | β Working |
| AI Moderator β announces round transitions automatically in-chat | β Working |
| Chat-style transcript (FOR / AGAINST / Moderator, visually distinct) | β Working |
| AI Judge β reviews the full transcript holistically, delivers winner + scores + reasoning | β Working |
| Spectator mode with live population counter | β Working |
| Match summary screen with full transcript replay | β Working |
| Feature | Status |
|---|---|
User profiles (/profile/[username]) |
β Working |
| Cross-mode stats: Practice avg score, debate count, Competitive W/L/T record | β Working |
| Clickable debate & match history linking back to past rooms | β Working |
| Leaderboard β ranked by avg AI score (Practice) and wins (Competitive) | β Working |
| Feature | Status |
|---|---|
| Mobile responsive UI | π Planned |
| Content moderation + rate limiting | π Planned |
| Public debate feed + follow/comment system | π Planned |
| Solo Practice sessions reflected in profile/leaderboard | π Planned |
| Docker Compose, CI/CD, production deployment | π Planned (intentionally last) |
Frontend
- Next.js 15 (App Router, TypeScript)
- Tailwind CSS
- Socket.io client
Backend
- Node.js + Express.js
- Socket.io with Redis adapter
- MongoDB + Mongoose
- Redis (pub/sub)
- JWT + refresh token authentication
- Groq API (Llama 3.3 70B) β free, fast inference for all AI features
- @xenova/transformers β local embeddings for RAG, no external API calls or cost
DebateSphere deliberately avoids paid AI APIs. All intelligence runs on Groq (free tier, Llama 3.3 70B) combined with a self-built retrieval and memory system. The AI plays five distinct roles across the app:
- Stance-aware scorer β Before grading argument quality, checks whether the argument actually supports the side it was posted under. A well-written argument posted on the wrong side scores 0β2, with the mismatch flagged in the UI.
- Prep coach (RAG + Memory) β A curated local dataset of debate techniques and fallacies is embedded with
@xenova/transformers(runs locally, free) and retrieved via cosine similarity. The coach also reads a user's own past arguments and scores from MongoDB to personalize advice β e.g. warning a user who frequently commits appeal-to-emotion fallacies. - AI opponent (Solo Mode) β Argues the opposite side of whatever topic the user picks, generating direct, punchy rebuttals turn-by-turn within a 3-minute timer.
- AI moderator β In Competitive Mode, announces round transitions in the live chat feed, acting as a referee rather than a participant.
- AI judge / coach β After a Competitive match, holistically reviews the full transcript and produces a winner, scores, and reasoning. After a Solo session, the same holistic-review pattern instead produces a strengths/weaknesses coaching report.
debatesphere/
βββ backend/
β βββ src/
β βββ models/ # User, Debate, Argument, Vote, CompetitiveMatch, MatchMessage, SoloSession
β βββ controllers/ # auth, debates, matches, solo, profile, leaderboard
β βββ routes/ # Express routes matching each controller
β βββ middleware/ # JWT auth middleware
β βββ sockets/ # debateSocket.js (Practice w/ Competitor), matchSocket.js (Competitive)
β βββ services/
β βββ openaiService.js # All Groq calls: scoring, chatbot, summary, judging, AI opponent, solo report
β βββ ragService.js # Local embeddings + cosine similarity search
β βββ memoryService.js # Reads user history from MongoDB
β βββ debateDataset.js # Hardcoded debate knowledge base for RAG
βββ frontend/
βββ src/
βββ app/
β βββ login/, register/
β βββ home/ # Post-login hub: choose Practice or Competitive
β βββ practice/ # Choose Solo vs AI or With a Competitor
β β βββ solo/ # 3-min timed solo debate vs AI + report
β βββ debates/ # Practice w/ Competitor lobby + room
β β βββ [roomCode]/
β β βββ PrepChatbot.tsx
β β βββ results/ # Post-debate stats page
β βββ matches/ # Competitive Mode lobby + room
β βββ profile/[username]/
β βββ leaderboard/
βββ context/ # Auth context
βββ lib/ # Axios + Socket.io clients
- Node.js v22+
- MongoDB (running locally on port 27017)
- Redis (via WSL2 on Windows, or natively on Mac/Linux)
- A free Groq API key from console.groq.com
git clone https://github.com/Shreyarobin/Debatesphere.git
cd Debatespherecd backend
npm installCreate a .env file in backend/:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/debatesphere
REDIS_URL=redis://localhost:6379
JWT_SECRET=your_jwt_secret_here
JWT_REFRESH_SECRET=your_refresh_secret_here
GROQ_API_KEY=gsk-your-groq-key-here
CLIENT_URL=http://localhost:3000
Start the backend:
npm run devThe first startup will take slightly longer as it downloads and indexes the local embedding model for RAG.
cd frontend
npm installCreate a .env.local file in frontend/:
NEXT_PUBLIC_API_URL=http://localhost:5000/api
NEXT_PUBLIC_SOCKET_URL=http://localhost:5000
Start the frontend:
npm run devsudo service redis-server startThen open http://localhost:3000.
- Mobile responsive redesign across all pages
- Content moderation + rate limiting (spam protection, report system)
- Fold Solo Practice stats into profiles and the leaderboard
- Public debate feed + follow/comment system
- Docker Compose for one-command setup
- Deploy backend to Render, frontend to Vercel
- GitHub Actions CI/CD pipeline
Built by Shreya Robin as a personal project to learn full-stack development, real-time architecture with Socket.io and Redis, and practical AI integration (RAG, memory, multi-persona LLM behavior, and game/coaching logic) without relying on paid APIs.
This project is actively evolving β features are being added in focused sessions, one phase at a time. If you're viewing this on a particular day, check the tables above for what's actually working versus what's still planned.