Repository files navigation # IPTV Live TV - Flutter Android App with License System
A professional Flutter Android IPTV live TV application with a Node.js/Express backend, PostgreSQL database, and a license management system. Future admin dashboard support is built-in.
## Project Structure
```
iptv/
│
├── backend/ # Node.js Express API
│ ├── migrations/ # Database schema & seed data
│ │ ├── 001_initial_schema.sql
│ │ └── 002_seed_data.sql
│ ├── scripts/
│ │ └── init-db.js # Database initialization script
│ ├── src/
│ │ ├── app.js # Express app entry
│ │ ├── config/
│ │ │ └── db.js # PostgreSQL connection
│ │ ├── controllers/ # API controllers
│ │ ├── middleware/ # Auth, rate limit, error handler
│ │ ├── routes/ # API routes
│ │ └── utils/ # JWT, password, helpers
│ ├── .env # Environment variables
│ └── package.json
│
└── mobile/ # Flutter Android app
├── lib/
│ ├── cubits/ # BLoC state management
│ ├── models/ # Data models
│ ├── screens/ # UI screens
│ ├── services/ # API & storage services
│ ├── constants.dart # App constants
│ ├── theme.dart # Dark theme
│ └── main.dart # App entry point
├── pubspec.yaml
└── android/
```
## Features
### Mobile App
- **Splash Screen** with app config checks (maintenance, force update)
- **Onboarding** slides for first-time users
- **Signup/Login** with JWT authentication
- **License Activation** with server-side validation
- **Home Screen** with featured & popular channels
- **Channel List** with categories
- **Search** by name, category, language
- **Favorites** sync with backend
- **Live TV Player** with M3U8/HLS support, fullscreen, controls
- **Profile** with license status
- **System Screens**: Blocked, Maintenance, Force Update, Device Limit
### Backend API
- **Auth**: Signup, Login, Logout, Forgot Password, Me
- **App Config**: Remote config, version check, maintenance mode
- **License**: Activate, Status, Validate, History
- **Channels**: List, Search, By Category, Categories
- **User**: Profile, Favorites, Watch History, Devices
- **Payments**: Plans, Status, Manual Request, History
- **Admin APIs**: Manage users, licenses, channels, categories, payments, app settings
## Quick Start
### Prerequisites
- Node.js (v18+)
- PostgreSQL (14+)
- Flutter SDK (3.12+)
- Android Studio / VS Code
### 1. Backend Setup
```bash
cd backend
# Install dependencies
npm install
# Create database (run in psql)
CREATE DATABASE iptv_db;
# Copy and configure environment
cp .env.example .env
# Edit .env with your DB credentials
# Run database migrations and seed data
npm run init-db # node scripts/init-db.js
# Start server
npm start
# or for development with auto-reload
npm run dev
```
### 2. Mobile App Setup
```bash
cd mobile
# Get dependencies
flutter pub get
# Update API base URL in lib/constants.dart
# Change: static const String baseUrl = 'http://YOUR_SERVER_IP:5000';
# Run debug build
flutter run
# Build release APK
flutter build apk --release
```
### 3. Admin Setup
Create an admin user directly in the database:
```sql
-- In psql
INSERT INTO users (full_name, email, mobile, password_hash, status, role)
VALUES ('Admin', 'admin@iptv.com', '9876543210', '', 'active', 'admin');
```
Generate password hash:
```bash
node -e "const bcrypt = require('bcryptjs'); bcrypt.hash('your_password', 12).then(console.log);"
```
Use the admin APIs with basic auth or JWT (see admin routes in Postman).
## API Endpoints
### Auth
- `POST /api/auth/signup`
- `POST /api/auth/login`
- `POST /api/auth/logout`
- `GET /api/auth/me`
### App Config
- `GET /api/app/config`
- `GET /api/app/status`
- `GET /api/app/version-check`
### License
- `POST /api/license/activate`
- `GET /api/license/status`
- `POST /api/license/validate`
- `GET /api/license/history`
### Channels
- `GET /api/channels`
- `GET /api/channels/:id`
- `GET /api/channels/search?q=`
- `GET /api/channels/category/:categoryId`
- `GET /api/categories`
### User
- `GET /api/user/profile`
- `PUT /api/user/profile`
- `GET /api/user/favorites`
- `POST /api/user/favorites/:channelId`
- `DELETE /api/user/favorites/:channelId`
- `GET /api/user/watch-history`
- `GET /api/user/devices`
### Payments
- `GET /api/payments/plans`
- `GET /api/payments/status`
- `POST /api/payments/manual-request`
- `GET /api/payments/history`
### Admin (Internal)
- All under `/api/internal/*` - requires admin auth
- See `backend/src/routes/admin.js` for full list
## Security Features
- Passwords hashed with bcrypt (salt rounds: 12)
- JWT authentication for API access
- API rate limiting
- Device binding
- Server-side license validation (not device time)
- Protected admin APIs
## Future Admin Dashboard
The backend is fully prepared for a future admin website. Features ready:
- Full CRUD for users, licenses, channels, categories
- Payment management
- App settings control
- All admin APIs already exist at `/api/internal/*`
A separate web-based admin panel can be connected directly to these APIs.
## Tech Stack
**Backend**: Node.js, Express, PostgreSQL, JWT, bcryptjs, helmet, cors, rate-limit
**Mobile**: Flutter, BLoC (flutter_bloc), Dio, video_player, shared_preferences
## License
Private / Commercial - Use legal IPTV streams only.
# iptv
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
You can’t perform that action at this time.