Skip to content

Mridul-Dev123/StreamFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

StreamFlow - Full Stack Video Platform

A modern video streaming platform with React frontend and Node.js backend.

πŸš€ Project Structure

streamflow/
β”œβ”€β”€ Server/        # Backend (Node.js + Express + MongoDB)
β”œβ”€β”€ client/        # Frontend (React + Vite)
└── package.json   # Root configuration

πŸ“‹ Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local or cloud instance)
  • npm or yarn

⚑ Quick Start (Run Both)

The easiest way to run the application is from the root directory:

1. Install dependencies

# Install root dependencies
npm install

# Install backend dependencies
cd Server
npm install
cd ..

# Install frontend dependencies
cd client
npm install
cd ..

2. Configure Environment Variables

Make sure to set up the .env file in the Server/ directory as described in the Backend Setup section below.

3. Run the application

# Runs both backend and frontend concurrently
npm run dev

πŸ”§ Backend Setup (Manual)

1. Navigate to backend directory

cd Server

2. Install dependencies

npm install

3. Configure environment variables

Create 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_secret

4. Create public directory

mkdir public

5. Start the backend server

npm run dev

The backend will run on http://localhost:8000

🎨 Frontend Setup (Manual)

1. Navigate to frontend directory

cd client

2. Install dependencies

npm install

3. Start the development server

npm run dev

The frontend will run on http://localhost:5173

πŸ“± Features

Authentication

  • βœ… User registration with avatar & cover image upload
  • βœ… Login with email or username
  • βœ… JWT-based authentication
  • βœ… Automatic token refresh
  • βœ… Secure HTTP-only cookies

User Management

  • βœ… View and edit profile
  • βœ… Update avatar and cover image
  • βœ… Change password
  • βœ… User dashboard with statistics

Video Features

  • βœ… 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

Comments System

  • βœ… Add comments to videos
  • βœ… View all comments
  • βœ… Edit and delete own comments
  • βœ… Like comments
  • βœ… Real-time comment display

Subscription System

  • βœ… Subscribe/unsubscribe to channels
  • βœ… View subscriber count
  • βœ… View subscribed channels
  • βœ… Subscriber list

Playlists

  • βœ… Create and manage playlists
  • βœ… Add/remove videos from playlists
  • βœ… Edit playlist details
  • βœ… View user playlists

Social Features (Tweets)

  • βœ… Create text posts
  • βœ… Edit and delete tweets
  • βœ… Like tweets
  • βœ… View user feed

πŸ”„ Workflow Details

1. User Onboarding & Authentication

  • 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.

2. Video Management

  • Upload: Users can upload video files and thumbnails. The system automatically extracts metadata like duration.
  • Publishing Control: Videos have an isPublished toggle. Creators can draft videos and publish them when ready.
  • Dashboard: A personalized dashboard displays channel statistics including total views, total subcribers, and video performance.

3. Engagement & Community

  • 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.

UI/UX

  • βœ… Modern dark theme with gradient accents
  • βœ… Fully responsive design
  • βœ… Smooth animations and transitions
  • βœ… Glassmorphism effects
  • βœ… Protected routes

πŸ”‘ Key Technologies

Backend

  • Express.js - Web framework
  • MongoDB - Database
  • Mongoose - ODM
  • JWT - Authentication
  • Bcrypt - Password hashing
  • Cloudinary - Image hosting
  • Multer - File uploads

Frontend

  • React - UI library
  • Vite - Build tool
  • React Router - Navigation
  • Axios - HTTP client
  • Context API - State management

πŸ› Troubleshooting

CORS Errors

Make sure CORS_ORIGIN in backend .env matches your frontend URL:

CORS_ORIGIN=http://localhost:5173

MongoDB Connection

Verify your MONGODB_URI is correct and MongoDB is running.

Port Conflicts

If port 8000 or 5173 is in use, you can change them:

  • Backend: Update PORT in .env
  • Frontend: Update port in vite.config.js

πŸ“ API Endpoints

Authentication

  • POST /api/v1/users/register - Register new user
  • POST /api/v1/users/login - Login user
  • POST /api/v1/users/logout - Logout user
  • POST /api/v1/users/refresh-token - Refresh access token

User (Protected)

  • GET /api/v1/users/current-user - Get current user
  • PATCH /api/v1/users/update-account - Update profile
  • PATCH /api/v1/users/avatar - Update avatar
  • PATCH /api/v1/users/cover-image - Update cover image
  • POST /api/v1/users/change-password - Change password
  • GET /api/v1/users/c/:username - Get user channel profile
  • GET /api/v1/users/history - Get watch history

πŸ”’ Security Features

  • βœ… Password hashing with bcrypt
  • βœ… HTTP-only cookies for tokens
  • βœ… JWT token expiration
  • βœ… Automatic token refresh
  • βœ… Protected API routes
  • βœ… CORS configuration
  • βœ… Input validation

πŸ‘¨β€πŸ’» Author

Mridul Bansal

πŸ“„ License

ISC


Made with ❀️ using React and Node.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors