Skip to content

voidogic/CodeArena

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 CodeShala – Online Coding Learning & Practice Platform

CodeShala is a full-stack web application designed for coding practice, problem-solving, AI-assisted learning, and video-based explanations. It provides an interactive experience with a modern UI, real-time submissions, and powerful admin tools.

πŸ“š Table of Contents

🎯 Overview

CodeShala is an interactive platform combining:

  • Coding problem-solving
  • Real-time submission results
  • Video explanations
  • AI chat support for doubts
  • Admin dashboards for content management
  • User progress tracking

It is built with React (Frontend) and Node.js + MongoDB (Backend).

✨ Features

πŸ‘¨β€πŸŽ“ User Features

  • Register / Login / Logout
  • Solve coding problems with built-in editor
  • Submit solutions and view evaluation
  • Watch solution videos
  • Chat with AI for hints
  • View submission history
  • Track progress

πŸ›  Admin Features

  • Add / Update / Delete problems
  • Upload & manage videos
  • Delete any submission
  • Access admin dashboard

βš™ Backend Capabilities

  • MongoDB for storage
  • Redis caching
  • Google Generative AI integration
  • Cloudinary for media
  • JWT-based authentication
  • Rate limiting
  • Schema validation with Zod

🧰 Tech Stack

Frontend

  • React 19
  • Vite
  • Tailwind CSS + DaisyUI
  • Redux Toolkit
  • React Router
  • Axios
  • Monaco Code Editor
  • React Hook Form + Zod

Backend

  • Node.js
  • Express.js
  • MongoDB + Mongoose
  • Redis
  • JWT Authentication
  • Bcrypt
  • Google Generative AI
  • Cloudinary
  • Rate Limiting
  • CORS

πŸ“ Project Structure

CodeShala/
β”‚
β”œβ”€β”€ CodeShaala-Backend-main/
β”‚   β”œβ”€β”€ index.js
β”‚   β”œβ”€β”€ vercel.json
β”‚   β”œβ”€β”€ package.json
β”‚   └── src/
β”‚       β”œβ”€β”€ config/          # DB & Redis config
β”‚       β”œβ”€β”€ controllers/     # Business logic
β”‚       β”œβ”€β”€ middleware/      # Auth, rate limiter, admin
β”‚       β”œβ”€β”€ models/          # MongoDB schemas
β”‚       β”œβ”€β”€ routes/          # API Routes
β”‚       └── utils/           # Helper utilities
β”‚
└── CodeShaala-Frontend-main/
    β”œβ”€β”€ index.html
    β”œβ”€β”€ package.json
    β”œβ”€β”€ vite.config.js
    └── src/
        β”œβ”€β”€ components/
        β”œβ”€β”€ pages/
        β”œβ”€β”€ store/
        └── utils/

πŸš€ Installation

Prerequisites

  • Node.js v16+
  • MongoDB (Local / Atlas)
  • Redis server
  • Cloudinary account
  • Google GenAI API key

πŸ”§ Backend Setup

  1. Navigate to backend:
cd CodeShaala-Backend-main
  1. Install dependencies:
npm install
  1. Create .env file:
PORT=5000

DB_CONNECT_STRING=your_mongodb_uri
REDIS_PASS=redis://localhost:6379
JWT_SECRET=your_jwt_secret
JUDGE0_KEY=your_judge0_secret_key
GOOGLE_AI_API_KEY=your_genai_key
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret

🎨 Frontend Setup

  1. Navigate:
cd CodeShaala-Frontend-main
  1. Install:
npm install
  1. Create .env:
VITE_API_URL=http://localhost:5000

▢️ Running the Application

Backend

cd CodeShaala-Backend-main
npm run dev

Server starts at: http://localhost:5000

Frontend

cd CodeShaala-Frontend-main
npm run dev

Frontend runs at: http://localhost:5173

πŸ”Œ API Endpoints

Authentication – /user

Method Endpoint Description
POST /user/register Register user
POST /user/login Login user
POST /user/logout Logout
GET /user/profile Get user profile
GET /user/check-auth Validate token

Problems – /problem

Method Endpoint Description
GET /problem Get all problems
GET /problem/:id Get problem details
POST /problem Create problem (Admin)
PUT /problem/:id Update (Admin)
DELETE /problem/:id Delete (Admin)

Submissions – /submission

Method Endpoint Description
POST /submission Submit code
GET /submission/:userId User submissions
GET /submission/history Submission history
DELETE /submission/:id Delete submission

AI – /ai

Method Endpoint Description
POST /ai/chat Chat with AI
POST /ai/solve-doubt AI help for problems

Videos – /video

Method Endpoint Description
GET /video Get all videos
GET /video/:problemId Get problem videos
POST /video Upload video (Admin)
DELETE /video/:id Delete video

πŸ—ΊοΈ Frontend Routes

Route Page
/ Landing Page
/login Login
/signup Sign Up
/home Homepage
/problem/:id Problem + Code Editor
/submission-history User submissions
/admin Admin Dashboard
/admin/upload Add problems
/admin/video Video manager
/admin/delete Content removal

πŸ—„οΈ Database Models

User

{
  username: String,
  email: String,
  password: String,
  role: String,
  problemsSolved: [ObjectId],
  submissions: [ObjectId],
  createdAt: Date
}

Problem

{
  title: String,
  description: String,
  difficulty: String,
  testCases: Array,
  solutions: [ObjectId],
  creator: ObjectId,
  createdAt: Date
}

Submission

{
  userId: ObjectId,
  problemId: ObjectId,
  code: String,
  language: String,
  status: String,
  output: String,
  executionTime: Number,
  submittedAt: Date
}

Solution Video

{
  problemId: ObjectId,
  title: String,
  videoUrl: String,
  explanation: String,
  uploadedAt: Date
}

πŸ” Security Features

  • JWT Authentication
  • Password hashing (bcrypt)
  • Rate limiting
  • Input validation with Zod
  • Role-based access control
  • CORS protection
  • Redis caching

πŸ“œ License

ISC License

🀝 Contributing

Active development is in progress β€” features and updates are being added regularly.


Made with ❀️ by the CodeShala Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages