A minimalistic YouTube clone built with React, TypeScript, Node.js, and Express. This application provides a clean, distraction-free way to browse and watch YouTube content using the YouTube Data API v3.
- π Google OAuth Authentication - Secure login with your Google account
- πΊ Latest Videos Feed - View latest videos from your subscribed channels
- π Subscriptions Management - Browse your YouTube subscriptions
- π₯ Video Playback - Watch videos with ReactPlayer integration
- π¨ Minimalistic UI - Clean, retro-styled interface using custom UI components
- π± Responsive Design - Works on desktop and mobile devices
- React 18 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- ReactPlayer for video playback
- Custom Retro UI Components
- Node.js with Express
- TypeScript for type safety
- Passport.js with Google OAuth 2.0
- YouTube Data API v3
- Session-based authentication
- CORS enabled for cross-origin requests
Alternative-Youtube/
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ retroui/
β β βββ pages/
β β β βββ Dashboard.tsx
β β βββ App.tsx
β β βββ main.tsx
β βββ package.json
β βββ vite.config.ts
βββ backend/
β βββ src/
β β βββ auth/
β β β βββ googleStrategy.ts
β β βββ routes/
β β β βββ authRoutes.ts
β β β βββ youtubeRoutes.ts
β β βββ services/
β β β βββ youtubeService.ts
β β βββ types/
β β β βββ index.ts
β β βββ index.ts
β βββ package.json
β βββ tsconfig.json
βββ README.md
- Node.js (v16 or higher)
- npm or yarn
- Google Cloud Console project with YouTube Data API v3 enabled
- Google OAuth 2.0 credentials
-
Clone the repository
git clone https://github.com/suryansh98/Alternative-Youtube.git cd Alternative-Youtube -
Setup Google OAuth Credentials
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable YouTube Data API v3
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/auth/google/callback
-
Backend Setup
cd backend npm installCreate
.envfile in backend directory:PORT=3000 NODE_ENV=development GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/callback SESSION_SECRET=your_long_random_secret_key FRONTEND_URL=http://localhost:5173
-
Frontend Setup
cd frontend npm install
-
Start the backend server
cd backend npm run devServer will run on
http://localhost:3000 -
Start the frontend development server
cd frontend npm run devFrontend will run on
http://localhost:5173 -
Access the application Open
http://localhost:5173in your browser
GET /auth/google- Initiate Google OAuth flowGET /auth/google/callback- Handle OAuth callbackGET /auth/status- Check authentication statusGET /auth/logout- Logout user
GET /api/youtube/channel- Get user's channel informationGET /api/youtube/subscriptions- Get user's subscriptionsGET /api/youtube/latest-videos- Get latest videos from subscribed channelsGET /api/youtube/playlists- Get user's playlistsGET /api/youtube/liked-videos- Get user's liked videosGET /api/youtube/search- Search for videosGET /api/youtube/video/:videoId- Get specific video details
- User clicks "Login with Google"
- Redirected to Google OAuth consent screen
- After authorization, redirected back to application
- Session created and user can access YouTube data
- Displays latest videos from user's subscribed channels
- Shows video thumbnails, titles, and channel information
- Click-to-play video functionality with ReactPlayer
- Responsive grid layout
- Clean navbar with tab-based navigation
- Home, Subscriptions, Liked Videos, and Playlists sections
- Logout functionality
Backend:
npm run dev- Start development server with nodemonnpm run build- Build TypeScript to JavaScriptnpm start- Run production servernpm run clean- Remove build directory
Frontend:
npm run dev- Start Vite development servernpm run build- Build for productionnpm run preview- Preview production build
| Variable | Description | Required |
|---|---|---|
GOOGLE_CLIENT_ID |
Google OAuth Client ID | Yes |
GOOGLE_CLIENT_SECRET |
Google OAuth Client Secret | Yes |
SESSION_SECRET |
Secret for session encryption | Yes |
PORT |
Backend server port | No (default: 3000) |
NODE_ENV |
Environment mode | No (default: development) |
FRONTEND_URL |
Frontend URL for CORS | No (default: http://localhost:5173) |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- YouTube Data API v3 for providing video data
- Google OAuth for secure authentication
- React and Node.js communities for excellent documentation
- All contributors who helped improve this project
-
"Failed to fetch" errors
- Ensure backend server is running on port 3000
- Check CORS configuration
- Verify environment variables
-
Authentication not working
- Check Google OAuth credentials
- Verify redirect URI in Google Console
- Ensure session secret is set
-
Videos not loading
- Verify YouTube Data API is enabled
- Check API quotas and limits
- Ensure proper video ID format
If you encounter any issues or have questions, please:
- Check the troubleshooting section above
- Search existing issues on GitHub
- Create a new issue with detailed description
Made with β€οΈ by Suryansh