SanthoshhAK/stms
<p align="center"> <img src="https://iili.io/KhN0ztj.png" alt="Logo" width="400"/> </p>
<p align="center"> A powerful, self-hosted <b>Telegram Stremio Media Server</b> built with <b>FastAPI</b>, <b>MongoDB</b>, and <b>PyroFork</b> โ turn your Telegram channels into a private streaming library you watch in <b>Stremio</b> / <b>Nuvio</b>. </p>
<p align="center"> <img src="https://img.shields.io/badge/UV%20Package%20Manager-2B7A77?logo=uv&logoColor=white" alt="UV Package Manager" /> <img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white" alt="Python" /> <img src="https://img.shields.io/badge/FastAPI-009688?logo=fastapi&logoColor=white" alt="FastAPI" /> <img src="https://img.shields.io/badge/MongoDB-47A248?logo=mongodb&logoColor=white" alt="MongoDB" /> <img src="https://img.shields.io/badge/PyroFork-EE3A3A?logo=python&logoColor=white" alt="PyroFork" /> <img src="https://img.shields.io/badge/Stremio-8D3DAF?logo=stremio&logoColor=white" alt="Stremio" /> <img src="https://img.shields.io/badge/Docker-2496ED?logo=docker&logoColor=white" alt="Docker" /> </p>
๐งญ Contents
- ๐ What is this?
- โจ Key Features
- ๐๏ธ Organizing Your Channels
- ๐ค Adding Files by Forwarding (filename rules)
- ๐ฅ Movies
- ๐บ TV Shows
- ๐งฉ Split Files (`.001`, `.002` โฆ)
- ๐๏ธ Combined / Season-Pack Files
- ๐๏ธ Adding Files Manually (Goa trip, lectures, One Piece)
- ๐ฌ Subtitles (filename rules & manual add)
- ๐ค Supported subtitle filenames
- ๐ Language name & code support
- ๐๏ธ Adding a subtitle manually
- ๐ Catalogs Explained
- ๐ค Auto Catalogs
- ๐ฏ Custom Catalogs
- ๐ Private, Exclusive & Searchable
- ๐ก Special Channels
- ๐ Anime Channel
- ๐ Global Search
- ๐ข Announcement Channel
- ๐ Skip Channel
- ๐ท๏ธ Fixing Wrong Metadata
- ๐ ๏ธ Managing Your Server (logs, restart, update)
- ๐ณ Subscriptions & Access
- ๐ง First-Time Setup (config.env)
- ๐๏ธ Web Settings Page (every option explained)
- ๐ Deployment
- ๐ Heroku
- ๐ณ VPS (recommended)
- ๐ค Hugging Face
- ๐บ Watch in Nuvio / Stremio
- ๐ Contributors
๐ What is this?
This is a self-hosted media server that streams your Telegram files straight into Stremio (or Nuvio). You forward a movie/episode to your channel, and it instantly becomes a permanent, no-expiry streaming link โ with posters, descriptions, seasons and episodes, just like a real streaming app.
Everything is managed from a friendly web panel โ no coding, and almost no bot commands.
โจ Key Features
- โก Ultra-fast, permanent streaming links (no expiry)
- ๐ฌ Automatic posters & details from IMDb / TMDb
- ๐ Auto & custom catalogs (organize by language, platform, or your own lists)
- ๐ Private / exclusive catalogs for premium content
- ๐ณ Subscriptions & access control built in
- ๐งฉ Split-file & multi-part playback as one stream
- ๐ Anime-aware metadata for anime channels
- ๐ Global Search across extra channels
- ๐ข New-content announcements to a channel
- ๐ Search by name, IMDb or TMDB id/link everywhere (manual add, rescan & upload sessions)
- ๐ท๏ธ Auto-stamps the IMDb/TMDb link into indexed captions, so forwarding a file again matches instantly
- ๐ Skip Channel โ files that fail to index are set aside with a "what to fix" note
- ๐ฅ๏ธ Full web configuration panel โ no restarts for most changes
- ๐๏ธ Multiple databases & bot tokens for scale and speed
๐๏ธ Organizing Your Channels (recommended)
You can dump everything into one AUTH channel โ but keeping content in separate channels makes your library far easier to manage, back up, and share with helpers. Each of these is added the same way (as an AUTH channel in Settings), and your bot must be an admin in every one.
A clean layout many people use:
๐ก This is just an organizing habit โ the app reads each file's name to sort it into the right catalog no matter which channel it came from. Separate channels simply keep your side tidy. Remember: a channel should have only one role (Auth / Manual / Announcement / Global Search / Skip); marking an Auth channel as Anime is just a checkbox.
๐ค Adding Files by Forwarding (filename rules)
The easiest way to add content: forward the file to your AUTH channel (the channel you set in Settings, where your bot is an admin). The server reads the file name or caption to figure out the title, year, season/episode, and quality โ then fetches the poster and details automatically.
๐ The better your filename/caption, the better the match. Below is exactly what's supported, with real examples.
๐ฅ Movies
A movie name should contain the title, year, and quality.
โ Good examples
Ghosted 2023 720p WEBRip Hindi x265 HEVC.mkv
Oppenheimer.2023.1080p.BluRay.x264.mkv
3 Idiots (2009) 2160p 4K HEVC.mkv๐บ TV Shows
A TV file should contain the title, season + episode (S01E04 style), and quality.
โ Good examples
Harikatha Sambhavami Yuge Yuge S01E04 1080p WEB-DL.mkv
Loki.S02E03.720p.HEVC.mkv
Panchayat S03E05 Hindi 1080p.mkv๐ก Files that only have an episode number and no season (e.g. anime like One Piece - 1142 (1080p).mkv) can't be auto-forwarded โ use the [Manual Upload Session](#๏ธ-adding-files-manually-goa-trip-lectures-one-piece) with a fallback season.๐งฉ Split Files (.001, .002 โฆ)
Big files that were split into numbered volumes are supported and are joined back into a single stream automatically.
โ
Supported format: filename.ext.NN
Avatar.2009.2160p.BluRay.mkv.001
Avatar.2009.2160p.BluRay.mkv.002
Avatar.2009.2160p.BluRay.mkv.003Forward all parts to the channel โ they play as one file, in order.
โ Why only the `.001 / .002` style? Those numbered volumes are true byte-splits of one single video (like what split, 7-Zip, or WinRAR create). They must be re-joined to play, so the server treats them as one stream. Files named like ... Part 01.mkv, ... CD01.mkv, ... Disc02.mkv are skipped from joining on purpose โ those are usually separate, standalone videos, not pieces of one file, so merging them would break playback.
๐๏ธ Combined / Season-Pack Files
One file that contains multiple episodes (or a whole season) is detected too, and filed neatly under a "Season N Combined" entry.
โ Supported examples
One Piece S01 E01-E13 1080p.mkv โ Season 1, Episodes 1โ13
Naruto.S02.E14-26.Combined.720p.mkv โ Season 2, combined batch
Friends S03 1080p.mkv โ whole Season 3 (no episode number)Recognized range separators: -, โ, ~, +, &, ,, to (e.g. E01-E04, E01 to E04).
๐๏ธ Adding Files Manually (Goa trip, lectures, One Piece)
Use manual adding for personal videos (that TMDb doesn't know) or for special cases like anime with no season number. There are two tools:
- Add Content โ on the Media Management page โ to create a title + add its first file.
- Manual Upload Session โ on the Tools page โ to bulk-add many files to a title (just forward the files, they attach automatically).
๐ Search anywhere: the search boxes in Add Content, Rescan Metadata and the Manual Upload Session all accept a title (with or without a year), an IMDb id/link, or a TMDB id/link. A name is matched on Cinemeta first and falls back to TMDb; an IMDb link forces Cinemeta and a TMDB link forces TMDb.
โจ Not in your library yet? The Manual Upload Session can now pick a title straight from IMDb / TMDB search results โ no need to add it first. Start the session, forward the files, and the title is created automatically. Files added via a session (or a channel scan) also get their IMDb/TMDb link stamped into the caption, so forwarding the same file again later matches instantly.
โ๏ธ First make sure a Manual Channel is set in Settings and your bot is admin there. Personal files must be forwarded only to the Manual Channel.
๐๏ธ Case A โ A Goa trip video (personal)
Single clip โ add as a Movie
- Media Management โ Add Content โ Type = Movie.
- Skip the search box. Enter Title (e.g.
Goa Trip 2024). Everything else is optional. - Paste the Telegram link โ Resolve โ pick Quality โ Add Content. โ
Many clips (Day 1, Day 2โฆ) โ add as a TV Show, then bulk-add the rest with a session (see Case B).
๐งช Case B โ Biochemistry lectures (personal series, many files)
Step 1 โ Create the show once:
- Add Content โ Type = TV Show, Title =
Biochemistry Lectures, Season =1, Episode =1. - Paste lecture 1's link โ Resolve โ Add Content.
Step 2 โ Bulk-add the rest:
- Tools โ Manual Upload Session โ search
Biochemistry Lecturesโ select it. - It's personal + TV, so set Season = 1, leave Episode empty (each file becomes the next episode: E2, E3, E4โฆ). Quality is optional.
- Start session โ forward all the lecture videos to your Manual Channel โ End session. โ
๐ก Want multiple qualities of the same lecture? Set Episode = 5 so every file attaches to Episode 5 instead of creating new episodes.
๐ดโโ ๏ธ Case C โ One Piece with no season (One Piece - 1142 (1080p).mkv)
One Piece is a real TMDb show, but the file has an episode number and no season.
- Make sure One Piece exists in your library (add it once via Add Content, using the search box to auto-fill its details).
- Tools โ Manual Upload Session โ search
One Pieceโ select it. - Because it's a real title, set the Fallback season = 1. (The episode `1142` is read from the filename; the fallback fills the missing season โ stored as S01E1142.)
- Start session โ forward all the
One Piece - #### (1080p).mkvfiles (to your auth or manual channel) โ End session. โ
Quick reference
๐ฌ Subtitles (filename rules & manual add)
You can attach subtitle files (.srt, .vtt, .ass, .ssa, .sub) to any movie or episode. They then show up as selectable subtitle tracks in Stremio / Nuvio. A title can have multiple subtitles (different languages, or several tracks) โ they all appear in the player's subtitle picker.
There are two ways to add them: auto-match by filename (forward to a scanned channel) or add by hand from the web panel (most reliable).
๐ค Supported subtitle filenames
For auto-matching, the subtitle filename needs two things: something that identifies the title/episode, and a language at the end.
โ Movies โ title + year (or an IMDb id), then the language:
Wanted 2008 english.srt
Wanted 2008 ar.srt
tt3326054 arabic.srt
tt3326054 eng.srtโ
TV episodes โ title (or IMDb id) + S01E01, then the language:
Sniffer S01E01 hindi.srt
The.Sniffer.S01E01.arabic.srt
tt3326054 S01E01 eng.srt
tt3326054 S01E01 ar.srt๐ก The language is read from the end of the filename. If it's missing or unrecognized, the subtitle is still stored but labelled Unknown.
๐ Language name & code support
The language is detected from these forms (Arabic shown as an example):
Extra tags like forced, sdh, cc, dubbed at the end are ignored, so Movie 2008 english forced.srt still detects English. The 2-letter form is only matched when it's the final part of the name, so release tags like WEB-DL or HD are never mistaken for a language.
๐๏ธ Adding a subtitle manually
The most reliable way โ no filename guessing, and you can attach several at once. This is ideal for messy release names that don't auto-match.
One-time setup (recommended):
- Make a dedicated Subtitles channel and add your bot as admin there.
- In Settings โ Manual Add Channels, add that channel's
-100โฆID. (A Manual channel isn't auto-indexed, so subtitles there won't be mismatched โ and deleting a subtitle message later auto-removes it from the library.)
Add the subtitle:
- Forward/post the subtitle file to that channel, then copy its message link (
t.me/c/โฆ). - Open the title in Media Management โ Edit.
- Scroll to the Subtitles panel โ click โ Add Subtitle.
- Paste the message link. Use โ Add another to add multiple subtitles in one go.
- The language is auto-detected from the filename โ change it from the dropdown if needed (or set it for
Unknownfiles). - For a series, enter the Season and Episode the subtitle belongs to.
- Click Add Subtitle. It appears in the list, and you can Delete any entry anytime.
โ ๏ธ The file must stay in a channel your bot can read โ it's re-fetched from Telegram on demand (never stored on the server), just like your videos. Don't delete the message unless you also want the subtitle gone.
๐ Catalogs Explained
A catalog is a shelf of titles that appears in Stremio. There are two kinds: Auto (the app builds them) and Custom (you build them). Manage both on the Catalogs page (/catalogs).
๐ค Auto Catalogs
The server can automatically sort your whole library into ready-made shelves โ you just tick which ones you want. It decides where each title belongs using its TMDb details (original language + streaming platform).
Available auto catalogs:
- Enable/disable them on the Catalogs page.
- They update automatically as you add new content; you can also press Sync to rebuild them.
๐ฏ Custom Catalogs
Your own hand-picked shelves โ e.g. My Exclusives, Hindi Dubbed, Kids.
Create one:
- Go to Catalogs โ Create Catalog.
- Give it a name and choose who can see it (visibility โ see below).
Put titles in it (any of these):
- On the Catalogs page โ open the catalog โ search a title โ add it.
- On a title's Edit page (Media Management โ Edit) โ Custom Catalog โ choose the catalog โ Add to Catalog.
- While using Add Content (Manual Add), tick the catalog in the Add to Custom Catalog list.
๐ Private, Exclusive & Searchable
When you create or edit a custom catalog you get three controls:
1) Who can see it (Visibility)
2) Exclusive ๐ Turning Exclusive on locks its titles to this catalog only โ they're removed from every other catalog (auto and custom) and won't reappear elsewhere. Perfect for premium/members-only content you don't want leaking into public shelves.
Exclusive is only available when visibility is Specific users or Owner only (it wouldn't make sense on a public shelf).
3) Searchable ๐ For an exclusive catalog you can decide whether its titles show up in Stremio search:
- Off โ truly hidden: the title can only be reached through this catalog.
- On โ discoverable: allowed users can also find it via search.
How to make a catalog private + exclusive: create/edit it โ set visibility to Owner only (or Specific users) โ toggle Exclusive on โ optionally turn Searchable on. Save.
๐ก Special Channels
All of these are configured on the Settings page. Your bot must be an admin in every channel you use. โ ๏ธ A channel should have only one role โ don't use the same channel as Auth, Manual, Global Search, Announcement and Skip at once. (Marking an Auth channel as Anime is just a checkbox on that same channel, so that's perfectly fine.)
๐ Anime Channel
Anime often needs special handling (correct titles, posters and episode numbers). The server can treat one of your channels as an anime channel and use anime-aware matching for files posted there.
How to use:
- Add the channel to AUTH_CHANNELS in Settings (so its files get indexed).
- Right next to that channel there's an Anime checkbox โ just tick it. โ That's the whole setup.
- Forward your anime files there as usual โ they'll now be matched using anime metadata.
โน๏ธ The Anime tick simply flags an existing auth channel as anime โ you don't add it to any separate field.
๐ Global Search
Normally Stremio only searches titles already in your library. Global Search lets it also search live inside extra Telegram channels that you haven't indexed โ great for pulling in results on demand.
Requirements: a USER_SESSION_STRING in config.env (a userbot login) + one app restart to unlock the feature.
How to use:
- Add
USER_SESSION_STRINGinconfig.env(see setup) and restart once. - In Settings, enable the Global Search toggle.
- Add the channel IDs you want it to search.
- Now when a user searches in Stremio and the title isn't in your local catalog, matching results from those channels appear โ tagged ๐ GLOBAL.
๐ข Announcement Channel
Automatically post a message whenever new content is added, so your members/subscribers always know what's fresh.
How to use:
- In Settings, turn on Announce New Content.
- Set the Announcement Channel (ID or
@username) and add your bot as admin there. - From then on, every newly indexed movie/episode gets announced to that channel.
๐ Skip Channel
Sometimes a forwarded file can't be indexed โ the caption has no title or no quality, or the title just isn't found on Cinemeta/TMDb. Instead of the file silently vanishing, the server can set it aside in a Skip Channel so you can fix it.
How to use:
- In Settings โ Skip Channel, set one channel (ID or
@username) and make your bot an admin there. Files sent to this channel are never indexed. - When a file forwarded to an auth channel fails to index, the bot copies it here and replies with a short note explaining what's missing or wrong (e.g. add a quality like
1080p, add a clearer title, or add an IMDb/TMDB link/id). - Fix the caption and forward it to your main channel again, or add it manually โ your choice.
๐๏ธ Optional: the Delete original on metadata fail toggle (it appears once a Skip Channel is set) removes the file from the main channel after it's copied into the Skip Channel.
๐ท๏ธ Fixing Wrong Metadata
If a title gets matched incorrectly (wrong poster/name) or has no details, fix it in seconds:
Method 1 โ Paste the correct link in the caption
- Copy the correct IMDb or TMDb link of the title.
- Edit the file's caption in your AUTH channel and paste the link anywhere in it.
- The server re-matches it automatically using that link.
Method 2 โ Fix it from the web panel
- Open the title in Media Management โ Edit.
- Click Scan / Rescan Metadata, search the correct title โ by name, or by pasting an IMDb/TMDB id or link โ pick the right result, and apply.
โ The catalog and posters refresh instantly.
๐ ๏ธ Managing Your Server (logs, restart, update)
Everything here is on the Settings page (/admin/settings) โ no terminal needed.
๐ Get the logs
- Settings โ Logs โ click Refresh to view the latest log lines in the browser.
- Click Download to save the full
log.txt(handy when reporting an issue).
๐ Restart the server
- Settings โ Restart App โ click the Restart button.
- The panel goes offline for a few seconds and reconnects automatically when it's back.
๐ Update to the latest code
- The same Restart button also updates: it pulls the newest code from the Upstream Repo / Branch you set in Settings, then restarts.
- So to update: make sure Upstream Repo =
https://github.com/weebzone/Telegram-Stremio(and branch, e.g.master) in Settings โ click Restart. Done. ๐
โ๏ธ Everything else
All other options โ TMDB key, Base URL, channels, subscriptions, proxy, extra databases, multi-token bots, replace mode, hide catalog, etc. โ live on the Settings page and apply instantly, without a restart (the only value that needs a restart is USER_SESSION_STRING, because it lives in config.env).
๐ณ Subscriptions & Access
This is how you control who can watch your library. Two simple ideas power everything:
- ๐ Token = a key. It's the secret inside every install link (
.../stremio/{token}/manifest.json). One token = one person's Stremio install. Anyone holding a working key can watch. - ๐๏ธ Subscription = an optional rent timer on a key (a plan with an expiry date, usually paid through your bot).
You can run your server in one of two modes โ pick the one that fits you.
Everything lives on two web pages (in the top menu):
- ๐ Tokens (
Admin โ Tokens) โ the one place to create keys, set data limits, set expiry, link users, and manage access. - ๐๏ธ Plans (
Admin โ Plans) โ your subscription plans and the list of paying members.
๐ก The owner (you) always has full access โ your key never expires and you're never blocked.
๐ Mode 1 โ Subscription OFF (you hand out keys)
Use this for a private/free server. Turn the Subscription toggle off in Settings. Now you create and give out keys yourself.
Create a key:
- Go to Admin โ Tokens โ click New Token.
- Give it a name (e.g.
Living Room TV, or a friend's name). - (Optional) set a Daily or Monthly data limit in GB โ leave
0for unlimited. - Leave "Never expires" ticked for a permanent key (untick only if you plan to set an expiry).
- Click Create โ a new install link is ready to copy and share.
Manage a key (buttons on each row):
โ Expiry is real here too: if you give a key a date, it stops working after that date. A key with no date simply works forever.
๐ฐ Mode 2 โ Subscription ON (users pay via your bot)
Use this to sell access. Turn the Subscription toggle on in Settings and fill in the Subscription Group ID, Payment Instructions (your UPI / bank / PayPal text), an optional Payment QR image, and the Approver IDs (who can approve payments).
Step 1 โ Make your plans: go to Admin โ Plans โ Add Plan (set the days + price, e.g. 30 days โ โน99). Add as many as you like.
Step 2 โ Let users buy (all inside your bot):
User presses /start โ picks a plan โ sends a payment screenshot
โ an Approver gets it in the bot โ taps โ
Approve (or โ Reject)
โ On Approve: their plan is saved, a key is created automatically,
and they instantly get their install link + a private group inviteStep 3 โ Manage members from Tokens or Plans:
๐ก๏ธ You and your approvers are never kicked from the private group, and never lose access.
๐ How the server decides "can this person watch?"
In plain English, a key is checked in this order:
- ๐ Owner / approver key? โ always allowed.
- โพ๏ธ "Never expires" key? โ always allowed.
- โณ Key has its own expiry date? โ allowed until that date (works in both modes).
- ๐ฐ Subscription mode ON, and none of the above? โ allowed only while their plan is active and they're still in the group.
- ๐ Data limit hit? โ streams pause until the daily/monthly limit resets.
If a key isn't allowed, the person sees a friendly notice in Stremio (e.g. "Plan Expired โ renew from the bot" or "Join Required") instead of the videos.
๐ The personal install link
Every key has its own link:
https://your-domain.com/stremio/{token}/manifest.json- In paid mode the addon's description shows the expiry date.
- There's also a Configure page (
/stremio/{token}/configure) users can open to re-install after you extend their plan.
๐ One person = one key. Linking a Telegram ID that already belongs to another key is blocked, so a user can never end up with two keys. When that user presses /start, the bot reuses their existing key instead of making a new one.๐ง First-Time Setup (config.env)
You only fill in a few values once in config.env. Everything else is configured later from the web Settings page.
cp sample_config.env config.env
nano config.envExample:
API_ID="1234567"
API_HASH="abc123def456ghi789jkl012mno345pq"
BOT_TOKEN="1234567890:AAEabcdEFGhijkLMnOPqrsTUVwxyz12345"
USER_SESSION_STRING=""
OWNER_ID="987654321"
DATABASE="mongodb+srv://user:pass@cluster0.xxxx.mongodb.net/tracking,mongodb+srv://user:pass@cluster0.xxxx.mongodb.net/storage1"
PORT="8000"Where to get each value
- API_ID / API_HASH โ my.telegram.org โ API development tools โ create an app.
- BOT_TOKEN โ @BotFather โ
/newbot. Then add this bot as admin in every media channel. - OWNER_ID โ @userinfobot replies with your numeric ID.
- DATABASE โ two free MongoDB databases from MongoDB Atlas. Create a cluster, add a DB user, allow network access
0.0.0.0/0, copy the connection string, and append a name to each (/trackingand/storage1). You can reuse one cluster with two different DB names. - PORT โ leave
8000unless it's busy.
(Optional) Generate USERSESSIONSTRING โ only for Global Search
Run this in Google Colab (safe โ it's just a "stay logged in" token for your account; revoke anytime from Telegram โ Settings โ Devices):
!pip install pyrogram tgcrypto
import asyncio
from pyrogram import Client
api_id = int(input("API ID: "))
api_hash = input("API HASH: ")
async def main():
async with Client("temp_session", api_id, api_hash) as app:
print("\nYour USER_SESSION_STRING is:\n")
print(await app.export_session_string())
await main()Copy the printed string into config.env. ๐ Keep it private.
Then finish in the web panel
Open your server โ log in with default `admin` / `admin` โ go to Settings. Change the admin password first, then fill in the rest below. Everything on this page is saved to the database and applied instantly โ no restart (the only value that needs a restart is USER_SESSION_STRING, which lives in config.env).
๐๏ธ Web Settings Page (every option explained)
Open Settings (/admin/settings) after logging in. Here's what each card does and where to get the values.
โ๏ธ General
๐ก๏ธ Admin Authentication
๐ฌ Media & Content
๐ณ Subscription (optional)
Turn this on to monetise access. Set the Subscription Group ID, Payment Instructions (your UPI / bank / PayPal text), an optional Payment QR image URL, and the Approver IDs (who can approve payments). Renewal and "join the channel" prompts in Stremio point users back to your bot automatically โ no URL to configure. Full flow in Subscriptions & Access.
๐ Global Search (optional)
Requires USER_SESSION_STRING in config.env plus one app restart. Then enable the toggle and add the channel IDs to search live. Results not in your local catalog are tagged ๐ GLOBAL in Stremio. See Global Search.
๐ข Announcements (optional)
Turn on Announce New Content and set an Announcement Channel to auto-post whenever new media is indexed. See Announcement Channel.
๐ Manual Channel
Set the channel used for hand-added / personal files (these are not auto-indexed). Used by the Manual Upload Session.
๐ Skip Channel
Set one channel where files that fail to index are copied, each with a note describing what to fix. Files here are never indexed. Optionally enable Delete original on metadata fail (shown once a Skip Channel is set) to remove the failed file from the main channel after it's copied. See Skip Channel.
๐ Proxy (optional)
Set an HTTP Proxy URL for outbound metadata/API requests, and optionally show both proxied and direct stream links.
๐๏ธ Extra Storage Databases
Your first two databases (from config.env) are locked as Tracking and Storage 1. Add more MongoDB URIs here to expand capacity โ ๐ข means connected. Remove entries only from the end of the list, since existing media reference databases by position.
๐จ Multi-Token Clients
Add extra bot tokens for faster parallel streaming under heavy load. Create more bots with @BotFather, add them as admins in all your AUTH channels, then paste their tokens here. Applies immediately.
โ Click Save Settings when done โ you're live!
๐ Deployment
This guide helps you deploy on Heroku, a VPS with Docker, or Hugging Face (free).
โ Prerequisites
Before you begin, make sure you have:
- โ A VPS with a public IP (Ubuntu on DigitalOcean, AWS, Vultr, etc.) โ for the VPS route
- โ A domain name โ recommended so Stremio can reach you over HTTPS
๐ Heroku Guide
Follow the ready-made Google Colab tool to deploy on Heroku:

๐ณ VPS Guide (recommended)
Deploy on a VPS using Docker Compose (recommended) or plain Docker.
1๏ธโฃ Step 1: Clone & Configure
git clone https://github.com/weebzone/Telegram-Stremio
cd Telegram-Stremio
cp sample_config.env config.env
nano config.envFill in all required variables, then save with Ctrl + O, Enter, Ctrl + X.
2๏ธโฃ Step 2: Choose a Deployment Method
๐ข Option 1 โ Docker Compose (recommended)
Easier and more maintainable, with config mounting and restart policies.
docker compose up -dYour server runs at โก๏ธ http://<your-vps-ip>:8000
Updating `config.env` later:
- Edit it:
nano config.env - Save:
Ctrl + O,Enter,Ctrl + X - Apply:
docker compose restart
โก The config file is mounted, so you don't need to rebuild โ changes apply on restart.
๐ต Option 2 โ Plain Docker (manual)
docker build -t telegram-stremio .
docker run -d -p 8000:8000 telegram-stremioYour server runs at โก๏ธ http://<your-vps-ip>:8000
3๏ธโฃ Step 3: Add a Domain (recommended)
A. DNS record โ at your domain registrar, add an A record to your VPS IP:
B. Install Caddy (automatic HTTPS + reverse proxy):
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg
chmod o+r /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddyC. Configure Caddy:
- Edit the Caddyfile:
sudo nano /etc/caddy/Caddyfile - Replace its contents with (change the domain, and the port if you changed it):
your-domain.com {
reverse_proxy localhost:8000
}- Reload:
sudo systemctl reload caddy
โ
Your server is now live at โก๏ธ https://your-domain.com
๐ค Hugging Face Guide (free, always-online, no VPS)
Deploy a free, always-online instance โ no VPS, no domain, no Docker knowledge. Hugging Face builds the image on its own servers; you just tap a few buttons.
๐ก How it works: this repo ships a GitHub Action that pushes your code to your Hugging Face Space on every change. The Space then builds the included Dockerfile and runs your server.โญ Step 1: Star this Repository
Open the repo and tap โญ Star at the top right โ github.com/weebzone/Telegram-Stremio
๐ด Step 2: Fork the Repository
Tap Fork (top right) โ Create fork. This gives you your own copy for private secrets and the deploy workflow.
๐ Step 3: Create a Hugging Face Write Token
- Sign in (or sign up) at huggingface.co.
- Go to Profile โ Settings โ Access Tokens.
- Tap Create new token, choose the Write role, and copy it.
๐ Step 4: Create a Docker Space
- Go to huggingface.co/new-space.
- Give it a name, select Docker as the SDK (pick the Blank template).
- Set visibility to Public (required so Stremio/Nuvio can reach your addon).
- Tap Create Space. Your Space ID is
<your-hf-username>/<your-space-name>โ note it down.
๐ Step 5: Add Deploy Credentials to Your GitHub Fork
In your forked repo โ Settings โ Secrets and variables โ Actions:
Add the secret under the Secrets tab and the variable under the Variables tab.
๐ค Step 6: Add Your Bot Secrets to the Space
On your Hugging Face Space โ Settings โ Variables and secrets, add the same values you'd put in config.env:
โน๏ธ Noconfig.envneeded on Hugging Face โ these secrets are read as environment variables. TheDockerfilealready listens on the right port (app_port: 8000is preset in this README).
โถ๏ธ Step 7: Deploy
In your forked repo โ Actions โ select Deploy to Hugging Face Space โ Run workflow. After this first run, every push auto-deploys. Watch the build on your Space page โ once it shows Running, you're live.
๐ฌ Step 8: Use Your Addon
- Open
https://<your-hf-username>-<your-space-name>.hf.space/login - Log in (
admin/admin) and immediately change the password. - In the web Settings page set Base URL to
https://<your-hf-username>-<your-space-name>.hf.space. - Open your bot, send /start โ it returns your manifest URL.
- Add that manifest URL to Stremio/Nuvio and enjoy. ๐
๐งฉ Step 9: Finish the Setup
- Go to
https://<your-hf-username>-<your-space-name>.hf.space/admin/settings. - Fill in the TMDB API key and AUTH channels.
- For everything else, see Web Settings Page.
- Save and enjoy.
๐บ Watch in Nuvio / Stremio
Your server is a standard Stremio-style addon, so it works in any compatible player. For the smoothest experience across devices we recommend [Nuvio](https://play.google.com/store/apps/details?id=com.nuvio.app) โ a free, open-source media hub for Android, Android TV, Fire TV, iOS, Windows and TV that supports addon manifest URLs. (Content was rephrased for compliance with licensing restrictions.)
- Get your manifest URL โ open your bot and send
/start. - Install a player:
- Open the app โ Addons โ paste your manifest URL โ install.
- Done! ๐ Your Telegram library appears in the catalog and streams directly.
๐ก Prefer Stremio? It works too โ just install the same manifest URL.
