تخطَّ إلى المحتوى

ɳTV Backend Setup

هذا المحتوى غير متوفر بلغتك بعد.

This page is a reference for setting up the ɳSelf backend that powers ɳTV’s library, streaming, EPG, and sync features. If you want a step-by-step walkthrough, see Getting Started instead.


ɳTV’s backend features are powered by the ɳSelf CLI and the ɳTV plugin bundle. Without a backend, ɳTV works as an IPTV M3U player only.

With the backend running the ɳTV bundle, you get:

  • A scanned and indexed media library backed by PostgreSQL
  • Server-side HLS/DASH streaming with adaptive bitrate
  • TMDB metadata enrichment (poster art, descriptions, cast, ratings)
  • EPG for live channels
  • Cross-device progress sync via Hasura GraphQL
  • Media acquisition and encoding via optional plugins

  • ɳSelf CLI (latest stable) : Installation guide
  • Docker Desktop (macOS / Windows) or Docker Engine (Linux)
  • An nself license key with the ɳTV bundle entitlement ($0.99/mo per F06) : get one at nself.org
  • A directory you can dedicate to the backend (e.g., ~/stacks/nself)

These plugins require a valid ɳTV bundle license key.

PluginPurposeNotes
streamingLibrary API, HLS/DASH segments, progress syncCore, required for all library features
stream-gatewayStream URL routing and access controlRoutes playback requests from the app
epgElectronic Program Guide for live channelsOnly needed if using live TV
tmdbTMDB metadata lookup and poster artRequires a free TMDB API key

These plugins do not require a license key.

PluginPurpose
torrent-managerBitTorrent client for media acquisition
content-acquisitionAutomated download and discovery orchestration
subtitle-managerSubtitle search, download, and sync
PluginPurpose
media-processingServer-side encoding pipeline (Rust, hardware-accelerated)
recordingDVR recording from live streams (pairs with epg)
game-metadataGame library metadata lookup (IGDB)
vpnVPN integration for privacy-conscious downloading

Terminal window
mkdir ntv-backend && cd ntv-backend
nself init

nself init prompts for a project name, domain, and environment. For a local development setup, use localhost and accept defaults.

Terminal window
nself license set <your-nself-pro-key>

The CLI validates the key against ping.nself.org/license/validate. Without a valid key, paid plugins refuse to install.

Check key status at any time:

Terminal window
nself license status

Required minimum:

Terminal window
nself plugin install streaming stream-gateway epg tmdb

Free companions:

Terminal window
nself plugin install torrent-manager content-acquisition subtitle-manager

Optional:

Terminal window
nself plugin install media-processing recording

Edit .env.local in your backend directory to set plugin-specific values.

Required:

VariableDescription
TMDB_API_KEYYour TMDB API key, get a free one at themoviedb.org
MEDIA_PATHAbsolute path to the directory where your media files live

Common tuning values:

VariableDefaultDescription
STREAMING_HLS_SEGMENT_DURATION6HLS segment length in seconds
STREAMING_MAX_BITRATEunlimitedCap on adaptive bitrate
EPG_PROVIDERxmltvEPG source format (xmltv or json)
TMDB_LANGUAGEen-USLocale for titles and descriptions
LIBRARY_SCAN_INTERVAL_HOURS6Backend rescan cadence
SYNC_PROGRESS_INTERVAL_MS10000App-side progress report cadence

Full env var inventory: F09-ENV-VAR-INVENTORY in the PPI SPORT directory.

Terminal window
nself build
nself start

nself build generates the docker-compose.yml from your plugin configuration. Never hand-edit that file.

nself start brings up all services: PostgreSQL, Hasura, Auth, Nginx, and all installed ɳTV plugins.

Check everything is running:

Terminal window
nself status

All services must show as Running before the ɳTV app can connect.

Terminal window
nself doctor

Confirms all plugins have migrated their tables. The ɳTV app’s first-run health check queries the same schema.

You can also verify the streaming plugin directly:

Terminal window
curl http://localhost:8000/streaming/library \
-H "Authorization: Bearer <your-admin-token>"

Expected: a JSON response (empty array if no media yet).


To deploy the backend to a remote server:

Terminal window
nself deploy staging # deploy to staging
nself deploy prod # deploy to production

The ɳTV Flutter app can point to any reachable backend URL. Update the Backend URL in Settings to switch between local, staging, and prod.


SymptomCauseFix
”License invalid”Key is wrong, expired, or ping.nself.org is unreachableCheck nself license status. Verify the key in your nself.org account.
”Plugin missing schema”Migration was skipped or rolled backRun nself db sync. If still failing, file an issue against the plugin.
”ɳTV bundle entitlement not granted”Your tier does not include the ɳTV bundleUpgrade at nself.org or add the ɳTV bundle to your subscription.
Streaming plugin not reachableServices not fully startedRun nself status. All services must be Running.
Media not appearing in libraryScan not triggeredRun nself plugin run media-processing scan (requires media-processing plugin).
No poster artTMDB_API_KEY missing or invalidSet TMDB_API_KEY in .env.local and restart: nself restart tmdb.