Skip to content

anilveersingh1308/Online-Code-Learning-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ LearnCodeOnline

CodeLearnHub Banner

A comprehensive, interactive learning platform for aspiring developers

React FastAPI MongoDB TailwindCSS License

Live Demo โ€ข Documentation โ€ข Contributing โ€ข Report Bug


๐Ÿ“– About The Project

CodeLearnHub is a modern, full-stack educational platform designed to help developers learn programming through interactive tutorials, hands-on exercises, and real-world projects. The platform covers a wide range of topics from beginner-friendly programming fundamentals to advanced concepts in AI, data science, and software engineering.

โœจ Key Features

  • ๐ŸŽฏ Interactive Learning - Hands-on code examples with syntax highlighting and live execution
  • ๐Ÿ“š Comprehensive Documentation - 200+ articles covering 7 major technology categories
  • ๐Ÿ’ก Practice Exercises - 500+ coding exercises with hints, solutions, and test cases
  • ๐Ÿง  Knowledge Quizzes - Interactive quizzes to test your understanding
  • ๐Ÿ’ผ Interview Preparation - Curated interview questions for each topic
  • ๐ŸŒ™ Dark/Light Mode - Seamless theme switching for comfortable reading
  • ๐Ÿ” OAuth Authentication - Secure login with GitHub and Google
  • ๐Ÿ“Š Progress Tracking - Track your learning journey and achievements
  • ๐Ÿ”” Notifications - Stay updated with new content and activities
  • ๐Ÿ“ฑ Responsive Design - Beautiful UI on desktop, tablet, and mobile

๐Ÿ› ๏ธ Tech Stack

Frontend

Technology Purpose
React 19 UI Framework with latest features
React Router 7 Client-side routing
Tailwind CSS 3.4 Utility-first styling
Framer Motion Smooth animations
Radix UI Accessible component primitives
React Syntax Highlighter Code syntax highlighting
React Markdown Markdown rendering
Lucide React Beautiful icons
Sonner Toast notifications

Backend

Technology Purpose
FastAPI High-performance Python API
MongoDB Atlas Cloud database
Motor Async MongoDB driver
PyJWT JWT authentication
Authlib OAuth integration
Uvicorn ASGI server

๐Ÿ“ Project Structure

codelearn/
โ”œโ”€โ”€ ๐Ÿ“‚ backend/
โ”‚   โ”œโ”€โ”€ server.py              # Main FastAPI application
โ”‚   โ”œโ”€โ”€ article_generator.py   # Article template system
โ”‚   โ”œโ”€โ”€ seed_articles.py       # Comprehensive seed data
โ”‚   โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”‚   โ””โ”€โ”€ uploads/               # User uploads directory
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ frontend/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ public/
โ”‚   โ”‚   โ””โ”€โ”€ index.html         # HTML entry point
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ src/
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ArticleComponents.jsx  # Interactive article elements
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Navbar.jsx             # Navigation bar
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Footer.jsx             # Site footer
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ProtectedRoute.jsx     # Auth route wrapper
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“‚ ui/                 # Reusable UI components
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ button.jsx
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ card.jsx
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ dialog.jsx
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ ... (50+ components)
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ context/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AuthContext.jsx        # Authentication state
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ThemeContext.jsx       # Theme management
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ pages/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ HomePage.jsx           # Landing page
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DocumentationPage.jsx  # Docs hub
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DocArticlePage.jsx     # Article viewer
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DocCategoryPage.jsx    # Category listing
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ArticleAdminPage.jsx   # Admin dashboard
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CoursesPage.jsx        # Courses catalog
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ProjectsPage.jsx       # Project showcase
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ services/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ api.js                 # API client
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ hooks/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ use-toast.js           # Toast hook
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ lib/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ utils.js               # Utility functions
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ App.js                     # Main app component
โ”‚   โ”‚   โ”œโ”€โ”€ App.css                    # Global styles
โ”‚   โ”‚   โ””โ”€โ”€ index.js                   # React entry point
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ plugins/
โ”‚   โ”‚   โ”œโ”€โ”€ health-check/              # Health monitoring
โ”‚   โ”‚   โ””โ”€โ”€ visual-edits/              # Dev tools
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ”œโ”€โ”€ tailwind.config.js
โ”‚   โ”œโ”€โ”€ craco.config.js
โ”‚   โ””โ”€โ”€ components.json
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ tests/
โ”‚   โ””โ”€โ”€ __init__.py
โ”‚
โ”œโ”€โ”€ design_guidelines.json
โ””โ”€โ”€ README.md

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn
  • Python 3.10+
  • MongoDB Atlas account (or local MongoDB)
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/anilveersingh1308/codelearn.git
    cd codelearn
  2. Set up the Backend

    cd backend
    
    # Create virtual environment
    python -m venv venv
    
    # Activate virtual environment
    # Windows:
    .\venv\Scripts\activate
    # macOS/Linux:
    source venv/bin/activate
    
    # Install dependencies
    pip install -r requirements.txt
    
    # Create .env file
    cp .env.example .env
    # Edit .env with your MongoDB URI and OAuth credentials
  3. Set up the Frontend

    cd frontend
    
    # Install dependencies
    npm install
    
    # Create .env file (optional)
    cp .env.example .env.local
  4. Seed the Database

    cd backend
    
    # Start the server
    python -m uvicorn server:app --reload --port 8001
    
    # In another terminal, seed the articles
    curl -X POST http://localhost:8001/api/seed/articles
  5. Start Development Servers

    # Terminal 1 - Backend
    cd backend
    python -m uvicorn server:app --reload --port 8001
    
    # Terminal 2 - Frontend
    cd frontend
    npm start
  6. Access the Application


๐Ÿ”ง Environment Variables

Backend (.env)

# MongoDB
MONGO_URL=mongodb+srv://<username>:<password>@cluster.mongodb.net/
DB_NAME=codelearnhub

# JWT
JWT_SECRET=your-super-secret-key
JWT_ALGORITHM=HS256

# OAuth - GitHub
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret

# OAuth - Google
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# App
FRONTEND_URL=http://localhost:3000
BACKEND_URL=http://localhost:8001

Frontend (.env.local)

REACT_APP_API_URL=http://localhost:8001/api
REACT_APP_ENV=development

๐Ÿ“š Documentation

Learning Categories

Category Topics Description
๐Ÿ’ป Programming Languages Python, JavaScript, TypeScript, Java, C++ Core language fundamentals
๐ŸŒ Web Development React, Node.js, HTML/CSS, APIs Full-stack web technologies
๐Ÿ“ฑ Mobile Development React Native, Flutter Cross-platform mobile apps
๐Ÿ“Š Data Science & AI Pandas, NumPy, Machine Learning Data analysis and ML
๐Ÿค– AI & Prompt Engineering ChatGPT, LLMs, Prompt Design AI communication skills
๐Ÿงฎ Algorithms & DSA Big O, Arrays, Trees, Graphs Interview preparation
โš™๏ธ Software Engineering Git, Testing, System Design Professional practices
โ˜๏ธ Cloud & DevOps Docker, AWS, CI/CD Deployment and infrastructure

Article Structure

Each article includes:

  • ๐Ÿ“ Rich Content - Markdown with syntax highlighting
  • ๐Ÿ’ป Code Examples - Runnable code with explanations
  • ๐Ÿ‹๏ธ Practice Exercises - Hands-on challenges with solutions
  • โ“ Knowledge Quiz - Test your understanding
  • ๐Ÿ’ผ Interview Questions - Prepare for job interviews
  • ๐Ÿ”— External Resources - Curated learning materials

๐Ÿ”Œ API Reference

Authentication

Method Endpoint Description
GET /api/auth/github Initiate GitHub OAuth
GET /api/auth/google Initiate Google OAuth
GET /api/auth/callback/{provider} OAuth callback
GET /api/auth/me Get current user
POST /api/auth/logout Logout user

Documentation

Method Endpoint Description
GET /api/docs/articles List all articles
GET /api/docs/articles/{slug} Get article by slug
GET /api/docs/categories List all categories
GET /api/docs/categories/{slug}/articles Articles by category
GET /api/docs/search?q= Search articles
POST /api/docs/articles/{slug}/quiz/submit Submit quiz answers
POST /api/docs/articles/{slug}/helpful Submit feedback

Admin

Method Endpoint Description
POST /api/seed/articles Seed article database
GET /api/docs/stats Get documentation stats

๐ŸŽจ UI Components

Built with Radix UI primitives and styled with Tailwind CSS:

  • Accordion - Collapsible content sections
  • Alert Dialog - Confirmation modals
  • Avatar - User profile images
  • Badge - Status indicators
  • Button - Multiple variants and sizes
  • Card - Content containers
  • Carousel - Image/content sliders
  • Command - Command palette
  • Dialog - Modal dialogs
  • Dropdown Menu - Action menus
  • Form - Form validation with React Hook Form
  • Navigation Menu - Site navigation
  • Popover - Floating content
  • Progress - Progress indicators
  • Scroll Area - Custom scrollbars
  • Select - Dropdown selects
  • Skeleton - Loading placeholders
  • Slider - Range inputs
  • Switch - Toggle switches
  • Tabs - Tabbed interfaces
  • Toast - Notifications
  • Tooltip - Hover information
  • And many more...

๐Ÿงช Testing

# Run frontend tests
cd frontend
npm test

# Run backend tests
cd backend
pytest

๐Ÿ“ฆ Deployment

This project uses a split deployment approach:

  • Frontend โ†’ Vercel (free tier available)
  • Backend โ†’ Render (free tier available)

๐Ÿ”ท Step 1: Deploy Backend to Render

  1. Create a Render Account

    • Go to render.com and sign up
    • Connect your GitHub account
  2. Create a New Web Service

    • Click "New +" โ†’ "Web Service"
    • Connect your GitHub repository
    • Configure the service:
      Name: codelearnhub-backend
      Region: Oregon (US West)
      Branch: main
      Root Directory: backend
      Runtime: Python 3
      Build Command: pip install -r requirements.txt
      Start Command: uvicorn server:app --host 0.0.0.0 --port $PORT
      
  3. Add Environment Variables

    • In the Render dashboard, go to Environment tab
    • Add these variables:
    Variable Value
    MONGO_URL Your MongoDB Atlas connection string
    DB_NAME codelearnhub
    FRONTEND_URL https://your-app.vercel.app (update after Vercel deploy)
    CORS_ORIGINS https://your-app.vercel.app
    GITHUB_CLIENT_ID Your GitHub OAuth App Client ID
    GITHUB_CLIENT_SECRET Your GitHub OAuth App Secret
    GOOGLE_CLIENT_ID Your Google OAuth Client ID
    GOOGLE_CLIENT_SECRET Your Google OAuth Secret
  4. Deploy

    • Click "Create Web Service"
    • Wait for deployment (takes 2-5 minutes)
    • Note your backend URL: https://your-backend.onrender.com

๐Ÿ”ท Step 2: Deploy Frontend to Vercel

  1. Create a Vercel Account

    • Go to vercel.com and sign up
    • Connect your GitHub account
  2. Import Project

    • Click "Add New..." โ†’ "Project"
    • Select your GitHub repository
  3. Configure Project

    Framework Preset: Create React App
    Root Directory: frontend
    Build Command: npm run build (or yarn build)
    Output Directory: build
    Install Command: npm install (or yarn install)
    
  4. Add Environment Variables

    • In the project settings, go to Environment Variables
    • Add:
    Variable Value
    REACT_APP_BACKEND_URL https://your-backend.onrender.com
    REACT_APP_ENV production
  5. Deploy

    • Click "Deploy"
    • Wait for deployment (takes 1-2 minutes)
    • Your app is live at: https://your-app.vercel.app

๐Ÿ”ท Step 3: Update Backend CORS

After getting your Vercel URL:

  1. Go back to Render dashboard
  2. Update FRONTEND_URL and CORS_ORIGINS with your Vercel URL
  3. Redeploy the backend

๐Ÿ”ท Step 4: Configure OAuth Callbacks

GitHub OAuth:

  1. Go to GitHub Developer Settings
  2. Edit your OAuth App
  3. Update Authorization callback URL to:
    https://your-backend.onrender.com/api/auth/callback/github
    

Google OAuth:

  1. Go to Google Cloud Console
  2. Edit your OAuth 2.0 Client
  3. Add to Authorized redirect URIs:
    https://your-backend.onrender.com/api/auth/callback/google
    

๐Ÿ”ท Step 5: Seed the Database

After deployment, seed your database:

curl -X POST https://your-backend.onrender.com/api/seed/articles

Or visit: https://your-backend.onrender.com/docs and use the Swagger UI.


๐Ÿณ Alternative: Docker Deployment

# Build and run with Docker Compose
docker-compose up --build

๐Ÿ“‹ Deployment Checklist

  • MongoDB Atlas cluster created and IP whitelist configured (allow 0.0.0.0/0 for cloud services)
  • GitHub OAuth App created with correct callback URL
  • Google OAuth App created with correct redirect URI
  • Backend deployed to Render with all environment variables
  • Frontend deployed to Vercel with REACT_APP_BACKEND_URL set
  • Backend CORS updated with Vercel URL
  • Database seeded with initial articles
  • Test login with GitHub and Google
  • Test all major features

๐Ÿค 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 AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contribution Guidelines

  • Follow the existing code style
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation as needed
  • Be respectful and constructive

๐Ÿ“„ License

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


๐Ÿ‘ Acknowledgments


๐Ÿ“ž Contact

Anil Singh - @anilveersingh1308

Project Link: https://github.com/anilveersingh1308/codelearn


โญ Star this repo if you find it helpful! โญ

Made with โค๏ธ by the CodeLearnHub Team

About

A comprehensive full-stack online learning platform for developers - featuring 200+ interactive programming tutorials, 500+ coding exercises, AI-assisted learning, and real-time code execution across multiple languages and frameworks.

Resources

Stars

Watchers

Forks

Contributors