Your personal, self-hosted media server β powered by Telegram.
Stream and manage your Telegram files on any device β TV, Mobile, or Browser β without downloading the entire file. TelePlay uses Telegram as unlimited cloud storage and streams content on-demand at high speed using its multi-client parallel download technology. Upload via a Telegram Bot, organize through a Web App, and watch anywhere.
π€ Telegram Bot β Full Command List
- Upload any file type (video, audio, documents, photos)
- Organize files into folders with inline buttons
- Rename, move, and delete files via chat commands
- Search your library with
/myfiles - Get an auto-login web link with
/web
π Web App β Login Methods
- Full file browser with folder navigation
- Multi-select, batch delete, rename, and move operations
- Context menu (right-click) on files
- Inline video/audio player with seeking
- Three login methods (direct link, login code, remote authorization)
- Responsive β works on desktop and mobile
πΊ Android TV & Mobile App β Installation Guide
- Designed for TV with D-Pad / remote control navigation
- Continue Watching and Recently Added rows on the home screen
- Full-screen ExoPlayer playback with transport controls
- Download files for offline playback (Mobile)
- Picture-in-Picture mode (Mobile)
- Watch progress automatically synced with the server
β‘ Platform β Architecture Overview
- Zero local storage β all files live on Telegram's unlimited cloud
- Multi-user β each Telegram user gets an isolated library
- High-speed streaming β optional multi-bot parallel downloads
- Restricted access β whitelist allowed users with
AUTH_USERS - Public sharing β generate signed, time-limited links
- One-command deploy β Docker Compose, Railway, Render, or CapRover
You Telegram Cloud Your Server Your Devices
βββ ββββββββββββββ βββββββββββ ββββββββββββ
β β
β 1. Send file to Bot βββββββββββββββββββββββββββΊ β
β 2. Bot forwards to ββββΊ β (Private Channel)
β Storage Channel β
β β 3. Saves metadata
β β to Database
β β
β 4. Open Web / TV App ββββββββββββββββββββββββββββ
β β
β 5. Press Play βββββββββββββββββββββββββββββββΊ β
β 6. Fetches chunks βββ β (from Telegram)
β 7. Streams to you βββββββββββββββββββββββββββ β
β β
Your files are never stored on your server β TelePlay streams them directly from Telegram's cloud on demand.
Prerequisites β Detailed Steps
| Requirement | How to get it |
|---|---|
| Telegram Bot Token | Create via @BotFather |
| API ID & Hash | Register at my.telegram.org |
| Storage Channel | Create a private channel, add your bot as admin |
| Docker | Install Docker |
git clone https://github.com/yourusername/teleplay.git
cd teleplay
cp .env.example .envEdit .env with your credentials:
TELEGRAM_API_ID=12345678
TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890
TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
TELEGRAM_STORAGE_CHANNEL_ID=-100xxxxxxxxxx
JWT_SECRET=your-super-secret-key-at-least-32-characters
# Use PostgreSQL (recommended) or SQLite (no setup needed):
DATABASE_URL=sqlite:///./data/teleplay.db
# DATABASE_URL=postgresql://postgres:password@db:5432/teleplaydocker compose up -dThat's it! Your services are now running:
| Service | URL |
|---|---|
| Web App | http://localhost |
| Backend API | http://localhost:8000 |
- Open Telegram and send a video file to your bot.
- Send
/webto get a link to your Web App. - Stream your files! π¬
For detailed setup, usage, and login instructions, see the Setup & Usage Guide.
For VPS, Railway, Render, and CapRover deployments, see the Deployment Guide.
Download the APK from the Releases page:
| APK | Best For |
|---|---|
arm64-v8a |
Modern TV boxes, phones, NVIDIA Shield |
universal |
Any device (if unsure, use this one) |
Setup:
- Install the APK on your device.
- Enter your Server URL (e.g.,
http://192.168.1.100). - A 6-digit code will appear β send
/login CODEto your bot. - Done! Browse and stream your library.
For APK signing and release automation, see the Releasing Guide.
| Variable | Required | Description |
|---|---|---|
TELEGRAM_API_ID |
β | From my.telegram.org |
TELEGRAM_API_HASH |
β | From my.telegram.org |
TELEGRAM_BOT_TOKEN |
β | From @BotFather |
TELEGRAM_STORAGE_CHANNEL_ID |
β | Private channel ID (starts with -100) |
JWT_SECRET |
β | Secret key for JWT signing (min 32 chars) |
DATABASE_URL |
β | Database connection URL (see below) |
WEB_BASE_URL |
β | Public URL of the web app |
TELEGRAM_HELPER_BOT_TOKENS |
β | Extra bot tokens for parallel downloads |
AUTH_USERS |
β | Comma-separated Telegram IDs for restricted access |
π‘ DATABASE_URL Options:
- PostgreSQL (recommended):
postgresql://postgres:password@localhost:5432/teleplay- SQLite (no setup needed):
sqlite:///./data/teleplay.dbUse SQLite if you don't want to set up PostgreSQL β it works out of the box for small deployments.
| Layer | Technology |
|---|---|
| Backend | Python 3.11+, FastAPI, Uvicorn |
| Telegram | PyroTGFork (MTProto) |
| Database | PostgreSQL (prod) / SQLite (dev), SQLAlchemy 2.0 |
| Auth | JWT (Access + Refresh Tokens) |
| Web | React 18, TypeScript, Vite |
| Android | Kotlin, Jetpack Compose for TV, ExoPlayer |
| Deploy | Docker, Docker Compose, Nginx |
π Project Structure β Full Breakdown
teleplay/
βββ backend/ # Python backend (FastAPI + Bot)
β βββ app/
β β βββ routers/ # API endpoints (auth, files, folders, streaming, tv)
β β βββ bot.py # Telegram bot command handlers
β β βββ streaming.py # Multi-client parallel streaming engine
β β βββ models.py # SQLAlchemy ORM models
β β βββ main.py # FastAPI app entry point
β βββ Dockerfile
β βββ requirements.txt
βββ web/ # React web interface
β βββ src/
β β βββ components/ # UI components
β β βββ lib/api.ts # API client & hooks
β β βββ App.tsx # Main app with routing
β βββ Dockerfile
βββ android/ # Android TV & Mobile app
β βββ app/src/main/java/ # Kotlin (Compose + ExoPlayer)
βββ docs/ # Documentation
β βββ ARCHITECTURE.md # Technical deep-dive
β βββ DEPLOYMENT.md # Deployment guide
β βββ SETUP.md # Setup & usage guide
β βββ RELEASING.md # APK release process
βββ docker-compose.yml
βββ .env.example
cd backend
python -m venv venv
venv\Scripts\activate # Linux/Mac: source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # Edit with your credentials
uvicorn app.main:app --reloadcd web
npm install
npm run devOpen the android/ folder in Android Studio and build.
π Security β Details
- JWT Authentication β Short-lived access tokens with refresh token rotation
- User Authorization β Optional
AUTH_USERSwhitelist - Rate Limiting β SlowAPI middleware on all endpoints
- CORS Protection β Restricted to configured origins
- Input Validation β Pydantic schemas prevent injection attacks
- Security Headers β Standard headers on all responses
| Guide | Description |
|---|---|
| Setup & Usage | How the app works, bot commands, login methods, and troubleshooting |
| Deployment | Docker, VPS, Railway, Render, and CapRover deployment |
| Architecture | Technical deep-dive: streaming engine, API endpoints, database models |
| Releasing | APK build automation and signing via GitHub Actions |
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.
- PyroTGFork β Telegram MTProto library
- FastAPI β Modern Python web framework
- React β Frontend library
- Jetpack Compose for TV β Android TV UI toolkit
- ExoPlayer β Android media player









