This is the backend API and admin dashboard for the IPTV platform. The user-facing application is built with Expo React Native (see /expo-rn folder).
- Backend API (Port 2005) - Next.js API routes
- Admin Dashboard (Port 2005/dashboard) - Next.js web UI for management
- User App - Expo React Native app (separate folder:
/expo-rn) - Database - PostgreSQL with Prisma ORM
First, set up PostgreSQL and create a database:
# Create database
createdb iptv_platform
# Or using psql
psql -U postgres
CREATE DATABASE iptv_platform;Create a .env.local file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/iptv_platform"
# Encryption (generate with: openssl rand -hex 32)
ENCRYPTION_KEY="your-32-byte-hex-key-here"
# JWT Secret (change in production)
JWT_SECRET="your-jwt-secret-key-change-in-production"
# Stalker Portal Configuration (for legacy support)
STALKER_MAC=00:1A:79:XX:XX:XX
STALKER_URL=http://your-portal-url/stalker_portal/
STALKER_BEARER=your_bearer_token
STALKER_ADID=your_adidnpm installnpx prisma migrate devnpm run devOpen http://localhost:2005 with your browser - it will redirect to the admin dashboard.
Admin Dashboard: http://localhost:2005/dashboard
- π JWT Authentication - Secure user authentication with JSON Web Tokens
- π€ User Management - Register and login users
- π‘ Provider Management - Add and manage IPTV providers
- π₯ Profile System - Multiple profiles per user with parental controls
- π± Device Management - Register and track TV devices
- π Content Sync - Automatic content synchronization from Stalker portals
- π¦ Snapshot System - Pre-filtered, compressed content snapshots per profile
- π Encryption - AES-256-GCM encryption for sensitive credentials
- π¬ Stream URLs - Secure streaming link generation
- π Overview - System statistics and recent activity
- π‘ Providers - Manage IPTV providers with auto-handshake
- π€ Profiles - Create profiles with age ratings and types (Admin/Kid/Guest)
- π± Devices - View and manage registered devices
- π Sync Status - Monitor content synchronization
See /expo-rn folder for the user-facing mobile/TV application with:
- Username/password login
- Profile selection
- Instant content loading from snapshots
- Live TV, Movies, Series browsing
- Video playback
POST /api/auth/register- Register new userPOST /api/auth/login- Login with username/passwordGET /api/auth/me- Get current user (requires JWT)
GET /api/providers- List all providersPOST /api/providers- Add new provider (auto-handshake)PATCH /api/providers/:id- Update providerDELETE /api/providers/:id- Delete provider
GET /api/profiles?userId=:id- Get user's profilesPOST /api/profiles- Create new profilePATCH /api/profiles/:id- Update profileDELETE /api/profiles/:id- Delete profile
GET /api/devices- List all devicesPOST /api/devices- Register new device
POST /api/sync/:providerId- Trigger content syncGET /api/snapshots/:profileId/latest- Get profile snapshot
POST /api/stream/link- Get streaming URL
curl -X POST http://localhost:2005/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"admin","email":"admin@example.com","password":"yourpassword"}'- Visit http://localhost:2005/dashboard/providers
- Click "Add Provider"
- Enter Stalker portal credentials
- System will auto-handshake
- Go to /dashboard/profiles
- Create profile for your user
- Choose type (Admin/Kid/Guest)
- Set age rating if needed
- Go to /dashboard/sync
- Click "Sync Now" for provider
- Wait for completion
- Snapshots generated automatically
cd expo-rnnpm start- Login with username/password
- Select profile
- Enjoy!
- π JWT Tokens - Secure authentication with 7-day expiry
- π Password Hashing - bcrypt with 10 rounds
- π Credential Encryption - AES-256-GCM for bearer tokens and passwords
- π MAC Address Binding - Device validation for streaming
β οΈ Never commit.env.localto version control
/
βββ src/
β βββ app/
β β βββ api/ # Backend API routes
β β β βββ auth/ # Authentication endpoints
β β β βββ providers/ # Provider management
β β β βββ profiles/ # Profile management
β β β βββ devices/ # Device management
β β β βββ sync/ # Content synchronization
β β β βββ snapshots/ # Snapshot delivery
β β β βββ stream/ # Streaming URLs
β β βββ dashboard/ # Admin dashboard pages
β β βββ page.tsx # Root (redirects to dashboard)
β βββ components/
β β βββ dashboard/ # Dashboard UI components
β βββ lib/
β βββ prisma.ts # Database client
β βββ jwt.ts # JWT utilities
β βββ crypto.ts # AES encryption
β βββ sync-service.ts # Content sync logic
β βββ stalker-client.ts # Stalker API client
βββ expo-rn/ # User-facing Expo app
βββ prisma/
β βββ schema.prisma # Database schema
βββ README.md
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.