Skip to content
The-AarushiSinghPublic

About

An AI-powered LeetCode-inspired platform with secure code execution, personalized learning analytics, AI hints, code reviews, and video-based explanations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšก BeatCode

An AI-powered LeetCode-style coding platform with secure code execution, personalized learning analytics, and intelligent code assistance.

Live Demo API Status License


๐Ÿ“‹ Table of Contents


๐ŸŽฏ Overview

BeatCode is a comprehensive coding practice platform designed to help developers improve their problem-solving skills through interactive coding challenges, AI-powered assistance, and detailed performance analytics.

Why BeatCode?

  • ๐Ÿš€ Learn by Doing: Practice coding with real-world problems
  • ๐Ÿค– AI-Powered Learning: Get intelligent hints, code reviews, and explanations
  • ๐Ÿ“Š Track Progress: Visualize your growth with detailed analytics
  • ๐ŸŽจ Beautiful Experience: Modern UI with dark/light themes

โœจ Key Features

๐Ÿง  Core Features

Feature Description
๐Ÿ’ป Code Editor Monaco Editor (VS Code experience) with syntax highlighting
๐Ÿ”’ Secure Execution Sandboxed code execution via JDoodle API (with Mock Mode)
๐Ÿค– AI Assistant Groq-powered hints, code reviews, and explanations
๐Ÿ“Š Analytics Activity heatmap, time analysis, and progress tracking
๐Ÿ† Gamification Leaderboard, solved problems tracking
๐ŸŒ— Theme Support Dark/Light mode toggle

๐Ÿ‘ค User Features

  • ๐Ÿ” Authentication: Secure JWT-based login/register
  • ๐Ÿ“ˆ Dashboard: Personalized progress overview
  • ๐Ÿ’พ Submission History: Track all your attempts
  • โญ Problem Solving: Solve problems in multiple languages

๐Ÿ‘‘ Admin Features

  • โž• Create Problems: Add new problems with test cases
  • โœ๏ธ Update Problems: Edit existing problems
  • ๐Ÿ—‘๏ธ Delete Problems: Remove problematic content
  • ๐Ÿงช Test Cases: Public + Hidden test case support

๐Ÿ› ๏ธ Tech Stack

Backend

Technology Purpose
Node.js Runtime environment
Express.js Web framework
MongoDB Atlas Database (Cloud)
JWT Authentication
JDoodle API Code execution (with mock mode)
Groq API AI-powered assistance

Frontend

Technology Purpose
React UI framework
Redux Toolkit State management
Vite Build tool
Monaco Editor Code editor
Axios HTTP client
CSS-in-JS Styling

Deployment

Service Purpose
Vercel Frontend hosting
Render Backend hosting
MongoDB Atlas Cloud database

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                          FRONTEND                              โ”‚
โ”‚                    (Vercel - React + Redux)                    โ”‚
โ”‚                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚  โ”‚  Login   โ”‚  โ”‚   Home   โ”‚  โ”‚ Problem  โ”‚  โ”‚ Dashboardโ”‚     โ”‚
โ”‚  โ”‚  Page    โ”‚  โ”‚   Page   โ”‚  โ”‚   Page   โ”‚  โ”‚   Page   โ”‚     โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”‚                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚              AI Helper / Monaco Editor                 โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                               โ”‚
โ”‚                        โ–ผ                                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚                   Axios Client                         โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         BACKEND                               โ”‚
โ”‚                    (Render - Node.js/Express)                  โ”‚
โ”‚                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚
โ”‚  โ”‚   Auth API   โ”‚  โ”‚  Problems APIโ”‚  โ”‚ Submissions  โ”‚        โ”‚
โ”‚  โ”‚  /api/auth   โ”‚  โ”‚ /api/problemsโ”‚  โ”‚  /api/submit โ”‚        โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
โ”‚                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚
โ”‚  โ”‚  AI Service  โ”‚  โ”‚ JDoodle API  โ”‚  โ”‚    User DB   โ”‚        โ”‚
โ”‚  โ”‚   (Groq)     โ”‚  โ”‚  (Executor)  โ”‚  โ”‚  (MongoDB)   โ”‚        โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
โ”‚                                                               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŒ Live Demo

Service URL
Frontend https://beatcode-xi.vercel.app
Backend API https://beatcode-do9q.onrender.com
Health Check https://beatcode-do9q.onrender.com/health
API Endpoint https://beatcode-do9q.onrender.com/api

Test Credentials

Role Email Password
Admin john@beatcode.com password123
User student@beatcode.com password123

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v16+)
  • MongoDB Atlas account (or local MongoDB)
  • JDoodle API credentials (optional, mock mode available)
  • Groq API key (for AI features)

Installation

# Clone the repository
git clone https://github.com/The-AarushiSingh/BeatCode.git
cd BeatCode

# Install backend dependencies
npm install

# Install frontend dependencies
cd frontend
npm install
cd ..

# Set up environment variables
cp .env.example .env
# Edit .env with your credentials

Environment Variables

# Server
PORT=3000
NODE_ENV=production

# MongoDB
MONGODB_URI=your_mongodb_connection_string

# JWT
JWT_KEY=your_jwt_secret_key
JWT_SECRET=your_jwt_secret_key

# JDoodle
JDOODLE_CLIENT_ID=your_jdoodle_client_id
JDOODLE_CLIENT_SECRET=your_jdoodle_client_secret

# Groq AI
GROQ_API_KEY=your_groq_api_key

# Mock Mode
USE_MOCK=true  # Set to false to use real JDoodle

Run Locally

# Start backend
npm run dev

# In another terminal, start frontend
cd frontend
npm run dev

๐Ÿ“š API Documentation

Authentication Endpoints

Method Endpoint Description
POST /api/auth/register Register a new user
POST /api/auth/login Login user
POST /api/auth/logout Logout user
GET /api/auth/check Check authentication status

Problem Endpoints

Method Endpoint Description Auth
GET /api/problems Get all problems None
GET /api/problems/:id Get problem by ID None
POST /api/problems Create new problem Admin
PUT /api/problems/:id Update problem Admin
DELETE /api/problems/:id Delete problem Admin

Submission Endpoints

Method Endpoint Description Auth
POST /api/problems/:id/submit Submit a solution User
GET /api/problems/user/solved Get solved problems User

AI Endpoints

Method Endpoint Description Auth
POST /api/problems/:id/hint Get AI hint User
POST /api/problems/:id/review Get AI code review User
GET /api/problems/:id/explanation Get AI explanation User
GET /api/problems/recommendation Get problem recommendation None

๐Ÿ“ Project Structure

BeatCode/
โ”œโ”€โ”€ frontend/                        # React Frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AIHelper.jsx         # AI Assistant UI
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Heatmap.jsx          # Activity heatmap
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ TimeAnalysis.jsx     # Time analytics
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Login.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SignUp.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ HomePage.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ProblemPage.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Leaderboard.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Admin.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ store/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ store.js             # Redux store
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ authSlice.js         # Auth state
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ProblemSlice.js      # Problems state
โ”‚   โ”‚   โ””โ”€โ”€ utils/
โ”‚   โ”‚       โ””โ”€โ”€ axiosClient.js       # API client
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ vite.config.js
โ”‚
โ”œโ”€โ”€ src/                             # Backend
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ db.js                    # Database connection
โ”‚   โ”‚   โ””โ”€โ”€ redis.js                 # Redis connection
โ”‚   โ”œโ”€โ”€ controllers/
โ”‚   โ”‚   โ”œโ”€โ”€ authController.js        # Auth logic
โ”‚   โ”‚   โ”œโ”€โ”€ userProblem.js           # Problem CRUD
โ”‚   โ”‚   โ”œโ”€โ”€ userSubmission.js        # Submission logic
โ”‚   โ”‚   โ””โ”€โ”€ aiController.js          # AI endpoints
โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ”œโ”€โ”€ adminMiddleware.js       # Admin auth
โ”‚   โ”‚   โ””โ”€โ”€ userMiddleware.js        # User auth
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ user.js                  # User schema
โ”‚   โ”‚   โ”œโ”€โ”€ problems.js              # Problem schema
โ”‚   โ”‚   โ””โ”€โ”€ submissions.js           # Submission schema
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”œโ”€โ”€ userAuth.js              # Auth routes
โ”‚   โ”‚   โ””โ”€โ”€ prbCreator.js            # Problem routes
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ””โ”€โ”€ aiService.js             # Groq AI service
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ””โ”€โ”€ jdoodleValidator.js      # Code execution
โ”‚   โ””โ”€โ”€ index.js                     # Server entry
โ”‚
โ”œโ”€โ”€ .env                             # Environment variables
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿšง Challenges & Solutions

1. JDoodle API Rate Limits โš ๏ธ

Challenge: JDoodle's free tier limits to 200 requests per day, which was a significant bottleneck during development and testing.

Solution:

  • Mock Mode: Implemented a USE_MOCK environment variable that bypasses JDoodle entirely
  • Graceful Fallback: When rate limit is hit, the system falls back to mock mode
  • Developer Experience: Mock mode allows uninterrupted development and testing

2. CORS Configuration ๐ŸŒ

Challenge: Frontend (Vercel) couldn't communicate with backend (Render) due to CORS issues.

Solution:

  • Configured CORS to allow multiple origins (localhost, Vercel, Render)
  • Used environment variables for dynamic origin configuration

3. Code Editor Integration ๐Ÿ“

Challenge: Implementing a VS Code-like experience in the browser.

Solution:

  • Integrated Monaco Editor (VS Code's editor)
  • Added support for multiple languages (JavaScript, Python, Java, C++, Go, Rust)
  • Implemented boilerplate code generation

๐Ÿ”ฎ Future Scope

Short-Term (1-3 Months)

Feature Description
๐Ÿ“น Video Explanations Upload and view solution videos (Cloudinary)
๐Ÿ’ฌ Discussion Forums Community discussions for each problem
๐Ÿ“ฑ Mobile App React Native mobile application
๐Ÿ”” Notifications Email and in-app notifications

Medium-Term (3-6 Months)

Feature Description
๐Ÿง  Smart Recommendations ML-based problem suggestions
๐Ÿ“Š Advanced Analytics Detailed performance insights
๐ŸŽฏ Daily Challenges New problem every day
๐Ÿ† Contests Timed coding competitions

Long-Term (6-12 Months)

Feature Description
๐Ÿค Collaborative Coding Real-time pair programming
๐Ÿ“š Learning Paths Curated problem sets for skill levels
๐Ÿ”’ Enterprise Features Team management, SSO, reporting
๐ŸŒ Multi-language UI Support for multiple languages

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

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

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • JDoodle - For providing the code execution API
  • Groq - For the free AI API
  • Render - For the free backend hosting
  • Vercel - For the free frontend hosting
  • MongoDB - For the free cloud database

๐Ÿ“ž Contact


โญ Show Your Support

If you found this project helpful, please give it a โญ on GitHub!


Built with โค๏ธ by Aarushi Singh

About

An AI-powered LeetCode-inspired platform with secure code execution, personalized learning analytics, AI hints, code reviews, and video-based explanations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages