Skip to content

This is a fully open-source advanced Sub4Sub Web Application made with PHP and MySQL database by Hiranmay Roy and Sameer Pathak.

Notifications You must be signed in to change notification settings

cold-cofffeee/Sub4Sub-Web-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SUB4SUB v2.0

YouTube Channel Growth Platform - A modern web application helping creators grow their channels through subscription exchanges

Node.js MongoDB Express License


πŸ“– What is SUB4SUB?

SUB4SUB is a creator growth platform that enables YouTube channel owners to organically grow their audience by exchanging subscriptions with other creators. Built with modern technologies and a YouTube-inspired design aesthetic, it provides a secure, scalable, and user-friendly environment for channel growth.

Core Concept

The Exchange Model:

  1. Creators register and link their YouTube channels
  2. Browse other creators in the exchange pool
  3. Subscribe to channels you're genuinely interested in
  4. Earn credits when others subscribe to your channel
  5. Track growth through comprehensive analytics

This creates a mutual benefit ecosystem where all creators can grow together while discovering quality content.


✨ Key Features

For Creators (Users)

Growth Tools:

  • 🎯 Smart Channel Exchange - Browse and subscribe to relevant channels
  • πŸ“Š Real-time Analytics - Track subscribers, views, and engagement
  • βœ… Subscription Verification - Automated verification system
  • πŸ† Credit System - Earn credits for subscriptions, spend on growth
  • πŸ“ˆ Growth Statistics - Historical data and trend analysis
  • πŸ”” Notifications - Stay updated on new subscribers and activity

Premium Features:

  • ⚑ Priority Placement - Higher visibility in exchange pool
  • 🎁 Bonus Credits - Extra credits for faster growth
  • πŸ“ž Priority Support - Faster response times
  • πŸ”“ Unlock Advanced Features - Enhanced analytics, custom filtering

For Administrators

Management Dashboard:

  • πŸ‘₯ User Management - View, ban, verify, grant premium access
  • πŸ” Subscription Verification - Manual review and approval system
  • πŸ’³ Payment Tracking - Monitor all transactions
  • πŸ“ Content Management - Edit site pages (About, FAQ, Privacy, etc.)
  • βš™οΈ System Settings - Configure credits, pricing, features
  • πŸ“Š Platform Analytics - User growth, engagement metrics

Technical Features

Security & Performance:

  • πŸ” Password hashing with bcrypt (10 rounds)
  • πŸ›‘οΈ CSRF protection on all forms
  • 🚦 Rate limiting on APIs (100 req/15min)
  • πŸ”’ Secure HTTP headers (Helmet.js)
  • βœ… Input validation and sanitization
  • πŸ“§ Email verification (optional)
  • πŸ’Ύ Session persistence with MongoDB

Modern Architecture:

  • πŸš€ RESTful API design
  • πŸ“± Mobile-responsive UI (Bootstrap 5)
  • ⚑ Fast database queries (indexed)
  • 🎨 Modern design system (YouTube-inspired)
  • 🌐 SEO-friendly routing
  • πŸ“Š Comprehensive error handling

πŸš€ Quick Start

Prerequisites

  • Node.js 16+ installed
  • MongoDB 5.0+ running
  • Basic command line knowledge

5-Minute Setup

# 1. Install dependencies
npm install

# 2. Create environment file
cp .env.example .env

# 3. Initialize database
npm run migrate

# 4. Generate view templates
node scripts/generate-views.js

# 5. Start the server
npm run dev

That's it! Visit http://localhost:3000

Default Admin Login:

  • Email: admin@sub4sub.com
  • Password: admin123

πŸ“š Need detailed setup instructions? See SETUP.md
🎨 Want to understand the design? See DESIGN.md


�️ Architecture Overview

Technology Stack

Backend:

  • Runtime: Node.js 16+ (JavaScript ES6+, async/await)
  • Framework: Express.js 4.x (Middleware-based architecture)
  • Database: MongoDB 5.0+ (NoSQL document database)
  • ODM: Mongoose 8.x (Schema validation, relationships)

Frontend:

  • Templating: EJS (Server-side rendering)
  • UI Framework: Bootstrap 5.3.0 (Responsive grid system)
  • Icons: Font Awesome 6.4.0 (1500+ icons)
  • Fonts: Google Fonts (Inter, Poppins)
  • Rich Text: Quill.js 1.3.6 (Free, no API key)

Security:

  • Authentication: bcryptjs (Password hashing)
  • Sessions: express-session + connect-mongo
  • HTTP Security: Helmet.js (Secure headers)
  • Rate Limiting: express-rate-limit (DoS protection)
  • Input Validation: express-validator
  • CSRF Protection: csurf

Optional Services:

  • Email: Nodemailer (SMTP)
  • Payments: Stripe, PayPal
  • File Upload: Multer

Database Schema

Core Collections:

// Users Collection
{
  _id: ObjectId,
  email: String (unique, indexed),
  username: String (unique, indexed),
  password: String (hashed),
  youtubeChannel: String,
  credits: Number (default: 10),
  isPremium: Boolean,
  isAdmin: Boolean,
  isBanned: Boolean,
  isVerified: Boolean,
  subscriptionCount: Number,
  createdAt: Date
}

// Subscriptions Collection
{
  _id: ObjectId,
  userId: ObjectId (ref: User),
  targetUserId: ObjectId (ref: User),
  status: String (pending|verified|rejected),
  verificationScreenshot: String,
  createdAt: Date,
  verifiedAt: Date
}

// Payments Collection
{
  _id: ObjectId,
  userId: ObjectId (ref: User),
  amount: Number,
  credits: Number,
  paymentMethod: String (stripe|paypal),
  transactionId: String,
  status: String (completed|pending|failed),
  createdAt: Date
}

// Notifications Collection
{
  _id: ObjectId,
  userId: ObjectId (ref: User),
  message: String,
  type: String (info|success|warning|error),
  isRead: Boolean,
  createdAt: Date
}

// Content Collection (Static Pages)
{
  _id: ObjectId,
  page: String (about|faq|privacy|tos|contact),
  title: String,
  content: String (HTML),
  updatedAt: Date
}

Routing Architecture

Route Hierarchy:

server.js (Entry Point)
β”‚
β”œβ”€β”€ /                           β†’ routes/main.js (Public pages)
β”‚   β”œβ”€β”€ GET /                   β†’ Landing page
β”‚   β”œβ”€β”€ GET /about              β†’ About page
β”‚   β”œβ”€β”€ GET /faq                β†’ FAQ page
β”‚   β”œβ”€β”€ GET /contact            β†’ Contact page
β”‚   β”œβ”€β”€ GET /privacy            β†’ Privacy policy
β”‚   └── GET /tos                β†’ Terms of service
β”‚
β”œβ”€β”€ /auth                       β†’ routes/auth.js (Authentication)
β”‚   β”œβ”€β”€ GET  /auth/login        β†’ Login form
β”‚   β”œβ”€β”€ POST /auth/login        β†’ Process login
β”‚   β”œβ”€β”€ GET  /auth/register     β†’ Registration form
β”‚   β”œβ”€β”€ POST /auth/register     β†’ Process registration
β”‚   β”œβ”€β”€ GET  /auth/logout       β†’ Logout
β”‚   └── GET  /auth/verify/:token β†’ Email verification
β”‚
β”œβ”€β”€ /account                    β†’ routes/main.js (User dashboard)
β”‚   β”œβ”€β”€ GET  /account           β†’ User dashboard
β”‚   β”œβ”€β”€ GET  /exchange          β†’ Subscription exchange
β”‚   β”œβ”€β”€ GET  /analytics         β†’ Growth analytics
β”‚   β”œβ”€β”€ GET  /notification      β†’ Notifications
β”‚   β”œβ”€β”€ GET  /purchase          β†’ Premium purchase
β”‚   └── POST /purchase-success  β†’ Payment callback
β”‚
β”œβ”€β”€ /admin                      β†’ routes/admin.js (Admin panel)
β”‚   β”œβ”€β”€ GET  /admin/dashboard   β†’ Admin dashboard
β”‚   β”œβ”€β”€ GET  /admin/users       β†’ User management
β”‚   β”œβ”€β”€ POST /admin/users/:id/ban β†’ Ban/unban user
β”‚   β”œβ”€β”€ POST /admin/users/:id/premium β†’ Toggle premium
β”‚   β”œβ”€β”€ GET  /admin/verify-users β†’ Subscription verification
β”‚   β”œβ”€β”€ POST /admin/verify/:id  β†’ Approve subscription
β”‚   β”œβ”€β”€ GET  /admin/payments    β†’ Payment history
β”‚   β”œβ”€β”€ GET  /admin/content-management β†’ Content editor
β”‚   β”œβ”€β”€ POST /admin/content/:page β†’ Update page content
β”‚   └── GET  /admin/settings    β†’ System settings
β”‚
└── /api                        β†’ routes/api.js (REST API)
    β”œβ”€β”€ GET  /api/              β†’ API documentation
    β”œβ”€β”€ GET  /api/user          β†’ Current user data
    β”œβ”€β”€ GET  /api/users         β†’ All users (admin)
    β”œβ”€β”€ GET  /api/subscriptions β†’ User subscriptions
    β”œβ”€β”€ GET  /api/notifications β†’ User notifications
    └── GET  /api/stats         β†’ Platform statistics

Middleware Pipeline

Request Flow:

HTTP Request
    ↓
[1] helmet (Security headers)
    ↓
[2] compression (Gzip compression)
    ↓
[3] express.json() (Parse JSON)
    ↓
[4] express.urlencoded() (Parse forms)
    ↓
[5] express-session (Session management)
    ↓
[6] csrf (CSRF protection)
    ↓
[7] morgan (Request logging)
    ↓
[8] custom middleware (User context)
    ↓
[9] Route handler
    ↓
[10] errorHandler (Error handling)
    ↓
HTTP Response

Security Layer

Multi-Level Protection:

  1. Password Security

    • bcrypt hashing (10 rounds)
    • Salt generated per password
    • Comparison timing-safe
  2. Session Security

    • HTTP-only cookies
    • Secure flag in production
    • SameSite: strict
    • 14-day expiration
  3. Input Validation

    // Example validation
    body('email').isEmail().normalizeEmail(),
    body('password').isLength({ min: 8 }),
    body('username').matches(/^[a-zA-Z0-9_]{3,20}$/)
  4. Rate Limiting

    // API routes: 100 requests per 15 minutes
    // Auth routes: 5 attempts per 15 minutes
  5. SQL Injection Prevention

    • MongoDB (NoSQL) - No SQL injection possible
    • Mongoose sanitizes all queries

πŸ“ Project Structure

Sub4Sub/
β”‚
β”œβ”€β”€ πŸ“‚ assets/                  # Static files (served publicly)
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── style.css          # Main stylesheet (YouTube theme)
β”‚   └── js/
β”‚       └── app.js             # Client-side JavaScript
β”‚
β”œβ”€β”€ πŸ“‚ config/                  # Configuration
β”‚   └── config.js              # Environment-based config
β”‚
β”œβ”€β”€ πŸ“‚ middleware/              # Express middleware
β”‚   β”œβ”€β”€ auth.js                # Authentication checks
β”‚   β”œβ”€β”€ errorHandler.js        # Global error handler
β”‚   β”œβ”€β”€ upload.js              # Multer file upload config
β”‚   └── validation.js          # Input validation rules
β”‚
β”œβ”€β”€ πŸ“‚ models/                  # Mongoose schemas
β”‚   β”œβ”€β”€ User.js                # User account model
β”‚   β”œβ”€β”€ Subscription.js        # Subscription exchange model
β”‚   β”œβ”€β”€ Payment.js             # Payment transaction model
β”‚   β”œβ”€β”€ Notification.js        # User notification model
β”‚   └── Content.js             # Static page content model
β”‚
β”œβ”€β”€ πŸ“‚ routes/                  # Express route handlers
β”‚   β”œβ”€β”€ main.js                # Public pages + user dashboard
β”‚   β”œβ”€β”€ auth.js                # Authentication routes
β”‚   β”œβ”€β”€ admin.js               # Admin panel routes
β”‚   └── api.js                 # REST API endpoints
β”‚
β”œβ”€β”€ πŸ“‚ scripts/                 # Utility scripts
β”‚   β”œβ”€β”€ migrate.js             # Database initialization
β”‚   β”œβ”€β”€ generate-views.js      # Create EJS templates
β”‚   └── cleanup-php-files.js   # Remove old PHP files
β”‚
β”œβ”€β”€ πŸ“‚ utils/                   # Helper functions
β”‚   β”œβ”€β”€ emailService.js        # Email sending service
β”‚   └── helpers.js             # General utility functions
β”‚
β”œβ”€β”€ πŸ“‚ views/                   # EJS templates
β”‚   β”œβ”€β”€ partials/              # Reusable components
β”‚   β”‚   β”œβ”€β”€ header.ejs         # Site header/nav
β”‚   β”‚   └── footer.ejs         # Site footer
β”‚   β”œβ”€β”€ auth/                  # Authentication pages
β”‚   β”‚   β”œβ”€β”€ login.ejs
β”‚   β”‚   β”œβ”€β”€ register.ejs
β”‚   β”‚   β”œβ”€β”€ forgot-password.ejs
β”‚   β”‚   └── verify.ejs
β”‚   β”œβ”€β”€ admin/                 # Admin panel pages
β”‚   β”‚   β”œβ”€β”€ dashboard.ejs
β”‚   β”‚   β”œβ”€β”€ users.ejs
β”‚   β”‚   β”œβ”€β”€ verify-users.ejs
β”‚   β”‚   β”œβ”€β”€ payments.ejs
β”‚   β”‚   β”œβ”€β”€ content-management.ejs
β”‚   β”‚   └── settings.ejs
β”‚   β”œβ”€β”€ errors/                # Error pages
β”‚   β”‚   β”œβ”€β”€ 404.ejs
β”‚   β”‚   └── 500.ejs
β”‚   β”œβ”€β”€ index.ejs              # Landing page
β”‚   β”œβ”€β”€ about.ejs              # About page
β”‚   β”œβ”€β”€ faq.ejs                # FAQ page
β”‚   β”œβ”€β”€ contact.ejs            # Contact page
β”‚   β”œβ”€β”€ privacy.ejs            # Privacy policy
β”‚   β”œβ”€β”€ tos.ejs                # Terms of service
β”‚   β”œβ”€β”€ account.ejs            # User dashboard
β”‚   β”œβ”€β”€ exchange.ejs           # Subscription exchange
β”‚   β”œβ”€β”€ analytics.ejs          # Growth analytics
β”‚   β”œβ”€β”€ notification.ejs       # Notifications
β”‚   └── purchase.ejs           # Premium purchase
β”‚
β”œβ”€β”€ πŸ“‚ uploads/                 # User-uploaded files
β”‚   └── (dynamically created)
β”‚
β”œβ”€β”€ πŸ“„ .env                     # Environment variables (NOT in git)
β”œβ”€β”€ πŸ“„ .env.example             # Environment template
β”œβ”€β”€ πŸ“„ .gitignore               # Git ignore rules
β”œβ”€β”€ πŸ“„ package.json             # Dependencies & scripts
β”œβ”€β”€ πŸ“„ package-lock.json        # Locked dependency versions
β”œβ”€β”€ πŸ“„ server.js                # Application entry point
β”‚
β”œβ”€β”€ πŸ“„ README.md                # This file (Core documentation)
β”œβ”€β”€ πŸ“„ SETUP.md                 # Detailed setup guide
└── πŸ“„ DESIGN.md                # Design principles & concepts

🌐 Application URLs

Public Access (No Login Required)

Informational Pages:

  • Home: /
  • About Us: /about
  • FAQ: /faq
  • Contact: /contact
  • Privacy Policy: /privacy
  • Terms of Service: /tos

Authentication:

  • Login: /auth/login
  • Register: /auth/register
  • Forgot Password: /auth/forgot
  • Email Verification: /auth/verify/:token
  • Logout: /auth/logout

User Area (Login Required)

Dashboard & Tools:

  • User Dashboard: /account
  • Subscription Exchange: /exchange
  • Analytics & Stats: /analytics
  • Notifications: /notification
  • Purchase Premium: /purchase
  • Payment Success: /purchase-success

Admin Panel (Admin Only)

Management Interface:

  • Admin Dashboard: /admin/dashboard
  • User Management: /admin/users
  • Verify Subscriptions: /admin/verify-users
  • Payment History: /admin/payments
  • Content Management: /admin/content-management
  • System Settings: /admin/settings

REST API (Rate Limited)

Endpoints:

  • API Info: GET /api/
  • Current User: GET /api/user
  • All Users: GET /api/users (admin)
  • Subscriptions: GET /api/subscriptions
  • Notifications: GET /api/notifications
  • Platform Stats: GET /api/stats

πŸ’» Development

NPM Scripts

# Production
npm start                # Start production server (PORT 3000)

# Development
npm run dev              # Start with nodemon (auto-reload on changes)

# Database
npm run migrate          # Initialize/reset database + create admin user

# Utilities
node scripts/generate-views.js      # Generate all EJS templates
node scripts/cleanup-php-files.js   # Remove old PHP files (one-time)

# Package Management
npm install              # Install all dependencies
npm update               # Update packages to latest compatible
npm audit fix            # Fix security vulnerabilities

Environment Variables

Minimal Configuration (.env):

NODE_ENV=development
PORT=3000
MONGODB_URI=mongodb://localhost:27017/sub4sub
SESSION_SECRET=change-this-to-random-string-in-production
ADMIN_EMAIL=admin@sub4sub.com
ADMIN_PASSWORD=admin123

Full Configuration (Optional Features):

# Email Service (Optional - app works without it)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password

# Payment Gateways (Optional - demo mode available)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
PAYPAL_MODE=sandbox

# File Upload Settings
MAX_FILE_SIZE=5242880
UPLOAD_DIR=uploads

Development Workflow

# 1. Clone repository
git clone <repo-url>
cd Sub4Sub

# 2. Install dependencies
npm install

# 3. Start MongoDB (if not running)
# Windows: net start MongoDB
# Linux/Mac: sudo systemctl start mongod

# 4. Configure environment
cp .env.example .env
# Edit .env with your settings

# 5. Initialize database
npm run migrate

# 6. Generate views (if needed)
node scripts/generate-views.js

# 7. Start development server
npm run dev

# 8. Open browser
# Visit http://localhost:3000

Making Changes

After editing code:

  • Server auto-restarts (nodemon watching)
  • Refresh browser to see changes
  • Check terminal for errors

After editing views:

  • Just refresh browser
  • EJS compiles on each request in development

After editing models:

  • Restart server
  • May need to run npm run migrate if schema changed

πŸš€ Deployment

Production Checklist

Before deploying:

  • Set NODE_ENV=production in environment
  • Use strong SESSION_SECRET (64+ random characters)
  • Change admin password from default
  • Use production MongoDB (MongoDB Atlas recommended)
  • Enable MongoDB authentication
  • Configure HTTPS/SSL
  • Set up domain name and DNS
  • Configure email service (optional but recommended)
  • Test all features thoroughly
  • Set up monitoring and logging
  • Configure automated backups
  • Review security settings

Deployment Options

Option 1: Railway.app (Easiest)

  1. Sign up at railway.app
  2. Click "New Project" β†’ "Deploy from GitHub"
  3. Connect repository
  4. Add MongoDB plugin (automatic)
  5. Set environment variables in dashboard
  6. Deploy automatically on push

Option 2: Heroku

# Install Heroku CLI
heroku login
heroku create your-app-name

# Add MongoDB
heroku addons:create mongolab:sandbox

# Configure
heroku config:set NODE_ENV=production
heroku config:set SESSION_SECRET=your-secret

# Deploy
git push heroku main
heroku open

Option 3: DigitalOcean/VPS

# SSH into server
ssh root@your-server-ip

# Install Node.js 16+
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

# Install MongoDB
# (See SETUP.md for detailed instructions)

# Clone project
git clone your-repo-url
cd Sub4Sub

# Install dependencies (production only)
npm install --production

# Configure environment
nano .env
# Add production settings

# Initialize database
npm run migrate

# Install PM2 (process manager)
npm install -g pm2

# Start application
pm2 start server.js --name sub4sub

# Configure PM2 to start on boot
pm2 startup
pm2 save

# Set up Nginx reverse proxy
# (See SETUP.md for Nginx configuration)

# Set up SSL with Let's Encrypt
sudo apt-get install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com

Option 4: Docker (Advanced)

# Dockerfile example
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

πŸ” Default Credentials

Admin Account:

  • Email: admin@sub4sub.com
  • Password: admin123

⚠️ CRITICAL: Change admin password immediately after first login!

To reset admin password:

npm run migrate
# This recreates the admin user with default password

πŸ› Common Issues & Solutions

1. MongoDB Connection Error

Error:

MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017

Solutions:

# Windows
net start MongoDB

# Linux/Mac
sudo systemctl start mongod

# Verify MongoDB is running
mongosh --eval "db.version()"

2. Port Already in Use

Error:

Error: listen EADDRINUSE: address already in use :::3000

Solutions:

Option A: Change port in .env

PORT=3001

Option B: Kill the process (Windows)

netstat -ano | findstr :3000
taskkill /PID <PID> /F

Option C: Kill the process (Linux/Mac)

lsof -ti:3000 | xargs kill -9

3. Views Not Found

Error:

Error: Failed to lookup view "index"

Solution:

node scripts/generate-views.js

4. Module Not Found

Error:

Error: Cannot find module 'express'

Solution:

rm -rf node_modules package-lock.json
npm install

5. Session Issues

Error:

Session store unavailable

Solutions:

  1. Ensure MongoDB is running
  2. Check MONGODB_URI in .env
  3. Restart the server
  4. Clear browser cookies

πŸ“– Documentation

Complete Guides:

  • README.md (this file) - Overview, features, quick start, architecture
  • SETUP.md - Detailed installation, configuration, deployment, troubleshooting
  • DESIGN.md - Design principles, color system, UI patterns, accessibility

Code Documentation:

  • package.json - Dependencies, scripts, metadata
  • Inline Comments - All complex logic documented in code

🎨 Design Philosophy

This application follows a YouTube-inspired design aesthetic:

  • Primary Color: Vibrant Red (#FF0000) - Action, urgency, brand recognition
  • Background: Purple Gradient (#667eea β†’ #764ba2) - Modern, depth, engagement
  • Dark Elements: Professional darks (#1a1a2e, #16213e) - Authority, sophistication
  • Typography: Inter (body), Poppins (headings) - Clean, modern, readable
  • Animations: Smooth transitions (0.3s ease) - Responsive, alive, quality

Core Principles:

  1. Creator-First - Every design decision serves creator growth
  2. Progressive Disclosure - Information revealed based on user journey
  3. Visual Hierarchy - Clear path from attention β†’ conversion
  4. Micro-Interactions - Every action provides feedback
  5. Accessibility - WCAG AA compliant, keyboard navigable

πŸ“š Learn more: See DESIGN.md for complete design system documentation


πŸ”’ Security

Built-in Protection

Authentication & Authorization:

  • Password hashing with bcrypt (10 rounds + salt)
  • Session-based authentication (HTTP-only cookies)
  • Role-based access control (user, admin)
  • CSRF tokens on all forms

Input Security:

  • Input validation with express-validator
  • Sanitization of user input
  • Mongoose schema validation
  • XSS protection (EJS auto-escapes)

Network Security:

  • Rate limiting (100 req/15min on API)
  • Helmet.js security headers
  • CORS configuration
  • HTTPS enforcement in production

Database Security:

  • MongoDB authentication (production)
  • Connection string encryption
  • Query sanitization (Mongoose)
  • Indexed queries (performance + security)

Security Best Practices

Production Deployment:

  1. Use strong SESSION_SECRET (64+ random characters)
  2. Enable MongoDB authentication
  3. Use HTTPS/TLS (Let's Encrypt)
  4. Change default admin credentials
  5. Keep dependencies updated (npm audit fix)
  6. Set NODE_ENV=production
  7. Configure firewall rules
  8. Monitor logs for suspicious activity
  9. Regular database backups
  10. Implement rate limiting on all public endpoints

πŸ†š Migration from PHP Version

What Changed?

Aspect PHP (v1.x) Node.js (v2.0)
Language PHP 7+ JavaScript ES6+
Framework Plain PHP Express.js 4.x
Database MySQL 5.7 MongoDB 5.0+
ORM/ODM PDO Mongoose 8.x
Templating PHP includes EJS
Sessions File-based MongoDB-backed
Architecture Monolithic MVC pattern
API Basic endpoints RESTful + rate limiting
Security Basic Enterprise-grade
Performance Good Excellent (event-driven)
Scalability Limited High (horizontal scaling)
Real-time No Ready (Socket.io compatible)
Deployment cPanel/shared hosting Cloud-native (Railway, Heroku, VPS)

What Stayed the Same?

βœ… All features preserved
βœ… User experience maintained
βœ… Admin capabilities retained
βœ… Design language improved but familiar
βœ… Core logic reimplemented in Node.js

Migration Benefits

For Developers:

  • Single language (JavaScript) for frontend + backend
  • Modern async/await syntax
  • Rich npm ecosystem (1.8M+ packages)
  • Better debugging tools
  • Faster development iterations

For Users:

  • Faster page loads
  • Better performance
  • More reliable sessions
  • Enhanced security
  • Smoother animations

For Business:

  • Lower hosting costs (Node.js is efficient)
  • Better scalability (horizontal scaling)
  • Future-proof (modern stack)
  • Mobile app ready (REST API)
  • Real-time features possible (WebSockets)

πŸ“ž Support & Contributing

Getting Help

If you encounter issues:

  1. Check Documentation

    • Review SETUP.md for configuration
    • Check DESIGN.md for UI/UX questions
    • Read error messages carefully
  2. Common Issues

    • MongoDB not running β†’ Start MongoDB service
    • Port in use β†’ Change PORT in .env
    • Views not found β†’ Run node scripts/generate-views.js
    • Module not found β†’ Run npm install
  3. Debugging

    • Check terminal output for errors
    • Use console.log() for debugging
    • Check MongoDB logs
    • Verify .env configuration
  4. Production Issues

    • Check server logs
    • Verify environment variables
    • Test MongoDB connection
    • Review security headers

System Requirements

Minimum:

  • Node.js 16+
  • MongoDB 5.0+
  • 2GB RAM
  • 500MB disk space

Recommended:

  • Node.js 18+ (LTS)
  • MongoDB 6.0+
  • 4GB RAM
  • 2GB disk space
  • SSD storage

πŸ“„ License

This project is proprietary and private. All rights reserved.

Usage Restrictions:

  • No redistribution
  • No commercial use without permission
  • Source code viewing allowed for licensed users only

πŸŽ‰ Acknowledgments

Technologies Used:

Special Thanks:

  • YouTube for design inspiration
  • Bootstrap team for excellent documentation
  • MongoDB for powerful database
  • Node.js community for incredible ecosystem

πŸš€ What's Next?

Completed βœ…

  • Complete PHP to Node.js migration
  • Modern design implementation
  • Security enhancements
  • Admin panel improvements
  • Content management system
  • Payment gateway integration
  • REST API implementation

Roadmap (Future Versions)

v2.1 - Enhanced Analytics

  • Advanced analytics dashboard
  • Export data to CSV/PDF
  • Custom date ranges
  • Subscriber growth charts

v2.2 - Social Features

  • User profiles
  • Creator messaging
  • Community forums
  • Content recommendations

v2.3 - Mobile App

  • React Native mobile app
  • Push notifications
  • Offline mode
  • Enhanced API

v2.4 - Automation

  • Auto-verification (YouTube API)
  • Scheduled reports
  • Automated emails
  • Smart recommendations

Built with ❀️ using Node.js, Express.js, MongoDB, and modern web technologies

Successfully migrated from PHP/MySQL to Node.js/MongoDB - January 2026

Version: 2.0
Last Updated: January 2026
Status: Production Ready βœ…

About

This is a fully open-source advanced Sub4Sub Web Application made with PHP and MySQL database by Hiranmay Roy and Sameer Pathak.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published