A modern video streaming platform with React frontend and Node.js backend.
streamflow/
βββ Server/ # Backend (Node.js + Express + MongoDB)
βββ client/ # Frontend (React + Vite)
βββ package.json # Root configuration
- Node.js (v16 or higher)
- MongoDB (local or cloud instance)
- npm or yarn
The easiest way to run the application is from the root directory:
# Install root dependencies
npm install
# Install backend dependencies
cd Server
npm install
cd ..
# Install frontend dependencies
cd client
npm install
cd ..Make sure to set up the .env file in the Server/ directory as described in the Backend Setup section below.
# Runs both backend and frontend concurrently
npm run devcd Servernpm installCreate a .env file in the Server/ directory with the following variables:
PORT=8000
MONGODB_URI=your_mongodb_connection_string
CORS_ORIGIN=http://localhost:5173
ACCESS_TOKEN_SECRET=your_access_token_secret
ACCESS_TOKEN_EXPIRY=1d
REFRESH_TOKEN_SECRET=your_refresh_token_secret
REFRESH_TOKEN_EXPIRY=10d
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secretmkdir publicnpm run devThe backend will run on http://localhost:8000
cd clientnpm installnpm run devThe frontend will run on http://localhost:5173
- β User registration with avatar & cover image upload
- β Login with email or username
- β JWT-based authentication
- β Automatic token refresh
- β Secure HTTP-only cookies
- β View and edit profile
- β Update avatar and cover image
- β Change password
- β User dashboard with statistics
- β Upload videos with thumbnails
- β Browse all videos with pagination
- β Search videos
- β Watch videos with custom player
- β Like/unlike videos
- β Edit and delete own videos
- β Toggle publish status
- β View count tracking
- β Add comments to videos
- β View all comments
- β Edit and delete own comments
- β Like comments
- β Real-time comment display
- β Subscribe/unsubscribe to channels
- β View subscriber count
- β View subscribed channels
- β Subscriber list
- β Create and manage playlists
- β Add/remove videos from playlists
- β Edit playlist details
- β View user playlists
- β Create text posts
- β Edit and delete tweets
- β Like tweets
- β View user feed
- Registration: Users sign up with email and username. During registration, they must upload an avatar and optional cover image (stored via Cloudinary).
- Security: Passwords are hashed using bcrypt. Access tokens (short-lived) and refresh tokens (long-lived) are managed via HTTP-Only cookies to prevent XSS attacks.
- Upload: Users can upload video files and thumbnails. The system automatically extracts metadata like duration.
- Publishing Control: Videos have an
isPublishedtoggle. Creators can draft videos and publish them when ready. - Dashboard: A personalized dashboard displays channel statistics including total views, total subcribers, and video performance.
- Interactions: Every video supports likes and nested comments.
- Subscriptions: Users can subscribe to channels to see their content in a dedicated feed.
- Tweets: A community tab feature allowing creators to post text updates (Tweets) to interact with their audience without uploading video content.
- History: The platform tracks watch history, allowing users to resume or revisit content.
- β Modern dark theme with gradient accents
- β Fully responsive design
- β Smooth animations and transitions
- β Glassmorphism effects
- β Protected routes
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM
- JWT - Authentication
- Bcrypt - Password hashing
- Cloudinary - Image hosting
- Multer - File uploads
- React - UI library
- Vite - Build tool
- React Router - Navigation
- Axios - HTTP client
- Context API - State management
Make sure CORS_ORIGIN in backend .env matches your frontend URL:
CORS_ORIGIN=http://localhost:5173Verify your MONGODB_URI is correct and MongoDB is running.
If port 8000 or 5173 is in use, you can change them:
- Backend: Update
PORTin.env - Frontend: Update port in
vite.config.js
POST /api/v1/users/register- Register new userPOST /api/v1/users/login- Login userPOST /api/v1/users/logout- Logout userPOST /api/v1/users/refresh-token- Refresh access token
GET /api/v1/users/current-user- Get current userPATCH /api/v1/users/update-account- Update profilePATCH /api/v1/users/avatar- Update avatarPATCH /api/v1/users/cover-image- Update cover imagePOST /api/v1/users/change-password- Change passwordGET /api/v1/users/c/:username- Get user channel profileGET /api/v1/users/history- Get watch history
- β Password hashing with bcrypt
- β HTTP-only cookies for tokens
- β JWT token expiration
- β Automatic token refresh
- β Protected API routes
- β CORS configuration
- β Input validation
Mridul Bansal
ISC
Made with β€οΈ using React and Node.js