- TypeScript 63.9%
- Go 21.4%
- CSS 6.2%
- Shell 5.9%
- JavaScript 1.4%
- Other 1.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| backend | ||
| doc | ||
| frontend | ||
| releases | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| cookies.example.txt | ||
| docker-compose.yml | ||
| Dockerfile | ||
| Dockerfile.diag | ||
| get-docker.sh | ||
| launch.sh | ||
| LICENSE | ||
| README.md | ||
| restart.sh | ||
| SECURITY.md | ||
| start.sh | ||
| stop.sh | ||
| supervisord.conf | ||
🎬 KV-Tube
Your personal YouTube · Self-hosted, private, lightweight
Features • Quick Start • Why KV-Tube? • Deployment • Development • Contributing
Watch, search, and subscribe — just like YouTube, but fully under your control.
✨ Features
🎞️ Video PlaybackHLS streaming with adaptive quality — from 144p to 4K. |
📜 Watch HistoryAutomatically tracked. Always in sync. Never lose your place. |
🔔 SubscriptionsFollow any YouTube channel. Get updates instantly. |
🔍 SearchFull-text search across videos, channels, and history. |
🎵 Background AudioKeep listening with the screen locked — perfect for music. |
📱 PWAInstall as a native app. Works offline. Full-screen experience. |
🌍 Region TuningTailor content and recommendations to any region. |
🌓 ThemesLight, dark, and system-following themes out of the box. |
📺 Rich Channel PagesBanner, avatar, description, subscriber & view counts, and infinite-scrolling videos. |
⚡ Fast & ResilientAggressive caching, multi-client yt-dlp fallback, and lazy metadata hydration. |
📥 Server-side DownloadsDownload any video straight to your device as an MP4. The server fetches it with yt-dlp and streams a live progress bar — no ads, no client-side hacks. Pick from three quality tiers: Low (≤360p), Recommended (≤1080p), or Best. |
🧹 Self-cleaning CacheDownloaded files live in a temp server cache (30-minute TTL) and are purged automatically — nothing piles up on your disk. |
📱 Android AppNative Android client built with Kotlin & Jetpack Compose. Material 3 design, ExoPlayer video playback, on-device NewPipeExtractor downloads, share to any app, download progress with badge indicator, dark/light themes, and auto-updates via GitHub/Forgejo releases. |
⬇️ On-device DownloadsDownload videos directly on your Android device using NewPipeExtractor stream extraction. Three quality tiers (Low 360p, Recommended 1080p, Best) with background download via WorkManager. Search, rename, sort, and delete downloaded files from the Downloads tab. |
🚀 Quick Start
Pull the pre-built image and run it — no local build needed:
mkdir -p kv-tube/data && cd kv-tube
curl -O https://raw.githubusercontent.com/vndangkhoa/kv-tube/main/docker-compose.yml
docker compose up -d
Prefer building from source?
git clone https://github.com/vndangkhoa/kv-tube.git
cd kv-tube
mkdir -p data
docker build -t kv-tube:latest .
docker compose up -d
Frontend: http://localhost:5011 • API: http://localhost:8981
📥 Container Images
Pre-built images are published to three registries:
| Registry | Image |
|---|---|
| Docker Hub | vndangkhoa/kv-tube:latest |
| GitHub Container Registry | ghcr.io/vndangkhoa/kv-tube:latest |
| Forgejo | git.khoavo.myds.me/vndangkhoa/kv-tube:latest |
🌐 Source Repositories
The project is mirrored on GitHub and Forgejo — both stay in sync:
- GitHub: https://github.com/vndangkhoa/kv-tube
- Forgejo: https://git.khoavo.myds.me/vndangkhoa/kv-tube
🤔 Why KV-Tube?
YouTube is incredible — but it's also ad-ridden, tracks everything, and sometimes removes the videos you love.
KV-Tube gives you:
- Privacy — No tracking, no algorithms manipulating you. Your watch history stays on your machine.
- Permanence — Videos you subscribe to stay available. No takedowns, no region blocks.
- Ownership — Run it on your NAS, your VPS, or a Raspberry Pi. It's yours.
- Simplicity — One container. One command. Zero configuration.
📖 Backstory
I built KV-Tube because I wanted a way to watch YouTube content without the YouTube baggage — ads, recommendation rabbit holes, and the feeling that the product was me, not the video player.
What started as a simple Go API to proxy video streams evolved into a full-featured frontend with subscriptions, search, PWA support, and a clean, YouTube-like interface. It runs on my Synology NAS at home, and I use it daily.
If that resonates, give it a star ⭐ — it helps others find the project.
🏗️ Architecture
KV-Tube ships as a single Docker image. Everything runs in one container, managed by supervisord.
| Layer | Tech | Port | Role |
|---|---|---|---|
| Backend | Go + Gin | 8080 |
REST API, video fetching, yt-dlp orchestration |
| Frontend | Next.js 16 | 3000 |
SSR, PWA, responsive UI |
| Process Manager | supervisord | — | Keeps backend + frontend alive |
| Storage | SQLite | — | Watch history, subscriptions, metadata |
📦 Deployment
🐳 Docker Compose (Recommended)
Using the pre-built image from Docker Hub:
services:
kv-tube:
image: vndangkhoa/kv-tube:latest
container_name: kv-tube
platform: linux/amd64
ports:
- "5011:3000"
- "8981:8080"
volumes:
- ./data:/app/data
environment:
- KVTUBE_DATA_DIR=/app/data
- GIN_MODE=release
- NODE_ENV=production
- CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5011
restart: unless-stopped
Or pull from another registry — swap the image line:
image: ghcr.io/vndangkhoa/kv-tube:latest
# image: git.khoavo.myds.me/vndangkhoa/kv-tube:latest
Prefer building locally? Replace image: with build: ..
🖥️ Synology NAS (DSM 7.2+)
- Create folder
/volume1/docker/kv-tube/data - Upload
docker-compose.yml,Dockerfile,supervisord.conf - In Container Manager → Project → Create, select the folder
- Done. The container builds and starts automatically.
🛠️ Multi-arch Build
docker buildx build --platform linux/amd64 -t kv-tube:latest --push .
⚙️ Configuration
| Variable | Default | Description |
|---|---|---|
KVTUBE_DATA_DIR |
/app/data |
Path for SQLite DB and data |
GIN_MODE |
release |
Gin framework log mode |
NODE_ENV |
production |
Node.js environment |
CORS_ALLOWED_ORIGINS |
"" |
Comma-separated allowed origins |
PORT |
8080 |
Backend API listen port |
💻 Development
# Frontend
cd frontend
npm install
npm run dev
# Backend
cd backend
go run main.go
# Android App
cd android
# Ensure JAVA_HOME points to JDK 17
./gradlew assembleDebug
# Install on emulator/device
adb install app/build/outputs/apk/debug/app-debug.apk
🤝 Contributing
Contributions are welcome! Here's how to help:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing) - Open a Pull Request
Please make sure to follow existing code style and add tests when possible.
📄 License
Distributed under the MIT License. See LICENSE for more information.
If you find this project useful, please ⭐ star it on GitHub.
Built with ❤️ by Khoa Vo