This guide is designed for everyone, even if you've never used Docker or deployed a website before. Follow these steps carefully to get your media streaming server up and running.
- Step 1: Get Telegram Credentials
- Step 2: Choose Your Platform
- Step 3: Post-Deployment Setup
- ❓ Troubleshooting
You need three things from Telegram to make this work:
- Log in to my.telegram.org using your phone number.
- Click on "API development tools".
- Create a new "App" (you can name it "TelePlay").
- Once created, you will see
App api_idandApp api_hash. Copy these and keep them safe.
- Open Telegram and search for @BotFather.
- Send the command
/newbot. - Follow the instructions to name your bot.
- @BotFather will give you an API Token. It looks like
123456:ABC-DEF1234.... Copy this.
To increase download speeds, you can create multiple bots (e.g., "TelePlay Helper 1", "TelePlay Helper 2").
- Get the tokens for each from @BotFather.
- Crucial: Add every helper bot as an Administrator to your Storage Channel.
- Create a Private Channel in Telegram.
- Add your new bot as an Administrator in that channel with permission to post messages.
- To find the Channel ID:
- Forward a message from the channel to @userinfobot.
- It will reply with the "Id". It usually starts with
-100...(e.g.,-100123456789). - Alternatively, use the web version of Telegram; the ID is in the URL after
/#-.
Best if you just want to see it working on your own computer.
- Install Docker Desktop: Download and install it from docker.com.
- Setup Folder:
- Download the code (Clone or Zip).
- Open the project folder on your computer.
- Configure Settings:
- Go to the
backend/folder. - Find
.env.exampleand rename it to.env. - Open
.envin a text editor (like Notepad) and fill in yourAPI_ID,API_HASH, andBOT_TOKEN.
- Go to the
- Run it:
- Open a terminal/command prompt in the main project folder.
- Type:
docker compose up -d --build
- Access: Open your browser to http://localhost.
Best for "one-click" cloud deployment. Very fast to set up.
- Create a Railway.app account.
- Click "New Project" -> "Deploy from GitHub repo".
- Select your repository.
- Settings Configuration:
- Go to Settings tab.
- Under Build, set "Dockerfile Path" to
Dockerfile(in the root).
- Add Variables:
- Go to the Variables tab.
- Click "New Variable" and add:
TELEGRAM_API_IDTELEGRAM_API_HASHTELEGRAM_BOT_TOKENTELEGRAM_STORAGE_CHANNEL_IDJWT_SECRET(A random long string of letters)
- Done! Academy will build and give you a URL.
Another great cloud option with persistent storage.
- Create a Render.com account.
- Click "New" -> "Web Service".
- Connect your GitHub repository.
- Runtime: Select Docker.
- Advanced Settings:
- Dockerfile Path:
./Dockerfile - Build Context:
.
- Dockerfile Path:
- Environment Variables: Add all the variables mentioned in the Railway section above.
- Disks (Crucial):
- Scroll to the bottom and click "Add Disk".
- Name:
session-data - Mount Path:
/app/session - Size:
1GB(This keeps you logged in even if the server restarts).
Best if you already have a VPS with CapRover installed. It provides a "One-Click" like experience for your own server.
-
Dashboard Setup:
- Log in to your CapRover dashboard.
- Click "Apps" and create a new app (e.g.,
teleplay). - Click on the app name to open its settings.
-
Persistent Storage (Crucial):
- Go to "App Configs".
- Under "Persistent Directories", click "Add persistent directory".
- Path in App:
/app/session - Label:
teleplay-session - This ensures your session data is not lost when the app restarts.
-
Environment Variables:
- Stay in "App Configs".
- You need to add all the variables listed in the Environment Variables Guide below.
- Click "Add Environment Variable" for each one.
-
Network Settings:
- Set the Container Port to
8000.
- Set the Container Port to
-
Deployment:
- Go to "Deployment" tab.
- Method 1 (Git): Connect your GitHub repo. CapRover will find the
captain-definitionfile and start building immediately. - Method 2 (CLI): Run
caprover deployfrom your local folder.
-
HTTPS:
- Go to "HTTP Settings".
- Click "Enable HTTPS".
- Check "Force HTTPS".
For users who want full control over their own server.
- SSH into your VPS.
- Clone the repo:
git clone <repo_url> teleplay && cd teleplay - Setup environment:
cd backend cp .env.example .env nano .env # Enter your keys cd ..
- Start everything:
docker compose up -d --build - Access via
http://your-vps-ip.
- Login:
- Visit your website URL.
- Click "Login with Telegram".
- You might see a code on the screen. Send this code to your bot in Telegram!
- Android TV:
- Download the APK from the GitHub releases.
- Install it on your TV (you may need to enable "Unknown Sources").
- Enter your server URL (e.g.,
https://myteleplay.up.railway.app).
Your Server URL is the address where your app is running. You need this to log in to the Web App and to connect your Android TV.
| Platform | How to find your URL | Example |
|---|---|---|
| Local Machine | Open terminal and type ipconfig. Look for IPv4 Address. |
http://192.168.1.100 |
| VPS / Docker | Use the Public IP of your VPS provider's dashboard. | http://159.65.123.45 |
| Railway | Go to Settings -> Public Networking -> Domains. | https://teleplay.up.railway.app |
| Render | Go to your Web Service Dashboard, URL is at the top. | https://teleplay.onrender.com |
| CapRover | Go to Apps -> [Your App] -> URL. | https://teleplay.apps.mydomain.com |
Important
- If you are using Android TV on the same Wi-Fi as your PC, use the Local Machine IP (e.g.,
http://192.168.1.xxx).
These are the "keys" that make the application work. You must add these regardless of which platform you choose.
| Variable | How to get it |
|---|---|
TELEGRAM_API_ID |
From my.telegram.org (See Step 1.1). |
TELEGRAM_API_HASH |
From my.telegram.org (See Step 1.1). |
TELEGRAM_BOT_TOKEN |
From @BotFather (See Step 1.2). |
TELEGRAM_STORAGE_CHANNEL_ID |
From your private channel (See Step 1.4). Starts with -100. |
JWT_SECRET |
A long, random string (e.g., s0me_v3ry_l0ng_p4ssw0rd_123). You can make this up, but keep it secret! |
DATABASE_URL |
The path to your database. See the Database Setup Guide below. |
WEB_BASE_URL |
The public URL where you visit the app (e.g., https://teleplay.your-vps.com). |
TELEGRAM_HELPER_BOT_TOKENS |
(Optional) Comma-separated tokens for extra bots to speed up downloads. |
AUTH_USERS |
(Optional) Comma-separated Telegram User IDs allowed to use the bot. Leave empty for everyone. |
TelePlay supports two types of databases: PostgreSQL (Professional/Stable) and SQLite (Simple/Local).
SQLite is a simple file-based database. No extra server needed.
- URL Format:
sqlite:///./data/teleplay.db - Best for: Running on your own computer (Local Machine) or a small VPS with few users.
- Note: Not recommended for Railway/Render without persistent storage for the file.
PostgreSQL is a powerful, separate database server. It is the best choice for a stable web app.
- URL Format:
postgresql://username:password@hostname:port/database_name
- Cloud (Railway/Render): Both platforms let you add a "PostgreSQL" service to your project with one click. They will automatically give you the
DATABASE_URL. - CapRover:
- Go to "Apps" -> "One-Click Apps".
- Search for "Postgres".
- Install it and note the password/hostname.
- External (Supabase - Recommended):
- If you don't want to host your own database, go to Supabase.com.
- Create a new project (it's free).
- Go to Settings -> Database.
- Copy the Connection String (use the "URI" or "Direct Connection" string) and use it as your
DATABASE_URL. - Important: If utilizing Supabase, ensure the connection string starts with
postgresql://.
- "Port already in use": Another app is using port 80. You can change the port in
docker-compose.yml. - "Missing Variables": Double-check your
.envfile. Do not use quotes around the values unless they have spaces. - "Connection Timeout": If on a VPS, make sure ports 80 and 8000 are open in your firewall.