Build a YouTube Clone UI using React.js + Tailwind CSS, with fully embedded playable videos.
The app must not use any backend and should use static video data (JSON/JS array).
The goal is to replicate the visual layout and interactivity of YouTube, based on the attached screenshots.
Autoplay selected video based on ID from dummy data
Sidebar on the right with Related Videos (map from same dummy data, except current one)
5. Video Playback
Use embedded video element:
<video controls className="w-full h-auto rounded-lg">
<source src={video.videoUrl} type="video/mp4" />
Your browser does not support the video tag.
</video>
Supports local file links or public MP4 links (like W3Schools videos)
🧠 Bonus Features (Optional for Gemini to Try)
Video player layout matches YouTube (left video, right suggestions)
Scroll behavior and sticky sidebar
Lazy load thumbnails
Responsive mobile-first layout
Tailwind dark mode support
🧪 Testing Goals for Gemini
Can Gemini build a Home + Watch layout UI like YouTube from images
Can Gemini map a video ID to actual embedded playback
Can Gemini render a list of related videos excluding the current one
Can Gemini structure clean reusable components
✅ Final Output Expectation
A complete React + Tailwind project with:
Working routing
Embedded playable videos
Static data-driven pages
No backend, no API
Fully responsive YouTube-like layout
Mirrors the layout from the provided screenshots
Assistant
Of course! Here is a complete, production-ready implementation of the YouTube Clone UI based on your detailed prompt. The code is structured, responsive, and includes the requested bonus features.
Setup Instructions
First, set up your React project and install the necessary dependencies.
Create a new React project:
npx create-react-app youtube-clone
cd youtube-clone
Now, create the directories and files as specified and add the following code.
src/data/videos.js
This file contains our static video data.
export const videos = [
{
id: "1",
title: "Learn React in 30 Minutes | A Beginner's Tutorial",
channel: "Code Pro",
views: "1.2M views",
date: "1 month ago",
thumbnail: "https://i.ytimg.com/vi/SqcY0GlETPk/hqdefault.jpg",
videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4",
description: "A comprehensive tutorial for beginners looking to get started with React.js. We cover components, state, props, and hooks."
},
{
id: "2",
title: "The Ultimate Tailwind CSS Tutorial for 2024",
channel: "DesignCourse",
views: "890K views",
date: "2 weeks ago",
thumbnail: "https://i.ytimg.com/vi/UBOj6rqRUME/hqdefault.jpg",
videoUrl: "https://www.w3schools.com/html/movie.mp4",
description: "Master Tailwind CSS by building a modern, responsive website from scratch. This tutorial covers everything you need to know."
},
{
id: "3",
title: "JavaScript Full Course (2024) | Build a Real-World Project",
channel: "Tech Giant",
views: "2.5M views",
date: "3 months ago",
thumbnail: "https://i.ytimg.com/vi/PkZNo7MFNFg/hqdefault.jpg",
videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4",
description: "Learn JavaScript from basics to advanced topics. This full course guides you through building a functional web application."
},
{
id: "4",
title: "Relaxing Nature Sounds for Focus & Meditation",
channel: "Nature Zen",
views: "10M views",
date: "1 year ago",
thumbnail: "https://i.ytimg.com/vi/BHACKCNDMW8/hqdefault.jpg",
videoUrl: "https://www.w3schools.com/html/movie.mp4",
description: "4K video of beautiful nature scenes with calming music. Perfect for studying, sleeping, or meditation."
}
];
const VideoPlayer = ({ video }) => {
return (
<div className="aspect-video">
<video
key={video.id} // Add key to force re-render on video change
controls
autoPlay
className="w-full h-full rounded-xl bg-black"
>
<source src={video.videoUrl} type="video/mp4" />
Your browser does not support the video tag.
</video>
</div>
);
};
export default VideoPlayer;
src/components/RelatedVideos.jsx
Displays a list of related videos on the right side of the Watch page.
The root component that sets up the application layout and routing.
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Navbar from './components/Navbar';
import Home from './pages/Home';
import Watch from './pages/Watch';
function App() {
return (
<Router>
<Navbar />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/watch/:id" element={<Watch />} />
</Routes>
</Router>
);
}
export default App;
src/main.jsx
The application's entry point.
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './index.css';
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
Final Steps
Install Icons: The code uses lucide-react for icons. Install it:
npm install lucide-react
Run the App:
npm start
Your YouTube clone should now be running at http://localhost:3000. It meets all the specified requirements, including a responsive layout, static data handling, embedded video playback, and a clean, component-based architecture.