Backend Overview
Backend Overview
Section titled “Backend Overview”Understanding the Subtide backend server.
Architecture
Section titled “Architecture”The Subtide backend is a Flask-based REST API that handles:
- Video Processing - Downloading and extracting audio
- Transcription - Converting speech to text using Whisper
- Translation - Translating text using LLM APIs
- Streaming - Real-time translation for Tier 4
graph TB
subgraph Backend[Subtide Backend]
API[Flask API] --> Whisper[Whisper Service]
Whisper --> Translation[Translation Service]
Whisper --> MLX[MLX / Faster Whisper]
Translation --> LLM[OpenAI / OpenRouter]
API --> YouTube[YouTube Service<br/>yt-dlp]
end
style API fill:#4a90e2,stroke:#2c5aa0,color:#fff
style Whisper fill:#7b68ee,stroke:#5a4fcf,color:#fff
style Translation fill:#50c878,stroke:#3a9d5f,color:#fff
style MLX fill:#ffa726,stroke:#f57c00,color:#fff
style LLM fill:#26c6da,stroke:#00acc1,color:#fff
style YouTube fill:#ff6b6b,stroke:#d63031,color:#fff
Deployment Options
Section titled “Deployment Options”| Option | Best For | Setup Difficulty |
|---|---|---|
| Binary | Personal use, quick start | Easy |
| Python Source | Development, customization | Medium |
| Docker | Production, teams | Medium |
| RunPod | GPU acceleration, cloud | Medium |
Quick Start
Section titled “Quick Start”Binary (Fastest)
Section titled “Binary (Fastest)”# Download from releaseschmod +x subtide-backend-macos./subtide-backend-macosDocker (Production)
Section titled “Docker (Production)”cd backenddocker-compose up subtide-tier2Source (Development)
Section titled “Source (Development)”cd backendpython -m venv venvsource venv/bin/activatepip install -r requirements.txt./run.shWhisper Backends
Section titled “Whisper Backends”Subtide supports multiple Whisper implementations:
MLX (Apple Silicon)
Section titled “MLX (Apple Silicon)”Optimized for M1/M2/M3/M4 Macs:
WHISPER_BACKEND=mlx ./subtide-backend- Uses unified memory efficiently
- No separate GPU memory needed
- Best for macOS users
Faster-Whisper (NVIDIA)
Section titled “Faster-Whisper (NVIDIA)”CUDA-accelerated for NVIDIA GPUs:
WHISPER_BACKEND=faster ./subtide-backend- Requires CUDA toolkit
- Significant speedup on supported GPUs
- Best for Linux/Windows with NVIDIA
OpenAI Whisper (Cloud)
Section titled “OpenAI Whisper (Cloud)”Original Whisper implementation:
WHISPER_BACKEND=openai ./subtide-backend- CPU-based (slower)
- Works everywhere
- Fallback option
Model Selection
Section titled “Model Selection”| Model | Size | Speed | Quality |
|---|---|---|---|
tiny |
~39 MB | Fastest | Basic |
base |
~74 MB | Fast | Good |
small |
~244 MB | Medium | Better |
medium |
~769 MB | Slow | Great |
large-v3 |
~1.5 GB | Slowest | Best |
large-v3-turbo |
~800 MB | Fast | Excellent |
Recommended: large-v3-turbo for best speed/quality ratio.
Hardware Requirements
Section titled “Hardware Requirements”Apple Silicon
Section titled “Apple Silicon”| Mac | Memory | Recommended Model |
|---|---|---|
| 8 GB | Limited | tiny, base |
| 16 GB | Good | small, base |
| 32 GB | Excellent | large-v3 |
| 64 GB+ | Optimal | Any model |
NVIDIA GPUs
Section titled “NVIDIA GPUs”| GPU | VRAM | Recommended Model |
|---|---|---|
| RTX 3060 | 12 GB | medium |
| RTX 3090/4080 | 16-24 GB | large-v3 |
| RTX 4090 | 24 GB | Any model |
Environment Variables
Section titled “Environment Variables”Core configuration:
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 5001 |
WHISPER_MODEL |
Model size | base |
WHISPER_BACKEND |
Backend type | Auto |
CORS_ORIGINS |
Allowed origins | * |
See Configuration for full list.
Health Check
Section titled “Health Check”Verify the backend is running:
curl http://localhost:5001/healthExpected response:
{"status": "healthy"}Next Steps
Section titled “Next Steps”- Docker Deployment - Container deployment
- RunPod Deployment - Cloud GPU deployment
- Local LLM Setup - Use local models
- API Reference - API documentation