A YouTube-like video sharing platform built with Next.js, Firebase, and Tailwind CSS. VidStream allows users to upload, share, and discover videos with features like authentication, real-time comments, likes, and more.
- User Authentication - Google Sign-In with Firebase Auth
- Video Upload - Upload MP4, MOV, or WebM files up to 500MB
- Video Playback - Full-screen video player with controls
- Video Discovery - Home feed with filtering and search
- Engagement - Like/unlike videos and add comments
- User Profiles - Customizable profiles with video collections
- Responsive Design - Works on desktop, tablet, and mobile
- Dark/Light Mode - Toggle between themes
- Real-time Updates - Live comments and video stats
- Firebase Integration - Authentication, Firestore, Storage, Cloud Functions
- Thumbnail Generation - Automatic thumbnail creation using FFmpeg
- Progress Tracking - Upload progress bar and loading states
- Error Handling - Comprehensive error management and user feedback
- Performance - Optimized with Next.js App Router and image optimization
- Next.js 14 - React framework with App Router
- React 18 - UI library
- Tailwind CSS - Utility-first CSS framework
- TypeScript - Type safety
- Firebase Authentication - Google Sign-In
- Cloud Firestore - NoSQL database
- Cloud Storage - Video and thumbnail storage
- Cloud Functions - Thumbnail generation and cleanup
- react-firebase-hooks - Firebase hooks for React
- react-hot-toast - Toast notifications
- next-themes - Theme switching
- react-icons - Icon library
src/
βββ app/ # Next.js App Router pages
β βββ page.tsx # Home page with video feed
β βββ upload/page.tsx # Video upload page
β βββ watch/[id]/page.tsx # Video playback page
β βββ profile/[uid]/page.tsx # User profile page
βββ components/ # Reusable components
β βββ Navbar.tsx # Navigation header
β βββ Sidebar.tsx # Category sidebar
β βββ VideoCard.tsx # Video thumbnail card
β βββ ...
βββ hooks/ # Custom React hooks
β βββ useAuth.ts # Authentication hook
β βββ useVideo.ts # Video operations hook
βββ lib/ # Utility functions
β βββ firebase.ts # Firebase configuration
β βββ utils.ts # Helper functions
βββ styles/
βββ globals.css # Global styles
- Node.js 18+
- npm or yarn
- Firebase account
- Git
-
Clone the repository
git clone <repository-url> cd vidstream
-
Install dependencies
npm install
-
Set up Firebase
a. Create a new Firebase project at Firebase Console
b. Enable the following services:
- Authentication (Google Sign-In)
- Cloud Firestore
- Cloud Storage
- Cloud Functions
c. Copy the Firebase configuration and create
.env.localfile:cp .env.local.example .env.local
Add your Firebase configuration to
.env.local:NEXT_PUBLIC_FIREBASE_API_KEY=your-api-key NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-auth-domain NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-storage-bucket NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id NEXT_PUBLIC_FIREBASE_APP_ID=your-app-id
-
Set up Firebase CLI (for Cloud Functions)
npm install -g firebase-tools firebase login firebase init
-
Deploy Cloud Functions
cd functions npm install cd .. firebase deploy --only functions
-
Run the development server
npm run dev
Open http://localhost:3000 with your browser to see the result.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users can read all documents
match /{document=**} {
allow read: if true;
}
// Users can only write their own data
match /users/{userId} {
allow write: if request.auth != null && request.auth.uid == userId;
}
// Users can create videos and update their own
match /videos/{videoId} {
allow create: if request.auth != null;
allow update: if request.auth != null && request.auth.uid == resource.data.userId;
allow delete: if request.auth != null && request.auth.uid == resource.data.userId;
}
// Users can add comments
match /videos/{videoId}/comments/{commentId} {
allow create: if request.auth != null;
allow delete: if request.auth != null && request.auth.uid == resource.data.userId;
}
}
}rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
// Allow read access to all files
match /{allPaths=**} {
allow read: if true;
}
// Allow users to upload videos to their own folder
match /videos/{userId}/{videoId} {
allow write: if request.auth != null && request.auth.uid == userId
&& request.resource.size < 500 * 1024 * 1024 // 500MB limit
&& request.resource.contentType.matches('video/.*');
}
// Allow users to upload thumbnails
match /thumbnails/{videoId} {
allow write: if request.auth != null;
}
}
}-
Install Vercel CLI
npm install -g vercel
-
Deploy
vercel --prod
-
Set environment variables in Vercel dashboard
-
Build the project
npm run build
-
Deploy to Firebase
firebase deploy --only hosting
- Sign In - Click "Sign In" and use your Google account
- Upload Videos - Click "Upload" to share your content
- Browse Videos - Use the sidebar to filter by category
- Engage - Like videos and leave comments
- Manage Profile - Click your avatar to edit your profile
- Authentication - Uses Firebase Auth with Google Sign-In
- Database - Firestore stores user and video metadata
- Storage - Firebase Storage handles video and thumbnail files
- Functions - Cloud Functions process thumbnails and cleanup
- Real-time - Firestore listeners provide live updates
- Authentication Required - Users must sign in to upload, like, or comment
- File Validation - Server-side validation of file types and sizes
- Rate Limiting - Implement rate limiting for uploads and comments
- Content Moderation - Add moderation features for reported content
- HTTPS Only - All communications use secure connections
- Modify
tailwind.config.jsfor custom colors and themes - Update
src/styles/globals.cssfor global styles - Components use Tailwind CSS classes for styling
- Add new categories in
src/components/Sidebar.tsx - Extend video metadata in
src/hooks/useVideo.ts - Add new engagement features (subscriptions, playlists, etc.)
- 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 licensed under the MIT License - see the LICENSE file for details.
- Documentation - Check this README and inline code comments
- Issues - Report bugs and request features on GitHub
- Firebase Docs - Firebase Documentation
- Next.js Docs - Next.js Documentation
- Firebase Team - For the amazing backend services
- Next.js Team - For the powerful React framework
- Tailwind CSS - For the utility-first CSS framework
- Community - For all the open-source contributions
Built with β€οΈ by the VidStream Team