This code creates a fully functional Udemy clone with enhanced features, including a course content viewer and an AI assistant chatbot. The implementation uses HTML, CSS, and JavaScript to create a responsive educational platform that mimics Udemy's core functionality.
- Header Navigation: Includes logo, categories dropdown, search functionality, and user account options
- Hero Banner: Promotional section with call-to-action messaging
- Categories Navigation: Horizontal scrollable menu of course categories
- Course Grids: Multiple carousel sections featuring course cards
- Topic Tags: Interactive filtering options for popular topics
- Instructor Promotion: Section encouraging users to become instructors
- Trusted Companies: Logo display of partner organizations
- Footer: Site navigation, language selection, and copyright information
- Content Header: Course title and progress tracking
- Curriculum Sidebar: Collapsible menu of course sections and lessons
- Video Player: Main content area for video playback
- Navigation Controls: Previous/next buttons and progress tracking
- Chat Button: Fixed-position access button
- Chat Interface: Message history, typing indicator, and input controls
- API Integration: Connected to Groq API (LLaMA 3-70B model) for intelligent responses
The code uses CSS variables to maintain a consistent design system:
- Colors: Defined Udemy purple, dark, light, gray, and border colors
- Typography: Uses Roboto font family throughout the interface
- Component Styling: Consistent styling patterns for cards, buttons, and interactive elements
The layout adapts to different screen sizes through several media queries:
- Desktop (1200px+): Full layout with all features visible
- Tablet (992px-1200px): Adjusted grid layouts and content widths
- Mobile (768px and below): Simplified header, single-column layouts, and touch-friendly interfaces
- Carousel Navigation: Horizontally scrollable course lists with next/previous controls
- Page Switching: Toggle between homepage and course content viewer
- Sidebar Toggle: Collapsible curriculum menu for responsive layouts
- Video Playback: Controls for the video player within the course content page
- Lesson Navigation: System to track active lesson and navigate between lessons
- UI Interactions: Toggle chat window, send messages, and display responses
- API Integration: Sends user messages to Groq API for LLM-powered responses
- Typing Indicator: Visual feedback during response generation
- Fallback Responses: Default answers if API communication fails
The header remains fixed at the top of the viewport and contains the main navigation elements. It includes a responsive search bar that adjusts width based on screen size, and automatically hides less important elements on smaller screens.
Course cards display essential information including:
- Course thumbnail image
- Title (limited to two lines with ellipsis)
- Instructor name
- Rating information with star visualization
- Price information including discounts
- Bestseller badges where applicable
This page appears when a user clicks on a course card, transforming the interface into a learning environment:
- The sidebar contains a structured curriculum with collapsible sections
- Video player takes center focus with playback controls
- Navigation buttons allow moving between lessons
- Progress tracking is visible in the header and navigation area
The chatbot provides contextual help using LLaMA 3-70B through the Groq API:
- System prompt configures the assistant to provide course-related help
- User messages are displayed immediately with typing indicator feedback
- Responses from the AI are formatted to match the chatbot interface
- Error handling ensures the user experience remains smooth even if API calls fail
The implementation uses standard HTML5, CSS3, and ES6+ JavaScript features that are compatible with modern browsers. Features include:
- Flexbox and Grid for layout
- CSS transitions and animations
- Fetch API for network requests
- ES6 features (arrow functions, template literals, etc.)
- Image Optimization: Course thumbnails are sized appropriately for their display containers
- Lazy Loading: Only visible carousel elements are processed
- Event Delegation: Used to efficiently handle multiple similar elements
- Responsive Resources: Different image sizes load based on viewport dimensions
The implementation includes an API key for Groq in the frontend code. In a production environment, this should be moved to a backend service to prevent exposure of credentials. Additionally, user inputs should be sanitized before being sent to any external API.
- Implement user authentication and profile management
- Add course bookmarking and progress saving functionality
- Enhance video player with additional learning features (notes, bookmarks)
- Implement more robust error handling and offline capabilities
- Move API communication to a backend service for better security
This Udemy clone implementation provides a comprehensive learning platform with both content browsing and consumption features. The addition of an AI assistant enhances the user experience by providing contextual help. The code demonstrates effective use of modern web technologies to create a responsive, interactive educational interface.



