Infinix OTT Platform Setup Guide
Welcome to the official local development installation and production VPS hosting guide for the Infinix OTT Platform.
Infinix is a high-performance video-on-demand (VOD), Live TV, and micro-drama streaming system. To guarantee a smooth, low-latency streaming experience for web and Smart TV users, the codebase is split into three main components: an Express REST API backend, a customer web frontend client, and a dedicated admin management console dashboard.
Direct Media Offloading Tip
Videos processed in Infinix are segmented into HLS adaptive bitrate chunks (.m3u8 playlists and .ts files). By setting up Nginx on your VPS to serve these static files directly, you bypass Node.js process load, drastically reducing VPS memory and CPU usage!
System Architecture
Express REST API
Node.js TypeScript server which manages business logic, users, subscriptions, video transcoding queues, and admin data.
Next.js Web Client
High-end customer web portal featuring dynamic content sliders, profiles, content filtering, and optimized adaptive video players.
Next.js Admin Panel
Robust administrative dashboard enabling administrators to manage banners, upload movies/seasons, track analytics, and manage settings.
Prerequisites & Hardware Specifications
For smooth video rendering and responsive REST transactions, ensure your systems meet these specifications.
| Requirement | Local Development Environment | Production VPS (High Load) |
|---|---|---|
| Operating System | macOS, Windows 10/11, Linux | Ubuntu 22.04 / 24.04 LTS (x64) |
| Runtime Engine | Node.js v20.x LTS (with npm) | Node.js v20.x LTS |
| Database | MySQL 8.0+ / Local Server | MySQL 8.0 Server instance |
| Video Processor | FFmpeg binaries installed globally | FFmpeg package (system-level) |
| RAM Capacity | 8 GB RAM (minimum) | 8 GB or 16 GB RAM (for FFmpeg encoding) |
| Disk Space | 20 GB SSD storage | 100 GB+ NVMe SSD (highly scalable for assets) |
Local Setup Step 1: Prep Environment
To begin developing locally, you must install the runtime engine Node.js (v20 LTS), MySQL Server, and FFmpeg.
-
1Install Node.js Locally
Download and install Node.js 20 LTS from the official website (nodejs.org), or install via Node Version Manager (NVM):
bash# Install and switch to Node 20 nvm install 20 nvm use 20 node -v -
2Install MySQL Server Locally
Download MySQL Community Server from the MySQL downloads portal and run it as a service locally. Ensure you configure a root user password.
-
3Install FFmpeg Locally
FFmpeg must be installed system-wide so the Express transcoding pipelines can run properly.
bash# On macOS (using Homebrew) brew install ffmpeg # On Linux (Ubuntu/Debian) sudo apt install ffmpeg -y # On Windows # Download from Gyan.dev, extract, and add to system Environment variables PATH
Local Setup Step 2: Provision Database
Create a local MySQL database instance and dedicated user credentials specifically for development tasks.
-
1Log in to Local MySQL Command Linebash
mysql -u root -p -
2Execute SQL Provisioning Commands
Create database schemas and provision local developer account privileges:
SQLCREATE DATABASE IF NOT EXISTS `infinix_dev` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER IF NOT EXISTS 'infinix_dev_user'@'localhost' IDENTIFIED BY 'DevPassword123!'; GRANT ALL PRIVILEGES ON `infinix_dev`.* TO 'infinix_dev_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
Local Setup Step 3: Run Express Server
Initialize the server codebase, install dependencies, establish environment configurations, and spin up the backend API local runner.
-
1Install Server Dependenciesbash
cd server npm install -
2Configure Local Environment Variables
Create a
.envfile in theserverroot directory and set the values to match local settings:server/.envPORT=5007 NODE_ENV=development # Database Configuration (MySQL local) DB_HOST=localhost DB_PORT=3306 DB_USER=infinix_dev_user DB_PASSWORD=DevPassword123! DB_NAME=infinix_dev # JWT & URL Configurations APP_URL=http://localhost:5007 FRONTEND_URL=http://localhost:3000 JWT_SECRET=local_development_jwt_token_secret_key_string JWT_REFRESH_SECRET=local_development_jwt_refresh_token_secret_key_string JWT_EXPIRES_IN=7d JWT_REFRESH_EXPIRES_IN=30d # SMS & E-mail Configurations (Optional for development) SMTP_HOST=smtp.mailtrap.io SMTP_PORT=2525 SMTP_USER=test_user SMTP_PASSWORD=test_pass -
3Run Local Express Development Server
Launch the server in development hot-reload mode using the TypeScript runner script:
bashnpm run devThe server will boot, automatically sync models to database tables, and start listening on:
http://localhost:5007.
Local Setup Step 4: Run Client Web
Initialize client portal variables pointing to your local Express API base URL and spin up the hot-reloading Next.js dev server.
-
1Install Client Dependenciesbash
cd ../client npm install -
2Set Local Environment File
Create a
.envfile inside the client root folder and set the backend API endpoint address to localhost:client/.envNEXT_PUBLIC_API_URL=http://localhost:5007/api NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_local_google_oauth_client_id_if_needed -
3Run Local Web Serverbash
npm run devThe Next.js customer web frontend will start locally on:
http://localhost:3000.
Local Setup Step 5: Run Admin Panel
Boot up the local administrator control center to configure video catalogs, channels, and platform settings.
-
1Install Admin Panel Dependenciesbash
cd ../admin npm install -
2Set Environment Configuration
Create a
.envfile in the admin dashboard root folder pointing to the localhost server API:admin/.envNEXT_PUBLIC_API_URL=http://localhost:5007/api -
3Run Admin Development Serverbash
npm run devThe Next.js admin console dashboard will launch locally on:
http://localhost:3001.
VPS Setup Step 1: DNS & Domain Configuration
Before installing packages on your server, map your domains in your domain registrar's DNS settings. This acts as the backbone for public access, proxying, and SSL certificate provision.
-
1Map DNS A Records to VPS Public IP
Navigate to your domain registrar's DNS management control panel (e.g. GoDaddy, Hostinger, Cloudflare, Namecheap) and create the following A records:
Record Type Host / Name Points To Purpose A Record @(or blank)YOUR_VPS_IP_ADDRESSPoints primary domain to client frontend website A Record apiYOUR_VPS_IP_ADDRESSPoints API subdomain to Express API server A Record adminYOUR_VPS_IP_ADDRESSPoints Admin subdomain to management dashboard Wait for DNS propagation (typically taking 5-15 minutes before running the next step).
VPS Setup Step 2: Prepare VPS Environment
Connect to your VPS server using SSH, update system packages, and install Node.js, Nginx, MySQL Server, FFmpeg, and the PM2 daemon globally.
-
1Connect & Update Package Listsbash
ssh root@YOUR_VPS_IP_ADDRESS sudo apt update && sudo apt upgrade -y -
2Install Node.js 20 LTS
Fetch and install the official NodeSource distribution script for Node.js 20:
bashcurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt-get install -y nodejs node -v -
3Install Nginx, MySQL Server, & FFmpeg
Install server elements. Enabling Nginx and MySQL ensures they auto-start on server boot:
bashsudo apt install -y mysql-server nginx ffmpeg build-essential sudo systemctl enable nginx sudo systemctl enable mysql -
4Install PM2 Globally
PM2 is a robust Node.js process manager ensuring our backend API and web client servers remain online 24/7, auto-restarting on crashes or server reboots.
bashsudo npm install -g pm2 pm2 --version
VPS Setup Step 3: Provision VPS Database
Secure your production database and set up a dedicated MySQL database and user account using custom configurations.
-
1Log in to MySQL Terminalbash
sudo mysql -u root -
2Create Database & Database User
Execute the SQL commands below to define your database, set credentials, and secure permissions. Note: Custom fields in the commands below dynamically match your Sidebar configurations!
SQL (MySQL Terminal)CREATE DATABASE IF NOT EXISTS `infinix` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER IF NOT EXISTS 'infinix_user'@'localhost' IDENTIFIED BY 'StrongDBPassword123!'; GRANT ALL PRIVILEGES ON `infinix`.* TO 'infinix_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
VPS Setup Step 4: Deploy Backend Live
Upload your `server` code directory onto the VPS (e.g. inside /var/www/infinix/server). Next, initialize environment configurations and launch it using PM2.
-
1Enter Server Directory & Install Dependenciesbash
cd /var/www/infinix/server npm install -
2Configure Backend .env File
Create the
.envfile with proper port and SQL configurations. Use the custom command box below which includes your custom values:nano .env# Admin Setup Credentials ADMIN_EMAIL=admin@inficom.com ADMIN_PASSWORD=Admin@123 # Database Setup (MySQL) DB_HOST=localhost DB_PORT=3306 DB_USER=infinix_user DB_PASSWORD=StrongDBPassword123! DB_NAME=infinix # Application Configurations NODE_ENV=production PORT=5007 APP_URL=https://api.infinixdigitalott.com FRONTEND_URL=https://infinixdigitalott.com # JWT Secret Keys JWT_SECRET=infinix_jwt_secret_production_key_change_me_$(openssl rand -hex 16) JWT_REFRESH_SECRET=infinix_jwt_refresh_production_key_$(openssl rand -hex 16) JWT_EXPIRES_IN=365d JWT_REFRESH_EXPIRES_IN=365d # SMS & E-mail Configurations SMTP_HOST=smtp.hostinger.com SMTP_PORT=465 SMTP_USER=support@infinixdigitalott.com SMTP_PASSWORD=Vix@Digital26 -
3Start Server Process with PM2
TypeScript files are executed dynamically on the VPS. Start the daemon job with the PM2 module:
bash# Start Server using TSX directly through PM2 fork mode pm2 start npx --name "infinix-api" -- tsx index.ts # Configure PM2 to auto-start on server reboots pm2 save pm2 startup
VPS Setup Step 5: Nginx Proxy & SSL Setup
Route external HTTP queries securely to internal Express and Next.js applications using reverse proxy servers, static media direct offloading, and SSL encryption.
High-Performance Direct Static Offloading
In the config below, Nginx serves static video chunks directly from /var/www/infinix/server/uploads. This bypasses Express execution for media streaming, ensuring maximum performance!
Create an Nginx configuration file: /etc/nginx/sites-available/infinixdigitalott.com.
# 1) Customer Frontend Web (domain.com)
server {
listen 80;
server_name infinixdigitalott.com;
client_max_body_size 2000M;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# 2) Administrator Dashboard (admin.domain.com)
server {
listen 80;
server_name admin.infinixdigitalott.com;
client_max_body_size 2000M;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# 3) Express REST API Backend (api.domain.com)
server {
listen 80;
server_name api.infinixdigitalott.com;
client_max_body_size 2000M;
# Media bypass rule to offload large transcode file reads directly to Nginx disk
location ~* ^/(api/)?uploads/(.*)$ {
alias /var/www/infinix/server/uploads/$2;
expires 365d;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, OPTIONS";
try_files "" =404;
}
location / {
proxy_pass http://127.0.0.1:5007;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
-
1Deploy Custom Nginx Config
Write the above site virtual configurations using nano inside your server directory:
/etc/nginx/sites-available/infinixdigitalott.com. -
2Enable Symbolic Links & Restart Nginx
Enable symbolic linking to publish the config file, run syntactical checks, and restart the Nginx router daemon:
bash# Link to enabled sites sudo ln -s /etc/nginx/sites-available/infinixdigitalott.com /etc/nginx/sites-enabled/ # Verify config syntax sudo nginx -t # Restart proxy daemon sudo systemctl restart nginx -
3Acquire Let's Encrypt SSL Certificates
Secure all subdomains using a Let's Encrypt SSL certificate via Certbot:
bashsudo apt install -y certbot python3-certbot-nginx sudo certbot --nginx -d infinixdigitalott.com -d admin.infinixdigitalott.com -d api.infinixdigitalott.comCertbot automatically intercepts Nginx files to redirect HTTP transactions directly to HTTPS. Once active, your live API runs securely at:
https://api.infinixdigitalott.com.
VPS Setup Step 6: Connect Frontends & Run
Now that the database is configured, the Express server is online, and domain names are routed with HTTPS, we can connect the web client and admin portals by editing their environment parameters, compiling the Next.js assets, and launching them with PM2.
Critical Connection Step
Next.js embeds environment variables prefixing NEXT_PUBLIC_ into compiled client bundles during build time. You **must** create these .env files before running npm run build, ensuring the browser calls the correct live production URL: https://api.infinixdigitalott.com/api.
-
1Configure Next.js Client Environment File
Navigate to client code directory
/var/www/infinix/clientand populate production variables. This links your client frontend to the live HTTPS API domain:bashcd /var/www/infinix/client npm install # Write production variables (Points client browser to live SSL API subdomain) cat << 'EOF' > .env NEXT_PUBLIC_API_URL=https://api.infinixdigitalott.com/api NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_production_google_oauth_client_id_here EOF -
2Build Next.js Client Production Bundle
Compile static optimization elements and TypeScript files. This compiles the live API URL straight into client scripts:
bashnpm run build -
3Launch Web Client Daemon using PM2
Launch client rendering bundles on Next port 3000 using the PM2 daemon runner:
bashpm2 start npm --name "infinix-client" -- start -- -p 3000 pm2 save -
4Configure Next.js Admin Panel Environment File
Navigate to admin codebase directory
/var/www/infinix/adminand edit API endpoint parameters:bashcd /var/www/infinix/admin npm install # Write production variables (Points admin panel to live SSL API subdomain) cat << 'EOF' > .env NEXT_PUBLIC_API_URL=https://api.infinixdigitalott.com/api EOF -
5Compile Next.js Admin Panel Production Bundle
Compile static files for the administration dashboard interface:
bashnpm run build -
6Launch Admin Panel Daemon using PM2
Deploy the dashboard bundle on port 3001 using PM2 process configuration tools:
bashpm2 start npm --name "infinix-admin" -- start -- -p 3001 pm2 save -
7Configure PM2 Save Status & Startup Configuration
Save all running daemons and build system scripts to auto-start applications on hardware reboots:
bashpm2 save pm2 startup
Interactive Setup Progress Tracker
Track your installation checkpoints below. Checkboxes save automatically to your browser storage, and complete step cards will display line strikethrough markers in the step navigation panels above.
Deploy Progress Checklist
Local Development Checklist
VPS Production Checklist
Troubleshooting & FAQ
Encountering deployment hurdles? Check these common errors, verified configuration parameters, and production solutions.
Ensure your Nginx configuration points to the exact absolute folder path of the Express server uploads directory (typically /var/www/infinix/server/uploads). Also verify that Nginx includes the header:
add_header Access-Control-Allow-Origin "*";
Additionally, confirm that user-permissions on the uploads folder allow Nginx to read them: sudo chmod -R 755 /var/www/infinix/server/uploads.
You must ensure PM2 startup configurations are registered. Run the command:
pm2 startup
Copy the systemd command output generated on your screen, paste it into the terminal, execute it, and then save the active processes using:
pm2 save
By default, Nginx limits uploads to 1MB. To fix this, you must edit your Nginx virtual block configurations and place this directive inside the server block context:
client_max_body_size 2000M;
Then execute sudo systemctl restart nginx.
Verify that MySQL is up and running: sudo systemctl status mysql.
Ensure your backend database configuration inside .env matches your database user, password, and port. Our database sync logic uses Sequelize, which automatically populates tables on bootstrap. If alterations fail, verify your database user has ALL PRIVILEGES granted.
Ensure your credentials on Google Cloud Console contain the live production redirection URIs under "Authorized JavaScript Origins" (e.g. https://infinixdigitalott.com) and "Authorized redirect URIs" (e.g. https://api.infinixdigitalott.com/api/auth/google/callback). Also check that the OAuth client ID inside the client .env file matches exactly.