Skip to content

ravibhushan10/CodeforgeAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CodeForge โ€” Full-Stack Competitive Coding Platform

A modern, full-stack competitive coding platform with AI-powered tutoring, real-time code execution, mock interviews, and an ML-driven dashboard. Built with React, Vite, Node.js, and MongoDB โ€” featuring a LeetCode-style problem solver, global leaderboard, Razorpay payments, and Firebase OAuth.


๐Ÿ“ธ Screenshots


Home Page

Sign Up

Email Verification

Email Verification

Problem List

Solve Page

AI suggestion

Profile Page

Help Page

๐ŸŒ Live Demo

๐ŸŒŸ Features

โšก Real Code Execution

  • Judge0-powered code runner supporting C++, Python, Java, C, and JavaScript
  • Run against sample test cases or submit against all hidden test cases
  • Live verdict: Accepted, Wrong Answer, Runtime Error, TLE, Compilation Error

๐Ÿค– AI Tutor & Code Review

  • Groq LLaMA 3.3 70B-powered AI tutor embedded in the problem solver
  • Gives hints, approach strategies, and complexity analysis without spoiling solutions
  • AI Code Review for Pro users โ€” feedback on submitted solutions

๐Ÿ’ผ Problem Library

  • 160+ handcrafted DSA problems with difficulty ratings (Easy / Medium / Hard)
  • Company tags (Google, Amazon, Microsoft, Facebook, Apple, etc.)
  • Premium problem lock with Pro plan unlock
  • "Pick Random" for spontaneous practice

๐Ÿ“Š ML-Powered Dashboard (Pro)

  • Weakness Radar โ€” SVG radar chart showing accuracy per DSA topic
  • Interview Readiness Score โ€” per-company readiness based on solved problems
  • Smart Recommendations โ€” ML picks the best next problems based on weak tags
  • 30-Day Study Plan โ€” personalised milestones with progress bars
  • Submission Heatmap โ€” GitHub-style activity calendar

๐ŸŽค Mock Interview Mode (Pro)

  • Choose target company (Google, Amazon, Microsoft, etc.) and duration (45/90/120 min)
  • 3 problems picked (1 Easy, 1 Medium, 1 Hard) from company-tagged pool
  • Countdown timer with urgency alerts
  • Scored result on completion

๐Ÿ† Leaderboard & Rating

  • Global leaderboard ranked by rating points
  • Rating titles from Beginner โ†’ Legendary Coder
  • Streak tracking, coin system, and podium display for top 3

๐Ÿ’ณ Razorpay Payments

  • Monthly (โ‚น10) and yearly (โ‚น50) Pro plans
  • Webhook-based payment verification
  • Transparent fee breakdown (gateway + GST)

๐Ÿ” Auth System

  • Email/password with 6-digit OTP verification
  • Google & GitHub OAuth via Firebase
  • JWT access tokens (15 min) + HTTP-only refresh tokens (1 year)
  • Forgot password with OTP-based reset flow
  • Automatic cleanup of unverified accounts after 24 hours

๐ŸŽจ UI/UX

  • Fully responsive โ€” mobile, tablet, desktop
  • Dark theme with CSS variable design token system
  • Resizable split-panel problem solver
  • Page transition animations and skeleton loaders
  • Offline detection banner

๐Ÿ› ๏ธ Technologies Used

Frontend

Technology Purpose Version
React UI Framework 18+
Vite Build Tool 5+
React Router DOM Client-side Routing 6+
TanStack React Query Data Fetching & Caching 5+
Axios HTTP Client 1+
Firebase Google & GitHub OAuth 10+
React Icons Icon Library 5+
React Helmet Async SEO & Meta Tags 3+
CSS Modules Component-scoped Styling โ€”

Backend

Technology Purpose Version
Node.js Runtime Environment 18+
Express.js Web Framework 4+
MongoDB + Mongoose Database & ODM 8+
bcryptjs Password Hashing 2+
jsonwebtoken JWT Auth 9+
Nodemailer Transactional Email (dev) 6+
Resend HTTP API Transactional Email (prod) โ€”
Razorpay Payment Processing 2+
Multer + Sharp File Upload & Image Processing โ€”
node-fetch Groq AI API calls 3+
dotenv Environment Variables 16+
cors Cross-Origin Resource Sharing 2+
cookie-parser HTTP Cookie Parsing 1+
express-rate-limit API Rate Limiting 8+

Admin Panel

Technology Purpose Version
React UI Framework 18+
Vite Build Tool 5+

DevOps & Tools

Tool Purpose
Vercel Frontend Deployment
Render Backend Deployment
Judge0 Code Execution Engine
Nodemon Dev Server Auto-reload
Git Version Control

๐Ÿš€ Getting Started

Prerequisites

  • Node.js >= 18.0.0
  • npm >= 8.0.0
  • MongoDB URI (Atlas or local)
  • Groq API key (get one free at console.groq.com)
  • Firebase project with Google & GitHub auth enabled
  • Razorpay account (for payment features)

Installation Steps

  1. Clone the repository

    git clone https://github.com/ravibhushan10/CodeforgeAI.git
    cd codeforge
  2. Install Backend Dependencies

    cd backend
    npm install
  3. Install Frontend Dependencies

    cd frontend
    npm install
  4. Install Admin Dependencies

    cd admin
    npm install
  5. Backend Environment Variables โ€” create .env in backend/

    PORT=5000
    MONGODB_URI=your_mongodb_connection_string
    JWT_SECRET=your_super_secret_jwt_key
    REFRESH_TOKEN_SECRET=any_random_long_string
    GROQ_API_KEY=your_groq_api_key
    RAZORPAY_KEY_ID=rzp_test_your_key_id
    RAZORPAY_KEY_SECRET=your_razorpay_secret
    RAZORPAY_WEBHOOK_SECRET=your_webhook_secret
    FRONTEND_URL=http://localhost:5173
    ADMIN_URL=http://localhost:3001
    GMAIL_USER=yourname@gmail.com
    GMAIL_PASS=xxxx_xxxx_xxxx_xxxx
    NODE_ENV=development
  6. Frontend Environment Variables โ€” create .env in frontend/

    VITE_API_URL=http://localhost:5000
    VITE_FIREBASE_API_KEY=your_firebase_api_key
    VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
    VITE_FIREBASE_PROJECT_ID=your_project_id
    VITE_FIREBASE_APP_ID=your_app_id
    VITE_RAZORPAY_KEY_ID=rzp_test_your_key_id
  7. Start the Backend

    cd backend
    npm run dev
    # Server runs on http://localhost:5000
  8. Start the Frontend (in a new terminal)

    cd frontend
    npm run dev
    # Client runs on http://localhost:5173
  9. Start the Admin Panel (optional, in a new terminal)

    cd admin
    npm run dev
    # Admin runs on http://localhost:5174

๐Ÿ“– Usage Guide

Navigating the Platform

  • Home โ€” Landing page with hero section and features overview
  • Problems โ€” Browse all DSA problems with filters by difficulty, tag, and company
  • Problem Solver โ€” Split-panel editor with description, AI Tutor, and submission tabs
  • Dashboard โ€” ML insights, submission heatmap, and Pro features
  • Leaderboard โ€” Global ranking by rating points
  • Profile โ€” Personal stats, badge collection, and submission history

Using the Problem Solver

  1. Navigate to Problems and click any problem
  2. Select your preferred language (C++, Python, Java, C, JavaScript)
  3. Write your solution in the code editor
  4. Click โ–ถ Run to test against sample cases
  5. Click Submit to judge against all hidden test cases
  6. Use the AI Tutor tab for hints without spoilers

Using the Admin Panel

  1. Navigate to http://localhost:5174
  2. Sign in with an admin account
  3. Manage problems (add, edit, delete, bulk upload JSON)
  4. Toggle premium status per problem
  5. View and manage registered users
  6. Check platform statistics

๐Ÿ“ Project Structure

codeforge/
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/        # Reusable UI components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Navbar.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AuthModals.jsx # Login + Register with OTP flow
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ PaymentModal.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MockInterview.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ WeaknessRadar.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ReadinessScore.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ context/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AppContext.jsx  # Global auth + toast state
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ useAuth.js      # Firebase OAuth hook
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ useResizable.js # Drag-to-resize panels
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Home.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Problems.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Solve.jsx       # Split-panel problem solver
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.jsx   # ML insights
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Leaderboard.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Profile.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Help.jsx
โ”‚   โ”‚   โ””โ”€โ”€ styles/
โ”‚   โ”‚       โ””โ”€โ”€ globals.css     # Design token system
โ”‚   โ””โ”€โ”€ vite.config.js
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ models/
โ”‚       โ”‚   โ”œโ”€โ”€ User.js
โ”‚       โ”‚   โ”œโ”€โ”€ Problem.js
โ”‚       โ”‚   โ””โ”€โ”€ Submission.js
โ”‚       โ”œโ”€โ”€ routes/
โ”‚       โ”‚   โ”œโ”€โ”€ users.js        # Auth, profile, leaderboard
โ”‚       โ”‚   โ”œโ”€โ”€ problems.js     # CRUD + bulk import
โ”‚       โ”‚   โ”œโ”€โ”€ submissions.js  # Run + Submit + Judge0 integration
โ”‚       โ”‚   โ”œโ”€โ”€ ai.js           # Groq AI hint + code review
โ”‚       โ”‚   โ””โ”€โ”€ payments.js     # Razorpay order + verify + webhook
โ”‚       โ”œโ”€โ”€ middleware/
โ”‚       โ”‚   โ””โ”€โ”€ auth.js         # JWT + admin middleware
โ”‚       โ”œโ”€โ”€ utils/
โ”‚       โ”‚   โ””โ”€โ”€ sendEmail.js    # Resend (prod) / Gmail (dev)
โ”‚       โ””โ”€โ”€ server.js
โ”‚
โ””โ”€โ”€ admin/
    โ””โ”€โ”€ src/
        โ”œโ”€โ”€ pages/
        โ”‚   โ”œโ”€โ”€ LoginPage.jsx
        โ”‚   โ”œโ”€โ”€ ProblemsPage.jsx
        โ”‚   โ”œโ”€โ”€ UsersPage.jsx
        โ”‚   โ””โ”€โ”€ StatsPage.jsx
        โ””โ”€โ”€ components/
            โ”œโ”€โ”€ ProblemModal.jsx
            โ””โ”€โ”€ DeleteByNumModal.jsx

๐Ÿ”Œ API Endpoints

Auth

Method Endpoint Description
POST /api/users/register Register with email/password
POST /api/users/verify-otp-register Verify registration OTP
POST /api/users/login Login with email/password
POST /api/users/logout Invalidate refresh token
POST /api/users/refresh Refresh access token
POST /api/users/oauth Google / GitHub OAuth login
POST /api/users/forgot-password Send password reset OTP
POST /api/users/verify-otp Verify reset OTP
POST /api/users/reset-password Set new password

Problems

Method Endpoint Description
GET /api/problems List problems (with filters)
GET /api/problems/:slug Get single problem
POST /api/problems Create problem (admin)
PUT /api/problems/:id Update problem (admin)
DELETE /api/problems/:id Delete & renumber (admin)
POST /api/problems/bulk Bulk import JSON (admin)
PATCH /api/problems/:id/toggle-premium Toggle premium flag (admin)

Submissions

Method Endpoint Description
POST /api/submissions/run Run code against sample test cases
POST /api/submissions Submit for full judgement
GET /api/submissions/me Get user's submission history

AI

Method Endpoint Description
POST /api/ai/hint Get AI hint / tutor response
POST /api/ai/analyze AI code review (Pro)

Payments

Method Endpoint Description
POST /api/payments/order Create Razorpay order
POST /api/payments/verify Verify payment signature
POST /api/payments/webhook Razorpay webhook handler
GET /api/payments/status Get user's subscription status

๐Ÿค Contributing

How to Contribute

  1. Fork the Repository

    • Click the Fork button at the top right of this repository
  2. Clone Your Fork

    git clone https://github.com/ravibhushan10/CodeforgeAI.git
    cd codeforge
  3. Create a Branch

    git checkout -b feature/AmazingFeature
  4. Make Your Changes

    • Write clean, readable code
    • Follow the existing code style
    • Test your changes thoroughly
  5. Commit Your Changes

    git add .
    git commit -m 'Add some AmazingFeature'
  6. Push to Your Fork

    git push origin feature/AmazingFeature
  7. Open a Pull Request

    • Go to your forked repository on GitHub
    • Click "Compare & pull request"
    • Fill in the PR form:
      • Title: Brief summary (e.g., "Add dark mode animation")
      • Description: What changed, why, screenshots if UI change
      • Related issues: e.g., "Fixes #12"
    • Click "Create pull request"

๐Ÿ”ฎ Planned Improvements

  • Contests with real-time leaderboard updates
  • Discussion forum per problem
  • Editorial / official solution after solve
  • Code execution via self-hosted Judge0 instance
  • Multi-language i18n support
  • PWA with offline support
  • Email digest of recommended problems

๐Ÿ‘จโ€๐Ÿ’ป Author

Ravi Bhushan


โญ Star this repository if it helped you!

Made with โค๏ธ by Ravi Bhushan

Live Demo ยท Report Bug ยท Request Feature

About

AI-powered competitive coding platform with real-time code execution (C++, Python, Java, C, JS), Groq AI tutor, ML dashboard, mock interviews, Razorpay payments, and Firebase OAuth. Built with React, Node.js, and MongoDB.

Topics

Resources

Stars

Watchers

Forks

Contributors