Skip to content

๐Ÿš€ CodeCrux - Comprehensive learning platform with curated tutorials, practice sheets & AI-powered mentorship. Built with React, Node.js & MongoDB.

Notifications You must be signed in to change notification settings

aashutosh585/CodeCrux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ CodeCrux


๐ŸŒŸ About

CodeCrux is a full-stack DSA learning platform designed for coding interview preparation. It features AI-powered mentorship, dynamic content management, progress tracking, and admin-controlled data. Built with modern MERN stack architecture and Google Gemini AI integration.

โœจ Features

๐ŸŽฏ Dynamic Content Management

  • Admin Dashboard - Full CRUD operations for sheets and tutorials
  • Database-Driven - All content stored in MongoDB with real-time updates
  • Progress Tracking - ObjectId relationships for user completion status
  • Role-Based Access - Admin-only content management (ashutoshmaurya585@gmail.com)

๐Ÿ“š Learning Resources

  • Popular DSA Sheets - Striver's SDE, Love Babbar 450, NeetCode 150, Blind 75, etc.
  • Video Tutorials - Curated programming tutorials with metadata
  • 6-Stage Roadmap - Structured learning path from basics to advanced
  • Search & Filter - Advanced filtering by category, difficulty, and tags

๐Ÿค– AI-Powered Mentorship

  • Google Gemini AI - 24/7 intelligent coding mentor
  • Persistent Chat History - Conversations saved to user profile
  • Context-Aware - AI understands your learning progress
  • Real-time Streaming - Live AI responses with typing indicators

๐Ÿ“Š User Progress & Analytics

  • Completion Tracking - Mark sheets/tutorials as completed
  • Personal Dashboard - Real-time progress statistics
  • Profile Management - User data with completion history
  • Admin Access Button - Quick admin panel access for authorized users

๐ŸŽจ Modern User Experience

  • Dark/Light Themes - Persistent theme preference
  • Responsive Design - Mobile-first approach for all devices
  • Real-time Notifications - Toast messages for user actions
  • Fast Performance - Optimized bundle size and clean architecture

๐Ÿ—๏ธ Architecture & Tech Stack

๐ŸŽจ Frontend (React SPA)

  • โš›๏ธ React 19.1.0: Modern React with hooks and context API
  • โšก Vite: Lightning-fast development server and optimized builds
  • ๐ŸŽจ Tailwind CSS: Utility-first responsive design
  • ๐Ÿงญ React Router DOM: Client-side routing with protected routes
  • ๐Ÿ”” React Toastify: Toast notifications for user feedback
  • ๐ŸŽฏ Lucide React: Consistent icon library
  • ๐ŸŒ Axios: HTTP client with cookie support
  • ๐Ÿค– Google GenAI: Direct Gemini AI chat integration

๐Ÿ”ง Backend (Node.js API)

  • ๐Ÿš€ Express.js 5.1.0: RESTful API server with middleware
  • ๐Ÿ—„๏ธ MongoDB + Mongoose: Document database with schema validation
  • ๏ฟฝ JWT Authentication: Secure token-based auth with cookies
  • ๐Ÿ” bcryptjs: Password hashing and security
  • ๐Ÿ“ง Nodemailer: Email verification and password reset
  • ๐Ÿช Cookie Parser: HTTP cookie handling
  • ๐ŸŒ CORS: Cross-origin resource sharing
  • ๐Ÿ”ง Nodemon: Development auto-reload

๐Ÿ—„๏ธ Database Schema

  • ๏ฟฝ User Model: Profile, auth, progress tracking with ObjectId refs
  • ๐Ÿ“‹ Sheet Model: DSA sheets with metadata, tags, and ratings
  • ๐ŸŽฅ Tutorial Model: Video tutorials with instructor and duration info
  • ๏ฟฝ Chat History: Persistent AI conversations per user

๐Ÿ›ก๏ธ Security & Performance

  • ๐Ÿ” Role-Based Access: Admin-only routes and operations
  • ๐Ÿ”‘ JWT + HTTP-Only Cookies: Secure authentication flow
  • ๐Ÿ“ง Email Verification: OTP-based account verification
  • โšก Optimized Bundle: Tree-shaking and code splitting
  • ๏ฟฝ Clean Architecture: Separation of concerns and DRY principles

๐Ÿ“ Project Structure

CodeCrux/
โ”œโ”€โ”€ codecrux-frontend/          # React Frontend Application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/         # Reusable UI Components (14 files)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatInput.jsx       # AI chat input interface
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatMessages.jsx    # AI chat message display
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.jsx       # User progress dashboard
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SheetCard.jsx       # Practice sheet cards
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ TutorialCard.jsx    # Video tutorial cards
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...                 # Navigation, search, etc.
โ”‚   โ”‚   โ”œโ”€โ”€ pages/              # Main Application Pages (11 files)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminDashboard.jsx  # Content management interface
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MentorAI.jsx        # AI chat page
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Sheet.jsx           # Practice sheets listing
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Tutorials.jsx       # Video tutorials listing
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Profile.jsx         # User profile & progress
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...                 # Auth, home, roadmap pages
โ”‚   โ”‚   โ”œโ”€โ”€ contexts/           # React Context Providers (2 files)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AppContext.jsx      # Global state & API calls
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ DarkModeContext.jsx # Theme management
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/              # Custom React Hooks (1 file)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ useAIMentor.js      # AI chat functionality
โ”‚   โ”‚   โ”œโ”€โ”€ data/               # Static Data (1 file)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ RoadmapData.jsx     # Learning roadmap structure
โ”‚   โ”‚   โ””โ”€โ”€ assets/             # Images, icons, utilities (10 files)
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ codecrux-server/            # Express Backend API
โ”‚   โ”œโ”€โ”€ controllers/            # Business Logic Controllers (4 files)
โ”‚   โ”‚   โ”œโ”€โ”€ authController.js       # Authentication logic
โ”‚   โ”‚   โ”œโ”€โ”€ userController.js       # User data management
โ”‚   โ”‚   โ”œโ”€โ”€ adminController.js      # Admin CRUD operations
โ”‚   โ”‚   โ””โ”€โ”€ publicController.js     # Public data endpoints
โ”‚   โ”œโ”€โ”€ models/                 # MongoDB Schemas (3 files)
โ”‚   โ”‚   โ”œโ”€โ”€ userModel.js           # User schema with progress refs
โ”‚   โ”‚   โ”œโ”€โ”€ sheetModel.js          # Practice sheet schema
โ”‚   โ”‚   โ””โ”€โ”€ tutorialModel.js       # Tutorial video schema
โ”‚   โ”œโ”€โ”€ routes/                 # API Route Definitions (4 files)
โ”‚   โ”‚   โ”œโ”€โ”€ authRoutes.js          # Authentication endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ userRoutes.js          # User data endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ adminRoutes.js         # Admin-only endpoints
โ”‚   โ”‚   โ””โ”€โ”€ publicRoutes.js        # Public data endpoints
โ”‚   โ”œโ”€โ”€ middleware/             # Custom Middleware (1 file)
โ”‚   โ”‚   โ””โ”€โ”€ userAuth.js            # JWT authentication middleware
โ”‚   โ”œโ”€โ”€ config/                 # Configuration Files (2 files)
โ”‚   โ”‚   โ”œโ”€โ”€ mongodb.js             # Database connection
โ”‚   โ”‚   โ””โ”€โ”€ nodemailer.js          # Email service config
โ”‚   โ”œโ”€โ”€ server.js               # Express server entry point
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ API_DOCUMENTATION.md    # Complete API reference
โ””โ”€โ”€ README.md                   # This file

๐ŸŒ Live Deployment

Deployment Architecture:

  • Frontend deployed on Vercel (React SPA with optimized routing)
  • Backend deployed on Render (Node.js API with Docker support)
  • Database hosted on MongoDB Atlas (Cloud database service)

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v18+) - JavaScript runtime
  • MongoDB (local installation or MongoDB Atlas cloud)
  • Google Gemini API Key - For AI chat functionality
  • Email Service - Gmail SMTP or similar for auth emails

Quick Start

  1. Clone & Setup
git clone https://github.com/aashutosh585/CodeCrux.git
cd CodeCrux

# Install all dependencies
npm run install:all   # or install manually below
  1. Manual Installation
# Backend dependencies
cd codecrux-server && npm install

# Frontend dependencies  
cd ../codecrux-frontend && npm install
  1. Environment Configuration

Backend Environment (codecrux-server/.env):

# Database
MONGODB_URI=mongodb+srv://your-username:your-password@cluster.mongodb.net/codecrux

# JWT Authentication
JWT_SECRET=your-super-secret-jwt-key-minimum-32-characters

# Email Service (Brevo SMTP)
SMTP_USER=your-smtp-user@smtp-brevo.com
SMTP_PASS=your-brevo-api-key
SENDER_EMAIL=your-email@gmail.com

# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_CALLBACK_URL=http://localhost:4000/api/auth/google/callback

# Server Configuration
PORT=4000
NODE_ENV=development

Frontend Environment (codecrux-frontend/.env):

# Backend API URL
VITE_API_URL=http://localhost:4000/api

# Google Gemini AI API Key
VITE_GEMINI_API_KEY=your-gemini-api-key-here
  1. Database Setup
# Start MongoDB service (if local)
# Windows: net start MongoDB
# macOS: brew services start mongodb
# Linux: sudo systemctl start mongod

# MongoDB will automatically create collections on first run
  1. Start Development Servers
# Terminal 1 - Backend API (Port 4000)
cd codecrux-server && npm start

# Terminal 2 - Frontend React App (Port 5173)  
cd codecrux-frontend && npm run dev
  1. Access Application

๏ฟฝ API Reference

๐Ÿ” Authentication Routes (/api/auth)

POST   /register          # User registration with email verification
POST   /login             # User login with JWT token
POST   /logout            # User logout and token cleanup
GET    /is-auth           # Check current authentication status
POST   /send-verify-otp   # Send email verification OTP
POST   /verify-otp        # Verify email with OTP code
POST   /send-reset-otp    # Send password reset OTP
POST   /reset-password    # Reset password with OTP

๐Ÿ‘ค User Routes (/api/user) - Requires Authentication

GET    /data              # Get user profile and progress data
POST   /chat/message      # Save individual AI chat message
POST   /chat/history      # Bulk save chat conversation
DELETE /chat/history      # Clear user's chat history
POST   /toggle-sheet      # Toggle sheet completion status
POST   /toggle-tutorial   # Toggle tutorial completion status

๐Ÿ›ก๏ธ Admin Routes (/api/admin) - Admin Only

POST   /check             # Verify admin access permissions
GET    /sheets            # Get all sheets (admin view)
POST   /sheets            # Create new practice sheet
PUT    /sheets/:id        # Update existing sheet
DELETE /sheets/:id        # Delete practice sheet
GET    /tutorials         # Get all tutorials (admin view)
POST   /tutorials         # Create new tutorial
PUT    /tutorials/:id     # Update existing tutorial
DELETE /tutorials/:id     # Delete tutorial

๐ŸŒ Public Routes (/api/public) - No Authentication

GET    /sheets            # Get all published practice sheets
GET    /tutorials         # Get all published video tutorials

๐Ÿ“‹ Complete API Documentation: See codecrux-server/API_DOCUMENTATION.md for detailed request/response schemas

๐ŸŽฏ Core Features & Implementation

๐Ÿ”ง Admin Features

Admin Dashboard (AdminDashboard.jsx)

  • Content Management: Full CRUD operations for sheets and tutorials
  • Role-Based Access: Only ashutoshmaurya585@gmail.com can access admin panel
  • Real-time Updates: Changes reflect immediately across the platform
  • Data Validation: Form validation with error handling and success notifications

Access Method:

  • Login with admin email โ†’ Go to Profile โ†’ Click "Admin Dashboard" button

๐Ÿค– AI Integration

AI Mentor System (MentorAI.jsx + useAIMentor.js)

  • Google Gemini AI: Real-time chat with streaming responses
  • Persistent History: All conversations saved to user profile
  • Context Awareness: AI understands your learning progress and completed items
  • Error Handling: Graceful fallbacks and retry mechanisms

๐Ÿ“Š Progress System

User Progress Tracking

  • ObjectId Relationships: MongoDB references between users and completed content
  • Real-time Updates: Instant progress reflection across dashboard and profile
  • Toggle Completion: Mark sheets/tutorials as done with one click
  • Analytics: Dashboard shows completed items, chat history count, and total progress

๐Ÿ—„๏ธ Database Architecture

Dynamic Content Management

  • Sheet Model: Title, description, author, difficulty, problems count, rating, tags, etc.
  • Tutorial Model: Instructor, duration, thumbnail, URL, student count, level, etc.
  • User Model: Profile data with ObjectId arrays referencing completed sheets/tutorials
  • Populated Queries: Efficient data fetching with MongoDB population

๐Ÿ”ง Development Scripts

Frontend (Client)

npm run dev        # Start Vite development server (http://localhost:5173)
npm run build      # Build optimized production bundle
npm run preview    # Preview production build locally
npm run lint       # Run ESLint code analysis

Backend (CodeCrux Server)

npm start          # Start production server
npm run dev        # Start with nodemon auto-reload

Root Scripts

npm run install:all    # Install dependencies for both frontend and backend
npm run dev:full      # Start both frontend and backend concurrently
npm run build:all     # Build both applications for production

๐Ÿš€ Deployment

Production Environment (Current)

Frontend Deployment (Vercel)

cd codecrux-frontend
npm run build
# Deploy dist/ folder or connect GitHub repository to Vercel

Vercel Configuration (vercel.json):

{
  "rewrites": [
    { "source": "/(.*)", "destination": "/" }
  ]
}

Backend Deployment (Render)

cd codecrux-server  
# Set environment variables in Render dashboard
# Deploy with Node.js runtime using start command

Environment Variables for Production

# Backend Production (Render)
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/codecrux
JWT_SECRET=your-production-jwt-secret-32-chars-minimum
SMTP_USER=your-brevo-smtp-user
SMTP_PASS=your-brevo-api-key
SENDER_EMAIL=your-email@domain.com
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_CALLBACK_URL=https://codecrux1.onrender.com/api/auth/google/callback
PORT=4000
NODE_ENV=production

# Frontend Production (Vercel)
VITE_API_URL=https://codecrux1.onrender.com/api
VITE_GEMINI_API_KEY=your-production-gemini-key

๐Ÿ› ๏ธ Development Workflow

Code Quality Standards

  • ESLint Configuration: Consistent code formatting and error detection
  • Component Structure: Functional components with hooks pattern
  • Clean Architecture: Separation of concerns (controllers, models, routes)
  • Error Handling: Comprehensive try-catch blocks with user-friendly messages

Database Development

# Access MongoDB shell (if using local MongoDB)
mongo codecrux

# Useful queries for development
db.users.find().pretty()           # View all users
db.sheets.find().pretty()          # View all practice sheets  
db.tutorials.find().pretty()       # View all tutorials
db.users.findOne({email: "admin@example.com"}) # Find specific user

๐Ÿค Contributing

We welcome contributions! Please follow these steps:

  1. Fork the Repository
git clone https://github.com/your-username/CodeCrux.git
cd CodeCrux
  1. Create Feature Branch
git checkout -b feature/your-feature-name
# Examples: feature/admin-bulk-import, feature/progress-analytics
  1. Development Setup
npm run install:all    # Install dependencies
npm run dev:full       # Start both servers
  1. Make Changes & Test
  • Follow existing code patterns
  • Test both frontend and backend changes
  • Ensure admin functionality works
  • Verify AI chat integration
  1. Commit & Push
git add .
git commit -m "feat: add your feature description"
git push origin feature/your-feature-name
  1. Create Pull Request
  • Describe your changes clearly
  • Include screenshots if UI changes
  • Reference any related issues

Contribution Areas

  • ๐ŸŽจ UI/UX Improvements: Better responsive design, animations
  • ๐Ÿค– AI Features: Enhanced chat capabilities, smart recommendations
  • ๐Ÿ“Š Analytics: Advanced progress tracking, learning insights
  • ๐Ÿ”ง Admin Tools: Bulk operations, content moderation
  • ๐Ÿ“š Content: More DSA sheets, tutorial curation
  • ๐Ÿ› Bug Fixes: Performance optimizations, error handling

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

Ashutosh Maurya

๐ŸŽ‰ Acknowledgments & Credits

  • ๐Ÿค– Google Gemini AI - Powering the intelligent mentorship system
  • ๐Ÿ—„๏ธ MongoDB - Flexible document database for dynamic content
  • โš›๏ธ React Team - Amazing frontend library and ecosystem
  • โšก Vite - Lightning-fast development experience
  • ๐ŸŽจ Tailwind CSS - Beautiful utility-first styling
  • ๐Ÿš€ Open Source Community - Inspiration and continuous learning

๐Ÿ“ˆ Project Stats & Future Roadmap

Current Status: โœ… Production Ready

  • ๐ŸŽฏ 11 Pages - Complete user journey from auth to admin
  • ๐Ÿงฉ 14 Components - Reusable, optimized UI components
  • ๐Ÿ”— 19 API Endpoints - Full CRUD operations with security
  • ๐Ÿ“Š 3 Database Models - Efficient data relationships
  • ๐Ÿค– AI Integration - Real-time chat with conversation history

Upcoming Features (v2.0):

  • ๐Ÿ“ฑ Mobile App - React Native version
  • ๐ŸŽฎ Gamification - Points, badges, leaderboards
  • ๐Ÿ‘ฅ Community Features - Discussion forums, peer learning
  • ๐Ÿ“ˆ Advanced Analytics - Learning patterns, recommendations
  • ๐Ÿ”Œ API Integrations - LeetCode sync, GitHub portfolio
  • ๐ŸŽจ Themes - Custom color schemes, personalization

๐Ÿš€ Built with passion for the coding community

โญ Star this repo โ€ข ๐Ÿ› Report Issues โ€ข ๐Ÿ’ก Request Features โ€ข ๐Ÿ“– Documentation

Made with โค๏ธ in India ๐Ÿ‡ฎ๐Ÿ‡ณ

About

๐Ÿš€ CodeCrux - Comprehensive learning platform with curated tutorials, practice sheets & AI-powered mentorship. Built with React, Node.js & MongoDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages