A full-featured video streaming platform built with the MERN stack, offering YouTube-like functionality with modern UI/UX design.
StreamSphere is a comprehensive video streaming platform that replicates core YouTube functionality. Built as a learning project to master full-stack development, it features secure authentication, video management, social interactions, and a responsive modern interface.
- Secure Registration/Login with JWT tokens
- Profile Management with avatar and cover image uploads
- Password Management with bcrypt encryption
- Refresh Token System for enhanced security
- Video Upload with Cloudinary integration
- Video Streaming with optimized playback
- Video Details with title, description, and thumbnails
- View Tracking and engagement metrics
- Video Search and discovery
- Channel Subscriptions with subscriber counts
- Commenting System on videos
- Like/Unlike videos, comments, and tweets
- Tweet System for channel updates
- User Channels with customizable profiles
- Custom Playlists creation and management
- Watch History tracking
- Watch Later functionality
- Liked Videos collection
- Responsive Design optimized for all devices
- Dark/Light Theme support
- ShadCN UI Components for consistent design
- Real-time Updates with Redux state management
React 19.1 // Modern UI library
Redux Toolkit // State management
React Router // Client-side routing
Tailwind CSS // Utility-first styling
ShadCN/UI // Pre-built components
Lucide React // Modern icons
React Hook Form // Form handling
Axios // HTTP client
Vite // Fast build toolNode.js // Runtime environment
Express.js // Web framework
MongoDB // NoSQL database
Mongoose // ODM for MongoDB
JWT // Authentication tokens
Bcrypt // Password hashing
Cloudinary // Media storage
Multer // File upload handling
CORS // Cross-origin requests📊 Collections:
├── Users // User profiles and authentication
├── Videos // Video metadata and files
├── Comments // Video comments
├── Likes // Like relationships
├── Subscriptions // Channel subscriptions
├── Playlists // User-created playlists
└── Tweets // Channel tweets/posts
- Node.js (v18 or higher)
- MongoDB (local installation or MongoDB Atlas)
- Cloudinary Account (for media storage)
- Git
-
Clone the repository
git clone https://github.com/PrabhjotSinghUbhi/StreamSphere.git cd StreamSphere -
Backend Setup
cd server npm install -
Frontend Setup
cd ../client npm install -
Environment Configuration
Create
.envin the server directory:PORT=8000 MONGODB_URI=mongodb://localhost:27017/StreamSphere CORS_ORIGIN=http://localhost:5173 # JWT Configuration ACCESS_TOKEN_SECRET=your_access_token_secret ACCESS_TOKEN_EXPIRY=1d REFRESH_TOKEN_SECRET=your_refresh_token_secret REFRESH_TOKEN_EXPIRY=10d # Cloudinary Configuration CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret
-
Start the Application
# Terminal 1 - Backend cd server npm run dev # Terminal 2 - Frontend cd client npm run dev
-
Access the Application
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:8000
- Frontend:
StreamSphere/
├── client/ # React frontend
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── Header/ # Navigation header
│ │ │ ├── Video/ # Video-related components
│ │ │ ├── Channel/ # Channel page components
│ │ │ ├── Playlist/ # Playlist management
│ │ │ └── ui/ # ShadCN UI components
│ │ ├── pages/ # Route components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API service functions
│ │ ├── slice/ # Redux state slices
│ │ └── utils/ # Utility functions
│ ├── package.json
│ └── vite.config.js
├── server/ # Express backend
│ ├── public/temp/ # Temporary file storage
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── models/ # Database schemas
│ │ ├── routes/ # API route definitions
│ │ ├── middlewares/ # Custom middleware
│ │ ├── utils/ # Utility functions
│ │ ├── db/ # Database connection
│ │ ├── app.js # Express app configuration
│ │ └── index.js # Server entry point
│ └── package.json
└── README.md
POST /api/v1/users/register- User registrationPOST /api/v1/users/login- User loginPOST /api/v1/users/logout- User logoutPOST /api/v1/users/refresh-token- Refresh access token
GET /api/v1/videos- Get all videosGET /api/v1/videos/:id- Get video by IDPOST /api/v1/videos- Upload new videoPATCH /api/v1/videos/:id- Update videoDELETE /api/v1/videos/:id- Delete video
GET /api/v1/playlists/get-user-playlist/:userID- Get user playlistsPOST /api/v1/playlists/create-playlist- Create playlistPOST /api/v1/playlists/add-video/:playlistId/:videoId- Add video to playlistDELETE /api/v1/playlists/remove-video/:playlistId/:videoId- Remove video
POST /api/v1/likes/video/:videoOwnerId/:videoId- Toggle video likePOST /api/v1/comments/:videoId- Add commentPOST /api/v1/subscribe/toggle/:channelId- Toggle subscription
- Secure Upload: Files are uploaded to Cloudinary with proper validation
- Metadata Storage: Title, description, thumbnails stored in MongoDB
- View Tracking: Automatic view count increment on video play
- Video Quality: Support for multiple video formats and qualities
- Infinite Scroll: Smooth video browsing experience
- Search Functionality: Real-time search across videos and channels
- Responsive Design: Optimized for desktop, tablet, and mobile
- Loading States: Skeleton loaders and progress indicators
- Lazy Loading: Components and images load on demand
- Code Splitting: Reduced initial bundle size
- API Optimization: Efficient database queries with aggregation
- Caching: Redux persist for state management
# Build the application
npm run build
# Deploy to Vercel
vercel --prod# Set environment variables in deployment platform
# Deploy using platform-specific methods# Run frontend tests
cd client
npm run test
# Run backend tests
cd server
npm run test- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow ESLint configuration for code consistency
- Write meaningful commit messages
- Add comments for complex logic
- Test features before submitting PRs
This project is licensed under the ISC License - see the LICENSE file for details.
Prabhjot Singh
- GitHub: @PrabhjotSinghUbhi
- LinkedIn: Prabhjot Singh
- Hitesh Choudhary - Backend development guidance
- Chai aur Code - Educational content and tutorials
- ShadCN - Beautiful UI components
- Cloudinary - Media storage and optimization
- MongoDB - Flexible database solution
- Vercel - Frontend deployment platform
- Render - Backend deployment platform
- Language: JavaScript
- Framework: React + Express.js
- Database: MongoDB atlas
- Authentication: JWT
- Storage: Cloudinary
- Styling: Tailwind CSS, Shadcn UI
- State Management: Redux Toolkit, React-Redux