onair-stack is a self-hosted live-TV backend for Stremio. A background worker crawls public IPTV playlists, broadcaster APIs and EPG feeds around the clock, verifies that every stream really plays, and stores channels, streams and programme schedules in Postgres. A companion Stremio addon then serves that catalogue — including a native TV guide — so you can browse a channel lineup, see what is on right now, and press play without leaving the app.
sources (m3u playlists / broadcaster APIs / EPG feeds)
-> collector (fetch -> verify -> normalise -> upsert Postgres)
-> onair (Stremio catalog / meta / stream reads Postgres)
-> Stremio client
Both services are Node 24+ / TypeScript / ESM, talk to the same Postgres schema through a Prisma 8 contract, and are deployed independently (the addon as a long-running HTTP service, the worker as a cron process or a Kubernetes CronJob).
The onair addon's channels rendered in Stremio's TV guide:
onair-stack/
onair/ # Stremio addon HTTP server (serves catalog / meta / stream + EPG)
collector/ # Cron-driven scraper worker (fills Postgres, exposes no HTTP)
The whole stack — Postgres, schema bootstrap, addon and worker — ships in
docker-compose.yml:
cp .env.example .env # optional: override ports, credentials, Sentry
docker compose up -d --buildCompose reads docker-compose.yml from the repository root and .env for the
overrides. That brings up Postgres, bootstraps the schema from the shared contract, then
starts the addon and the worker. The addon is served on
http://localhost:8080/manifest.json — paste that URL into Stremio's "Install addon"
dialog.
| Service | Purpose | Port |
|---|---|---|
db |
Postgres 16, data in the pgdata volume |
5432 |
migrate |
one-shot: creates and signs the schema, then exits | — |
onair |
the Stremio addon | 8080 |
collector |
the scraper worker (in-process cron) | — |
docker compose logs -f collector # follow the worker
docker compose down # stop, keep the database
docker compose down -v # stop and delete the database volumeThe worker runs its own cron scheduler by default; set RUN_ONCE=true in .env to turn
it into a one-shot pass instead (for an external scheduler or a Kubernetes CronJob) — and
COLLECTOR_RESTART=no alongside it, so Docker does not restart the finished pass.
Both services use the same Prisma 8 contract (src/prisma/contract.prisma — the two
copies are identical):
- Channel —
name, uniqueslug,country,category,poster,description,externalId(online-television.com key) - Stream —
channelId,name, uniqueslug,url(verified m3u8),resolution(4k | hd | sd | unknown),language,youtubeId - Schedule —
channelId, programmename,poster,description,date,startTime,endTime
category is an enum with 17 values (ENTERTAINMENT, SPORTS, MOVIES, NEWS,
INTERNATIONAL, RADIO, RELIGIOUS, DOCUMENTARY, MUSIC, KIDS, SHOPPING,
LIFESTYLE, CLASSIC_TV, CRIME, ADULT, OUTDOORS_AUTO, GENERAL).
The HTTP service. Exposes a standard Stremio manifest and reads only from Postgres — it never scrapes.
- Manifest
community.onair(v1.0.1), typetv, resourcescatalog/stream/meta,behaviorHints: { configurable: false, epgProvider: true }, and theskip/search/datecatalog extras. - Catalog — channels of a category that have at least one stream, ordered
alphabetically by name, 100 per page (
skip). Searches match channel names case-insensitively. - Meta — a single channel plus today's and tomorrow's programmes, so the detail page survives a midnight refresh.
- Streams — every stream of a channel as
{ url, name, description }, where description is"<resolution or SD> - <language>". - Catalogs —
ENTERTAINMENT,SPORTS,MOVIES,NEWS,INTERNATIONAL,RADIO,RELIGIOUS,DOCUMENTARY,MUSIC,KIDS,SHOPPING,LIFESTYLE,CLASSIC_TV,CRIME,OUTDOORS_AUTO. - Native EPG — when Stremio asks for a catalog with
extra.date, the addon returnsmetasDetailed: one meta per channel with the programmes airing during that UTC day asvideos. Responses carry EPG cache headers (max-age 300,stale-revalidate 1800,stale-error 604800) because programme data goes stale fast. - Observability — Sentry metrics:
catalog-request,catalog-epg-request,catalog-search-request,catalog-meta-request,catalog-stream-request. - Publishing — calls
publishToCentral(CENTRAL_URL)whenNODE_ENV=productionandCENTRAL_URLis set. - Fallback artwork — posters and logos fall back to a Cloudinary-hosted image.
- Docker —
onair/Dockerfile(node:26-alpine), exposes8080,CMD ["node", "dist/src/server.js"].
Config (env): DATABASE_URL, PORT, NODE_ENV, LOGO_URL, CENTRAL_URL, SENTRY_DSN,
SENTRY_ENVIRONMENT, SENTRY_TRACES_SAMPLE_RATE. See
onair/.env.example for the full list and defaults.
Run:
cd onair
cp .env.example .env
npm install
npm run dev # tsx watch src/server.ts
npm run build && npm startFor a full stack (Postgres + addon + worker), use
docker-compose.yml at the repository root.
Keeps Channel / Stream / Schedule fresh. Exposes no HTTP server — scheduling is
in-process node-cron (wrapped by Cronitor for monitoring) or a
one-shot RUN_ONCE=true pass, which is what a Kubernetes CronJob runs.
The list of registered jobs, their cron schedules and their sources is documented in
collector/README.md.
Config (env): DATABASE_URL, NODE_ENV, RUN_ONCE, TZ, LOG_LEVEL, HTTP_TIMEOUT_MS,
HTTP_MAX_RETRIES, HTTP_USER_AGENT, STREAM_HEALTH_CRON, STREAM_HEALTH_BATCH_SIZE,
STREAM_HEALTH_TIMEOUT_MS, STREAM_HEALTH_DEEP_CHECK, STREAM_HEALTH_MAX_DELETE_RATIO,
SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_TRACES_SAMPLE_RATE, CRONITOR_API_KEY,
CRONITOR_ENVIRONMENT, CRONITOR_REGION, CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY,
CLOUDINARY_API_SECRET. See collector/.env.example for the
full list and defaults.
Run:
cd collector
cp .env.example .env
npm install
npm run dev # long-running scheduler
npm run dev:once # RUN_ONCE=true: run all enabled jobs once and exit
npm run build && npm start
npm run start:once # production one-shot (K8s CronJob)For a full stack (Postgres + addon + worker), use
docker-compose.yml at the repository root.
Both services use the Prisma 8 contract pattern:
- Edit the models in
src/prisma/contract.prisma(keep the two copies in sync). - Run
npx prisma contract emitto regeneratecontract.json+contract.d.ts(npm run contract:emitinonair). - Apply the SQL in
migrations/.
- Node >= 24 (
engines),.nvmrcpinsv26.2.0; PostgreSQL >= 15. - Per service:
npm run lint,npm run typecheck,npm run build. - CI (
.github/workflows/ci.yml) lints, typechecks, tests and builds each changed module;docker-collector.ymlpublishes the collector image to Docker Hub onmain.
- Jobs are toggled with the
enabledflag on the collector class, not with an env var. GENERALis a validChannel.categorybut is not exposed as a Stremio catalog.


