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.
- Features
- Prerequisites
- Installation
- Configuration
- Running the Application
- Testing Credentials
- Project Structure
- Additional Information
- 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)
- 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
- Intelligent recommendation system based on:
- Liked content genres
- Watch history
- Content ratings
- Like/unlike content functionality
- Personalized recommendations per profile
- Add new content (movies/series) with OMDb API integration
- View analytics dashboard with charts
- User and content management
- Custom HTML5 video player
- Resume playback from last position
- Episode navigation for series
- Progress tracking
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)
-
Clone the repository
git clone <repository-url> cd IntroToWebDevColman
-
Navigate to the project directory
cd finalProject -
Install dependencies
npm install
-
Set up environment variables
# Copy the example environment file cp .env.example .env # Edit .env and configure your settings (see Configuration section below)
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_SECRETto a secure random string - You can generate one with:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
Ensure MongoDB is running on your system:
Windows:
# If MongoDB is installed as a service, it should start automatically
# Or manually start it:
mongodmacOS/Linux:
# If installed via homebrew:
brew services start mongodb-community
# Or manually:
mongod --config /usr/local/etc/mongod.confPopulate the database with sample data (users, profiles, movies, series):
npm run seedThis 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.
npm startThe server will start at http://localhost:5555
After seeding the database, use these credentials to log in:
- Email:
admin@streamix.local - Password:
admin123 - Features: Full access including analytics and content management
- 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.
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
Seed Database:
npm run seed # Populate with sample data
npm run seed:reset # Clear and repopulateMigration 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 likesnpm run dev # Start development server
npm start # Start production server- Background Image: Unsplash
- Icons: Bootstrap Icons
- Placeholder Images: Picsum Photos