Skip to content

YoavSl/Streamix

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

177 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Streamix - Netflix-like Streaming Platform

A full-stack web application built with Node.js, Express, and MongoDB that simulates a streaming platform with user authentication, profiles, video catalog, recommendations, and analytics.

πŸ“‹ Table of Contents

Features

User Management

  • Secure user registration and login with bcrypt password hashing
  • Session management with MongoDB session store
  • Role-based access control (admin/user)
  • Multiple profiles per user account (up to 5)

Content Catalog

  • Browse movies and TV series
  • Dynamic genre-based navigation
  • Search functionality across all content
  • Advanced sorting (by name, popularity, rating)
  • "Continue Watching" section with progress tracking
  • "Most Popular" section based on likes
  • Episode-level tracking for series

Personalization

  • Intelligent recommendation system based on:
    • Liked content genres
    • Watch history
    • Content ratings
  • Like/unlike content functionality
  • Personalized recommendations per profile

Admin Features

  • Add new content (movies/series) with OMDb API integration
  • View analytics dashboard with charts
  • User and content management

Video Playback

  • Custom HTML5 video player
  • Resume playback from last position
  • Episode navigation for series
  • Progress tracking

Prerequisites

Before running this application, ensure you have the following installed:

  • Node.js (v14 or higher)
  • MongoDB (v4.4 or higher)
  • npm (comes with Node.js)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd IntroToWebDevColman
  2. Navigate to the project directory

    cd finalProject
  3. Install dependencies

    npm install
  4. Set up environment variables

    # Copy the example environment file
    cp .env.example .env
    
    # Edit .env and configure your settings (see Configuration section below)

Configuration

Create a .env file in the finalProject directory with the following variables:

# MongoDB Connection (required)
MONGODB_URI=mongodb://127.0.0.1:27017/streamix

# Session Secret (required) - Generate a secure random string
SESSION_SECRET=your-secure-secret-here-please-change-this

# Server Configuration
PORT=5555
NODE_ENV=development

# Content Pagination
ITEMS_PER_PAGE=10

# OMDb API Key (for fetching IMDb ratings)
OMDB_API_KEY=

Important:

  • Change SESSION_SECRET to a secure random string
  • You can generate one with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Running the Application

Step 1: Start MongoDB

Ensure MongoDB is running on your system:

Windows:

# If MongoDB is installed as a service, it should start automatically
# Or manually start it:
mongod

macOS/Linux:

# If installed via homebrew:
brew services start mongodb-community

# Or manually:
mongod --config /usr/local/etc/mongod.conf

Step 2: Seed the Database

Populate the database with sample data (users, profiles, movies, series):

npm run seed

This creates:

  • 1 admin user: admin@streamix.local / admin123
  • 3 regular users with multiple profiles
  • ~20 series with multiple episodes each
  • ~15 movies
  • Sample likes and ratings

Note: Run npm run seed:reset to clear existing data first.

Step 3: Start the Application

npm start

The server will start at http://localhost:5555

Testing Credentials

After seeding the database, use these credentials to log in:

Admin Account

  • Email: admin@streamix.local
  • Password: admin123
  • Features: Full access including analytics and content management

Regular Users

  • Email: alice@example.com / Password: alice123
  • Email: bob@example.com / Password: bob123
  • Email: charlie@example.com / Password: charlie123

Each user has multiple profiles to test the multi-profile feature.

Project Structure

finalProject/
β”œβ”€β”€ application.js              # Main Express server
β”œβ”€β”€ package.json               # Dependencies and scripts
β”œβ”€β”€ .env.example              # Environment variables template
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ controllers/          # Request handlers
β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”œβ”€β”€ catalogController.js
β”‚   β”‚   β”œβ”€β”€ profileController.js
β”‚   β”‚   β”œβ”€β”€ likeController.js
β”‚   β”‚   β”œβ”€β”€ recommendationController.js
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ models/              # Mongoose schemas
β”‚   β”‚   β”œβ”€β”€ userModel.js
β”‚   β”‚   β”œβ”€β”€ profileModel.js
β”‚   β”‚   β”œβ”€β”€ catalogModel.js
β”‚   β”‚   β”œβ”€β”€ viewingSessionModel.js
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ routes/              # Express routes
β”‚   β”‚   β”œβ”€β”€ authRoutes.js
β”‚   β”‚   β”œβ”€β”€ catalogRoutes.js
β”‚   β”‚   β”œβ”€β”€ analyticsRoutes.js
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ middleware/          # Custom middleware
β”‚   β”‚   β”œβ”€β”€ authMiddleware.js
β”‚   β”‚   └── logger.js
β”‚   β”œβ”€β”€ views/              # EJS templates
β”‚   β”‚   β”œβ”€β”€ catalog.ejs
β”‚   β”‚   β”œβ”€β”€ login.ejs
β”‚   β”‚   β”œβ”€β”€ item.ejs
β”‚   β”‚   β”œβ”€β”€ analytics.ejs
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   β”‚   β”œβ”€β”€ catalog/
β”‚   β”‚   β”‚   β”œβ”€β”€ app.js
β”‚   β”‚   β”‚   └── styles.css
β”‚   β”‚   └── images/
β”‚   └── utils/            # Utility scripts
β”‚       β”œβ”€β”€ populateDB.js
β”‚       β”œβ”€β”€ validators.js
β”‚       └── ...
└── storage/             # Video storage directory

Additional Information

Database Scripts

Seed Database:

npm run seed              # Populate with sample data
npm run seed:reset        # Clear and repopulate

Migration Scripts:

node src/utils/migratePasswords.js    # Migrate plain passwords to bcrypt
node src/utils/migrateRoles.js        # Set user roles
node src/utils/migrateRatings.js      # Calculate ratings from likes

Development

npm run dev               # Start development server
npm start                 # Start production server

πŸ“ Credits


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 61.0%
  • EJS 18.9%
  • CSS 16.4%
  • HTML 3.7%