Ship live translations
with confidence
A production-ready full-stack Node.js + React application for seamless EN↔RU↔UK live auto-detect translation with voice synthesis.
⚙
Installation
Set up the project locally with Docker, Redis, and LibreTranslate in minutes.
▦
Architecture
Understand the STT → Translation → TTS pipeline and real-time Socket.io communication.
▶
Live Translation
Stream from YouTube or microphone with automatic EN/RU/UK language detection and voice output.
📜
Biblical Simulator
Test the full pipeline with AI-generated biblical passages in King James, Church Slavonic, or Ukrainian style.
🎤
Voice Training
Clone custom voices from microphone recordings or YouTube videos using ElevenLabs IVC.
Prerequisites
●
Node.js 20+
Runtime for backend and build tools
●
Docker + Docker Compose
For Redis and LibreTranslate services
●
yt-dlp + ffmpeg
Required for YouTube audio extraction
●
ElevenLabs API Key
For speech-to-text and text-to-speech
Clone & Configure
git clone https://github.com/Pzharyuk/live-translator-node.git && cd live-translator-node
cp .env.example .env
Edit .env and set your API key:
ELEVENLABS_API_KEY=sk-your-key-here
ADMIN_PASSWORD=your-secure-password
Start Infrastructure
# Start Redis + LibreTranslate
docker compose -f docker-compose.local.yml up -d
# Wait for LibreTranslate to download language models (~500 MB)
docker logs -f $(docker ps -qf "name=libretranslate") 2>&1 | grep -i "running"
Start Backend
cd backend
npm install
npm run dev # nodemon watches for changes
Start Frontend
cd frontend
npm install
npm run dev # Vite hot-reload on localhost:5173
✓
You're all set!
Open http://localhost:5173 — log in with user / changeme and you will be redirected to /translate. Admin panel: http://localhost:5173/admin (admin password: admin123).
1
Start the services
Follow the Installation guide to get Docker services, backend, and frontend running.
2
Open the Admin Panel
Navigate to http://localhost:5173/admin and enter the admin password.
3
Select a Voice
Choose a TTS voice from the dropdown. The voice list is fetched from your ElevenLabs account.
4
Test with Text
Use the free-text area in the admin panel to type a phrase. Click translate to hear the TTS output instantly.
5
Go Live
Open the user view at http://localhost:5173/translate. Select "Mic" as input, pick a voice, and click Start. Speak into your microphone and watch real-time translation appear with audio playback.
💡
Try the Biblical Simulator
For a hands-free demo, enable the biblical_simulator feature flag in admin, enter an Anthropic API key, select a language, and click "Generate". The system will produce biblical passages through the full STT → Translation → TTS pipeline.
System Overview
Frontend
React 19 + Vite
Socket.io Client
Web Audio API
↔
Backend
Express + Socket.io
TypeScript
Service Layer
ElevenLabs
Scribe v2 (STT)
TTS Streaming
Voice Cloning
Translation
Google Translate (Cloud API)
LibreTranslate (self-hosted)
DeepL (premium API)
Claude / Anthropic (AI)
Redis
Feature Flags
Settings Store
Google Gemini
Biblical Simulator
Sermon Generation
Voice Training Text
DeepL
Free & Pro tiers
Auto endpoint detection
Church Directory
Central church registry
Live selector feed
Data Flow
1 Audio Input (Mic / YouTube / Simulator)
↓
2 PCM 16-bit LE @ 16kHz via Socket.io chunks
↓
3 ElevenLabs Scribe v2 WebSocket STT
↓
4 Commit Merge Buffer 2.5s VAD aggregation
↓
5 Translation Provider Google / LibreTranslate / DeepL / Claude
↓
6 ElevenLabs TTS Voice synthesis streaming
↓
7 Audio Playback Queued with 600ms pause
Key Architecture Decisions
Two-layer Language Detection
LibreTranslate's /detect endpoint returns 0-confidence for short Cyrillic phrases. The app uses script-based pre-detection (Unicode 0x0400–0x04FF = Cyrillic) combined with ElevenLabs Scribe's language_code output for reliable EN/RU/UK auto-detection.
VAD Commit Merging
Voice Activity Detection can fire aggressively on speaker breathing. Commits are buffered for 2.5 seconds before translation to merge fragments into meaningful phrases.
Feature Flag Merging
YAML config defaults are merged with Redis runtime overrides. Redis values take priority, falling back to YAML if Redis is unavailable.
API Key Hierarchy
Keys resolve in order: Runtime Cache → Redis → Config File → Empty. This allows hot-swapping keys without restarts.
Multi-church Isolation
Multi-church: Each church runs its own isolated deployment (own backend, Redis, database) at translate-<church>.hgministry.com. A church selector on the broadcast page lets listeners switch churches; the menu is fed by a central directory that updates live without touching running broadcasts. Audio, transcripts, and translations never cross between churches.
Connection Lifecycle
- Client sends
start_session with source type (mic or youtube) and optional voiceId
- Backend opens a WebSocket to
wss://api.elevenlabs.io/v1/speech-to-text/realtime
- For YouTube: spawns
yt-dlp | ffmpeg child processes to extract PCM audio
- For Microphone: awaits
audio_chunk events from the frontend
Audio Streaming
Audio chunks are sent to Scribe as JSON messages:
{
"message_type": "input_audio_chunk",
"audio_base_64": "UklGR..." // PCM 16-bit LE, 16kHz, mono
}
Scribe Responses
| Response Type | Meaning | Action |
partial_transcript |
Live partial text (speculative) |
Emitted as non-final transcript event |
committed_transcript |
VAD fired — complete phrase |
Buffered for commit merge window |
Commit Merge Buffer
After receiving a committed_transcript, the backend waits 2.5 seconds (COMMIT_MERGE_MS) to collect additional commits before translating. This prevents fragmented translations from aggressive VAD.
Stability Timeout
If VAD stalls (no new commits), a 3.5 second fallback timer (STABILITY_TIMEOUT_MS) fires to translate whatever new text has accumulated, preventing indefinite silence.
Text Validation
Before translation, text is validated against EN/RU/UK character regex patterns. This filters out hallucinated text from the STT model (common with silence or background noise).
Provider Chain
The system supports three translation providers with automatic fallback:
Default
LibreTranslate
Self-hosted, no API key required. Runs in Docker alongside the app. Best for privacy and cost.
Premium
DeepL
High-quality translations. Supports both free and paid API tiers. Auto-detects endpoint.
AI
Claude
Anthropic's Claude for context-aware translations. Uses claude-haiku-4-5 for speed.
Fallback Logic
1. Try primary provider (admin-selected)
2. If primary fails → try configured fallback
3. If fallback fails → try LibreTranslate (last resort)
4. If all fail → emit error event
Language Detection
The app uses a two-layer auto-detection approach:
Layer 1: Script-based Pre-detection
Before calling any translation API, the backend checks Unicode character scripts:
- Cyrillic characters (Unicode 0x0400–0x04FF) → if >50% of matched letters are Cyrillic, detected as Russian
- Latin characters → detected as English
- This avoids low-confidence results from LibreTranslate's
/detect endpoint on short text
Layer 2: STT Language Code
When the auto_language_detect flag is enabled, ElevenLabs Scribe returns a language_code with each transcript commit. The backend uses this to correctly route EN/RU/UK without relying solely on script detection.
Note: For LibreTranslate, both Russian and Ukrainian Cyrillic text is passed with source ru since LibreTranslate handles Ukrainian text acceptably via the Russian model. DeepL and Claude providers distinguish Ukrainian natively and handle uk as a proper source language.
Language Gating
Detected languages are checked against the admin-approved pool. If a detected language isn't in the allowed set, the translation is rejected to prevent hallucinated language outputs.
TTS Pipeline
After translation, the text is sent to ElevenLabs TTS:
const stream = await client.textToSpeech.stream(voiceId, {
text: translatedText,
model_id: "eleven_multilingual_v2",
output_format: "mp3_44100_128",
voice_settings: {
stability: 0.5,
similarity_boost: 0.75,
style: 0.0,
speed: 1.0,
use_speaker_boost: true
}
});
Audio Delivery
TTS audio is streamed to a Buffer, then emitted as a base64-encoded MP3 via the tts_audio Socket.io event.
Frontend Playback Queue
The frontend maintains an audio queue to prevent overlapping playback:
- Received
tts_audio events are queued
- Each segment plays to completion before the next starts
- A configurable pause (600ms default) is inserted between segments
- The pause duration is controlled by
tts_segment_pause_ms (adjustable in admin)
Microphone Input
- User selects "Mic" tab and chooses a TTS voice
- Browser captures audio via Web Audio API's
ScriptProcessor
- PCM 16-bit LE at 16kHz sample rate sent to backend via Socket.io
- Backend pipes audio to ElevenLabs Scribe v2 Realtime WebSocket
- Language auto-detected (EN/RU/UK), text translated and synthesized
- TTS audio returned and played back with inter-segment pauses
YouTube Input
- User pastes a YouTube URL (live stream or video)
- Backend spawns
yt-dlp | ffmpeg child processes
- Audio extracted as PCM stream (16kHz, 16-bit LE, mono)
- Piped to Scribe v2, same pipeline as microphone
- Stream ends when YouTube content ends or user stops
User Interface
The user view features a dark cavern theme with:
- Waveform visualizer — Canvas-based bar chart with orange gradient and cyan tips
- Transcript display — White translated text scrolls upward with fade masks
- Partial transcript — Shown in italic orange while STT is processing
- Source tabs — Toggle between Mic and YouTube (controlled by feature flags)
Congregation Viewer (/broadcast)
The public receiver page shows translated text only. Each line carries a small direction chip (RU → EN / EN → RU) so a viewer can see which way translation is currently running — it flips with the speaker — followed by the translation itself. The original-language line that used to sit beneath each translation was removed: it halved the space available for the text people actually read.
The translation is set in a responsive size — clamp(26px, 3.2vw, 34px) — so it stays comfortably readable on a phone held at arm's length and scales up on a laptop without turning a single sentence into a headline. Scrolling, the “Back to top” button, the fade masks, the live partial transcript, and the mute/TTS controls are unchanged.
How It Works
The backend uses yt-dlp and ffmpeg as child processes to extract audio from YouTube URLs:
yt-dlp (best audio) → ffmpeg (PCM 16kHz 16-bit LE mono) → Scribe v2
Supported Sources
- Live streams — Translates in real-time as the stream progresses
- Regular videos — Processes the full audio track
- Any URL supported by yt-dlp (YouTube, etc.)
Requirements
Both yt-dlp and ffmpeg must be installed and available in the system PATH. On macOS:
brew install yt-dlp ffmpeg
⚠
Feature Flag Required
YouTube input is controlled by the youtube_input feature flag. Enable it in the admin panel to show the YouTube tab in the user view.
Overview
The Biblical Transcript Simulator is an admin-only feature that generates biblical text passages using Google's Gemini API (gemini-2.5-flash), then routes them through the full translation pipeline. This provides a hands-free way to test STT → Translation → TTS without a live audio source.
Language Styles
| Language | Style | Example |
en |
King James English |
"In the beginning was the Word..." |
ru |
Church Slavonic Russian |
"В начале было Слово..." |
uk |
Traditional Ukrainian |
"На початку було Слово..." |
Flow
- Admin selects language (EN/RU/UK)
- Backend calls Gemini 2.5 Flash with streaming
- Gemini generates 6-8 biblical passages, 3-5 sentences each
- Stream is buffered until 140+ characters AND complete sentences
- Chunks emitted with 1800ms smooth pacing between them
- Each chunk flows through the standard pipeline:
- Emitted as
transcript (isFinal: true)
- Auto-translated via configured provider
- TTS synthesized and audio returned
- Frontend plays audio with standard inter-segment pause
💡
Feature Flag
Enable biblical_simulator in the admin feature flags panel. The Gemini API key is configured via the GEMINI_API_KEY environment variable or set at runtime in the admin API Keys panel.
Overview
Voice Training uses ElevenLabs' Instant Voice Cloning (IVC) API to create custom voices from audio samples. Once cloned, the voice appears in the voice selector immediately.
From Microphone
- Open the Voice Training section in the admin panel
- Click Generate Text to get an AI-generated reading passage (via Gemini) — gives the speaker natural, phonetically diverse text to read aloud
- Record multiple audio clips using your browser microphone while reading the generated text
- Provide a name for the voice
- Clips are uploaded to ElevenLabs IVC API
- Cloned voice is available for TTS immediately
- Click Preview Voice to hear the cloned voice speak a sample sentence via TTS
From YouTube
- Paste a YouTube URL in the Voice Training section
- Backend extracts N × 30-second clips via
yt-dlp + ffmpeg
- Clips are uploaded to ElevenLabs IVC API
- Resulting voice is stored in your ElevenLabs account
⚠
ElevenLabs Account
Cloned voices are stored in your ElevenLabs account, not locally. Ensure your plan supports voice cloning.
Concepts
| Concept | Description |
| Active Language Pair |
The current pair used for translation (e.g., EN ↔ RU, EN ↔ UK, or RU ↔ UK). Set by admin. |
| Available Languages |
The pool of languages viewers can select from (if user_language_selector is enabled). |
Admin Controls
- Change the active language pair via the admin panel
- Changes broadcast to all connected clients in real-time
- Manage the available languages pool for viewer selection
Viewer Selection
When the user_language_selector feature flag is enabled, viewers can override the admin-set language pair by selecting their own preferred languages from the available pool.
Overview
Two people can video call each other through the app, each speaking their own language. The app transcribes, translates, and synthesizes speech in real-time so each participant hears the other in their language.
Feature flag: Video call is gated behind the video_translation flag. Enable it in the admin panel or set video_translation: true in your YAML config.
How It Works
- Create a room — Person A selects their language, picks a TTS voice, and clicks "Create Room". A 6-character room code is generated.
- Share the code — Person A shares the room code with Person B (copy button provided).
- Join the room — Person B enters the code, selects their language and TTS voice, and clicks "Join".
- WebRTC connection — The app establishes a peer-to-peer video connection via WebRTC (signaled through Socket.io). Video flows directly between browsers.
- Audio translation — Each participant's microphone audio is simultaneously:
- Sent to the peer via WebRTC (but muted on their end)
- Captured as PCM chunks and sent to the backend via Socket.io for STT
- Translation pipeline — Each participant has their own independent Scribe STT session. Transcribed text is translated to the other participant's language, then synthesized via ElevenLabs TTS and sent back to the peer.
- Playback — The peer hears the TTS translation instead of the raw audio. Translated transcript is displayed below the video.
Architecture
Person A (Browser) Server Person B (Browser)
├─ getUserMedia ├─ Socket.io ├─ getUserMedia
├─ WebRTC P2P ═══video═══►│ (signaling) ◄═══ ├─ WebRTC P2P
│ │ │
├─ PCM chunks ──Socket.io─►├─ ScribeA(STT) │
│ │ ↓ translate │
│ │ ↓ TTS ───────────►├─ Plays TTS
│ │ │
│ Plays TTS ◄─────────────├─ ScribeB(STT) ◄───├─ PCM chunks
│ (remote video muted) │ ↓ translate │ (remote video muted)
└──────────────────────────┴────────────────────┘
Socket Events
| Event | Direction | Purpose |
video_create_room | C→S | Create a new room with language + voice |
video_room_created | S→C | Returns the 6-char room code |
video_join_room | C→S | Join an existing room |
video_room_joined | S→C | Sent to both participants, triggers WebRTC |
video_signal_offer/answer/ice | C↔S | WebRTC signaling relay |
video_audio_chunk | C→S | PCM audio for STT processing |
video_transcript | S→C | Transcript sent to the speaker |
video_translation | S→C | Translation sent to the listener |
video_tts_audio | S→C | TTS audio sent to the listener |
video_leave_room | C→S | Leave the room |
video_room_closed | S→C | Notify peer when other leaves |
Room Lifecycle
- Rooms are stored in Redis with key
video_room:{code} and a 4-hour TTL
- Maximum 2 participants per room
- When one participant disconnects, the other is notified and the call ends
- Scribe sessions are automatically cleaned up on disconnect
The Mac Audio Agent has moved to its own public repository:
github.com/Pzharyuk/live-translator-agent
It is a lightweight Node.js daemon that runs as a macOS LaunchAgent and streams microphone audio to the live-translator backend via Socket.io — eliminating the need to open a browser for the Remote Audio Source role.
Pre-shared key authentication
Any socket that emits register_audio_source must present the server's pre-shared key in the Socket.IO handshake (auth.agentPsk). This stops random clients from connecting to the backend and impersonating an agent.
- Server: set
AGENT_PSK (env var) — surfaces as auth.agent_psk in application.yaml. An empty value disables enforcement and logs a warning on every registration.
- Mac daemon: add
agentPsk to ~/.config/live-translator-agent/config.json (or set the AGENT_PSK env var — env wins).
- Browser
/audio-source: paste the key into the new Agent Pre-Shared Key field; it is stored in localStorage on that device only and travels in the handshake (never in event payloads).
- Mismatch behaviour: server logs
register_audio_source REJECTED ... invalid or missing PSK, emits agent_auth_error to the client, then disconnects.
Overview
/projector is a dedicated output route for the room screen — a projector, a confidence monitor, or a ProPresenter web element. It shows only the translated broadcast text: no original transcript, no live partial, no header, status pill, mute button, or schedule chrome. The newest line appears at the bottom and the whole stack rises as more text arrives.
The page is silent. It never plays TTS audio — sound comes from the room PA. This lets it run fullscreen on a booth machine indefinitely without fighting the sound system for control of playback.
The route itself requires no login, matching /broadcast, so it can be opened directly on a projector computer that has no admin session. Visibility is instead controlled by the projector feature flag.
⚠
Feature Flag Required
/projector is gated by the projector feature flag, which ships false in production. Enable it per-deployment in the admin Feature Flags panel before pointing a projector at the URL.
The admin Projector Output section is gated by the same flag: with the flag off the section is not rendered at all, and it appears the moment the flag is toggled on — no page reload needed.
Adaptive-Creep Scrolling
Rather than jumping line-by-line or scrolling at a fixed speed, the stack drifts continuously so the congregation reads a flowing column instead of a cursor jump:
- Base creep — a slow continuous drift,
18 px/s by default (?speed=).
- Catch-up — speed increases proportionally to how far behind the speaker the text has fallen, targeting a close-the-gap time of
tau seconds (?tau=, default 4, range 0.5–30). Also a live slider in the admin panel — see Catch-up below.
- Blur cap — speed never exceeds
130 px/s, so catching up never makes the text unreadable.
- Idle freeze — the moment nobody is speaking and there is no backlog left, motion stops completely rather than idling forward.
- Desync snap — a reconnect or a history replay after rejoin can leave the text far behind the live edge; once the backlog is large enough that crawling back would take minutes, the view snaps straight to the live edge instead.
- Centred while short — before the text fills the frame (the start of a service, or just after a clear) the stack is centred vertically rather than clinging to the top. Text is centred horizontally in both layouts.
Prayer & Song Pauses
When the broadcast is paused for prayer or song, the text fades out and a quiet message (“Prayer in progress” / “Song in progress”) fades in over the same spot. The scroll position is frozen, not reset, so when the pause ends the text fades back in exactly where the reader left off.
URL Parameters
All parameters are optional and independently clampable — an out-of-range value (typed by hand, or a leftover from a previous config) is clamped to the nearest valid bound rather than breaking the page.
| Parameter | Default | Description |
bg |
dark |
Backdrop: dark (app theme), transparent, or green (chroma-key). With layout=lower3, green fills only the band — everything above it stays transparent, so ProPresenter keys a defined lower-third region instead of the whole frame. |
layout |
full |
full fills the frame; lower3 confines text to a band pinned to the bottom — one line tall by default, with the text creeping continuously through it. |
size |
1 |
Font-size multiplier applied to the responsive base text size. |
band |
auto |
Lower-third band height. Left off (or auto) the band is exactly one line tall, derived from the same expression as the font size so it tracks size and the screen's aspect ratio. Give it a number to override in vh. Ignored when layout=full. |
speed |
18 |
Base scroll creep, px/sec. Clamped between 2 and 130. |
tau |
4 |
Seconds the engine targets to close any backlog before it falls back to the base creep. |
ProPresenter Setup
- Add the
/projector URL as a web element in ProPresenter, sized 1920×1080.
- Use
layout=lower3 so the text stays confined to the bottom band — one line tall unless band says otherwise — and bg=green to fill that band with a solid chroma-key green. The area above the band stays transparent, so only the band needs keying.
- Chroma-key the green in ProPresenter's compositing so only the text remains over your lyric/camera background.
⚠
Why green, not transparent
ProPresenter 7's web element has historically been unreliable about honouring page transparency — several versions composite it onto opaque black instead. bg=green is the recommended path for that reason; bg=transparent is available but should be verified on the actual playout machine before relying on it.
Admin “Projector Output” Panel
The admin panel's Projector Output section builds the launch URL and controls a running projector without editing query strings by hand:
- URL builder — layout, backdrop, text size, and band height (when in lower-third; leave the field blank for a one-line band), reflected live in the copyable link.
- Live Speed drag bar — a 2–130 px/s slider that retunes an already-open projector window instantly, so an operator can tune the creep by eye while watching the actual screen.
- Catch-up drag bar — the same live control for
tau, 0.5–30 s, labelled lower = text arrives sooner. On the one-line lower third this is the dominant remaining delay between the preacher speaking and the line being readable: the scroll aims to close whatever backlog exists within this many seconds, so 4 s means a newly arrived line takes about four seconds to rise into view and 1 s brings it up almost immediately. Pushed over the same BroadcastChannel as Speed, on its own message type, so the two sliders can never be read for each other.
- Copy link — copies the absolute
/projector URL with the current options encoded.
- Launch button — opens the projector in a new window. Once displays have been detected it launches fullscreen directly onto the chosen one instead.
- Close projector window — stops the output without hunting the fullscreen window down on the other screen. The request travels over
BroadcastChannel, not the handle window.open returned, so it still works after the admin page has been reloaded. There is no delivery receipt, so the button confirms only “Close sent” — it is harmless to press when nothing is open, and the panel never claims to know whether a projector is running.
- Detect displays — lists the physical displays attached to the current machine so you can pick one. Chrome only shows its permission prompt in response to a click, so this is a button rather than something that happens on page load: press it and choose Allow. Once granted, the list appears automatically on every later visit from that browser.
- Settings are remembered — layout, backdrop, text size, band height, speed, and catch-up are saved in the browser's
localStorage and restored on the next visit, so the projector only has to be configured once per booth machine. Saved values are re-validated on read and clamped to the same ranges the URL accepts. The selected display is deliberately not saved — screens come and go, so detection re-runs each time.
💡
If no display list appears
The panel always states which case you are in, directly under the “Displays attached to this machine” heading:
- “Click Detect displays…” — permission has not been asked for yet. Press the button and choose Allow.
- “Detection was dismissed…” — the prompt was closed without granting. Press the button again.
- “Display selection is blocked…” — permission was denied. Chrome will not ask again from a click; re-enable Window management in the site settings behind the icon at the left of the address bar.
- “Only one display is attached…” — detection worked and there is genuinely nothing to choose between. Connect the projector, then press Detect displays again.
- “Display selection needs a Chromium browser…” — Safari and Firefox do not implement the Window Management API. Copy the URL or use Open in new window and press F11 on the projector display.
⚠
Three limitations to know before service
A hand-opened window cannot be closed remotely. Browsers only let a script close a window a script opened — so Close projector window genuinely closes a projector started with Launch, but cannot close one opened by pasting the URL into a tab. That window is not left unchanged: it stops showing the service text, leaves fullscreen, and displays “Projector output stopped — you can close this window”, then drops out of the broadcast viewer count. Reload the page to resume output. Like the Live Speed bar, this only reaches projector windows in the same browser on the same machine.
Display list is local. The picker only enumerates displays physically attached to the machine the admin page is open on — it cannot see or drive a projector connected to a different computer. It also requires the browser's Window management permission, granted through the Detect displays button.
Live Speed and Catch-up bars are same-browser only. They push updates over BroadcastChannel, which only reaches a projector window opened from that same browser. A projector running on another machine keeps whatever values were in its ?speed= and ?tau= parameters at page load — the live bars cannot retune it.
Feature Flags
Feature flags control which features are visible and enabled across the application. Defaults are set in config/application.yaml under the feature_flags section. At runtime, flags can be overridden via Redis (persisted in the database), allowing live toggling without restarting the server. The admin REST API merges YAML defaults with Redis overrides and broadcasts changes to all connected clients via Socket.IO.
| Flag |
Default |
Description |
youtube_input |
true |
Enable YouTube live stream input as a broadcast source. |
mic_input |
true |
Enable microphone audio input from the admin browser. |
auto_language_detect |
true |
Automatically detect the source language of transcripts before translation. |
user_language_selector |
false |
Allow viewers to select their preferred language pair from the available pool. |
audio_device_selector |
true |
Show audio device selection in the admin UI for microphone broadcasts. |
video_translation |
true |
Enable the /video route for real-time video call translation. |
video_voice_cloning |
false |
Premium feature—show the Clone Voice button in the video lobby. |
remote_audio_source |
false |
Enable the /audio-source route for headless remote audio relay agents. |
agent_audio_source |
false |
Show the "Connected Audio Sources" section in the admin broadcast panel. |
stream_input |
false |
Enable HTTP/Icecast audio stream URL input in the admin panel. |
auto_pause_songs |
false |
Automatically pause translation during worship songs (music detection). |
broadcast |
false |
Enable the /broadcast route—public receiver page for live translation. |
translate |
false |
Enable the /translate route—private translator workspace. |
projector |
false |
Enable the /projector route—congregation screen/ProPresenter output display. |
Storage & Runtime Behavior
Feature flags are stored in two layers. The feature_flags section in config/application.yaml sets the application defaults, loaded at startup. Individual flags can be overridden at runtime by setting a Redis key flag:<name> to 'true' or 'false'. When a client connects or when an admin updates a flag via the REST API, the server merges YAML defaults with Redis overrides and broadcasts the merged state to all connected Socket.IO clients via the feature_flags event. This allows live flag changes to take effect immediately across all browsers without a page reload.
Admin API
Feature flags can be queried and updated via the admin REST endpoints. All endpoints require valid JWT authentication (admin role or equivalent permissions).
GET /admin/flags
Returns all feature flags (merged YAML defaults & Redis overrides).
Response:
{
"flags": {
"youtube_input": true,
"mic_input": true,
"auto_pause_songs": false,
…
}
}
---
GET /admin/flags/:flag
Returns the current state of a single flag.
Response:
{
"flag": "auto_pause_songs",
"value": false
}
---
POST /admin/flags/:flag
Sets a feature flag to a new value. Broadcasts the updated state to all connected clients.
Request Body:
{
"value": true
}
Response:
{
"flag": "auto_pause_songs",
"value": true
}
Note: When the auto_pause_songs flag is set to false at runtime,
the auto-pause song detector is immediately stopped and any active pause is released,
ensuring the broadcast never gets stranded in a paused state.
File Structure
| File | Purpose |
config/application.yaml |
Base defaults for all environments |
config/application-local.yaml |
Local development overrides (localhost URLs) |
config/application-prod.yaml |
Production overrides (Docker service names) |
The APP_ENV environment variable (local or prod) determines which overlay file is loaded on top of the base config.
Full Configuration Reference
server:
port: 3001
cors_origin: "http://localhost:5173"
elevenlabs:
api_key: "${ELEVENLABS_API_KEY}"
default_voice_id: "kxj9qk6u5PfI0ITgJwO0"
tts_model: "eleven_multilingual_v2"
tts_settings:
stability: 0.5
similarity_boost: 0.75
style: 0.0
speed: 1.0
use_speaker_boost: true
stt_model: "scribe_v2"
anthropic:
api_key: "${ANTHROPIC_API_KEY}"
deepl:
api_key: "${DEEPL_API_KEY}"
libretranslate:
url: "http://libretranslate:5000"
api_key: ""
redis:
host: "redis"
port: 6379
password: ""
feature_flags:
youtube_input: true
mic_input: true
auto_language_detect: true
user_language_selector: false
audio_device_selector: true
video_translation: false
video_voice_cloning: false
broadcast: false
audio:
sample_rate: 16000
channels: 1
chunk_duration_ms: 250
translation:
source_lang: "auto"
target_lang_en: "en"
target_lang_ru: "ru"
provider: "libretranslate"
fallback: "libretranslate"
Environment Variable Interpolation
YAML values using ${VAR_NAME} syntax are automatically replaced with the corresponding environment variable at startup.
| Variable |
Required |
Default |
Description |
ELEVENLABS_API_KEY |
Yes |
— |
ElevenLabs API key for text-to-speech & speech-to-text services. |
ELEVENLABS_VOICE_ID |
No |
kxj9qk6u5PfI0ITgJwO0 |
Default ElevenLabs voice ID (overridable per broadcast). |
ANTHROPIC_API_KEY |
No |
— |
Anthropic API key for sermon generation & Claude translation provider. |
GEMINI_API_KEY |
No |
— |
Google Gemini API key for biblical simulator & sermon generation. |
GOOGLE_TRANSLATE_API_KEY |
No |
— |
Google Cloud Translation API key (default translation provider). |
DEEPL_API_KEY |
No |
— |
DeepL API key for translation provider fallback. |
YOUTUBE_API_KEY |
No |
— |
YouTube Data API v3 key for finding live streams. |
YOUTUBE_CHANNEL_ID |
No |
— |
Default YouTube channel ID to search for live broadcasts (e.g., UCxxxxxx). |
APP_ENV |
No |
local |
Environment mode: local (dev) or prod (Docker). |
FRONTEND_URL |
No |
http://localhost |
Frontend base URL used for CORS & OAuth callbacks. |
LISTEN_PORT |
No |
80 |
HTTP listen port for the frontend. |
DB_PASSWORD |
Yes |
— |
PostgreSQL database password. |
REDIS_PASSWORD |
No |
— |
Redis authentication password (leave empty for no auth). |
LIBRETRANSLATE_API_KEY |
No |
— |
LibreTranslate API key (optional, if your instance requires authentication). |
ADMIN_PASSWORD |
No |
admin123 |
Legacy socket authentication password for admin panel (change in production). |
APP_ADMIN_USERNAME |
No |
admin |
Default admin user seeded into the database on first boot. |
APP_ADMIN_PASSWORD |
No |
admin123 |
Default admin password (change in production). |
APP_USERNAME |
No |
user |
Default user-facing login username. |
APP_PASSWORD |
No |
changeme |
Default user-facing login password (change in production). |
JWT_SECRET |
Yes |
— |
JWT secret for session cookies (generate with openssl rand -hex 32). |
COOKIE_SECURE |
No |
true |
Set to true when serving over HTTPS. |
AGENT_PSK |
No |
— |
Pre-shared key for native agents & audio source registration (leave blank to disable). |
GOOGLE_CLIENT_ID |
No |
— |
Google OAuth client ID for social sign-in. |
GOOGLE_CLIENT_SECRET |
No |
— |
Google OAuth client secret for social sign-in. |
APPLE_CLIENT_ID |
No |
— |
Apple Services ID for Sign in with Apple. |
APPLE_TEAM_ID |
No |
— |
Apple developer team ID (10-character identifier). |
APPLE_KEY_ID |
No |
— |
Apple Sign in with Apple key ID (10-character). |
APPLE_PRIVATE_KEY |
No |
— |
Apple .p8 private key file contents (PEM-encoded with BEGIN/END markers). |
OIDC_ISSUER |
No |
— |
OIDC issuer URL for Authentik integration (being phased out). |
OIDC_CLIENT_ID |
No |
— |
OIDC client ID for Authentik integration. |
OIDC_CLIENT_SECRET |
No |
— |
OIDC client secret for Authentik integration. |
server.port (YAML) |
No |
3001 |
Backend server listen port. |
server.cors_origin (YAML) |
No |
http://localhost:5183 |
CORS origin for frontend requests. |
elevenlabs.tts_model (YAML) |
No |
eleven_multilingual_v2 |
ElevenLabs TTS model identifier. |
elevenlabs.stt_model (YAML) |
No |
scribe_v2_realtime |
ElevenLabs STT model identifier (realtime or legacy). |
elevenlabs.tts_settings.stability (YAML) |
No |
0.5 |
TTS stability parameter (0–1). |
elevenlabs.tts_settings.similarity_boost (YAML) |
No |
0.75 |
TTS similarity boost parameter (0–1). |
elevenlabs.tts_settings.speed (YAML) |
No |
1.0 |
TTS playback speed multiplier. |
database.host (YAML) |
No |
postgres |
PostgreSQL host. |
database.port (YAML) |
No |
5432 |
PostgreSQL port. |
database.username (YAML) |
No |
translator |
PostgreSQL username. |
database.database (YAML) |
No |
translator_db |
PostgreSQL database name. |
database.pool_size (YAML) |
No |
10 |
PostgreSQL connection pool size. |
redis.host (YAML) |
No |
redis |
Redis host. |
redis.port (YAML) |
No |
6379 |
Redis port. |
translation.provider (YAML) |
No |
google |
Primary translation provider (google | deepl | claude | libretranslate). |
translation.fallback (YAML) |
No |
libretranslate |
Fallback provider when primary fails (google | deepl | claude | libretranslate | none). |
translation.translate_workers (YAML) |
No |
2 |
Number of parallel translation workers in the TTS pipeline. |
translation.request_timeout_ms (YAML) |
No |
5000 |
Per-provider translation request timeout in milliseconds. |
tts_pipeline.initial_buffer_segments (YAML) |
No |
1 |
Number of translated segments to buffer before starting TTS playback. |
tts_pipeline.low_water_hold_ms (YAML) |
No |
1500 |
Low-water-mark hold duration (ms) to ensure next segment is queued. |
audio.sample_rate (YAML) |
No |
16000 |
Audio sample rate (Hz). |
audio.channels (YAML) |
No |
1 |
Number of audio channels (mono). |
audio.chunk_duration_ms (YAML) |
No |
250 |
Audio chunk duration in milliseconds. |
feature_flags.youtube_input (YAML) |
No |
true |
Enable YouTube broadcast input source. |
feature_flags.mic_input (YAML) |
No |
true |
Enable microphone input source. |
feature_flags.video_translation (YAML) |
No |
true |
Enable video call translation feature. |
feature_flags.broadcast (YAML) |
No |
false |
Enable /broadcast public receiver page. |
feature_flags.translate (YAML) |
No |
false |
Enable /translate live translator page. |
feature_flags.auto_pause_songs (YAML) |
No |
false |
Enable auto-pause translation during worship songs. |
song_detection.window_seconds (YAML) |
No |
10 |
Audio window duration (seconds) for song classification. |
song_detection.interval_seconds (YAML) |
No |
15 |
Interval (seconds) between song detection checks. |
song_detection.confirm_music_windows (YAML) |
No |
2 |
Consecutive music verdicts required to trigger auto-pause. |
song_detection.max_auto_pause_minutes (YAML) |
No |
10 |
Maximum duration (minutes) for an auto-pause before force-resume. |
TTS Settings
API Endpoints
GET /admin/tts-settings
Response: { settings: TtsSettings }
POST /admin/tts-settings
Body: Partial<TtsSettings>
Response: { settings: TtsSettings }
Configuration Parameters
| Setting |
Range |
Default |
Description |
stability |
0.0 – 1.0 |
0.5 |
ElevenLabs voice stability; higher = more consistent but less expressive. |
similarity_boost |
0.0 – 1.0 |
0.75 |
Voice similarity to the original; higher = closer match to voice ID. |
style |
0.0 – 1.0 |
0.0 |
Speaking style emphasis; 0 = neutral, 1 = exaggerated. |
speed |
0.5 – 2.0 |
1.0 |
Playback speed multiplier; 1.0 = normal speed. |
use_speaker_boost |
true | false |
true |
Enable speaker boost for increased volume and clarity. |
Related Configuration (application.yaml)
| Setting |
Type |
Default |
Description |
elevenlabs.default_voice_id |
string |
"kxj9qk6u5PfI0ITgJwO0" |
ElevenLabs voice ID used for TTS when none is specified. |
elevenlabs.tts_model |
string |
"eleven_multilingual_v2" |
ElevenLabs TTS model for synthesis. |
tts_pipeline.initial_buffer_segments |
number |
1 |
Translated segments to buffer before starting TTS playback. |
tts_pipeline.low_water_hold_ms |
milliseconds |
1500 |
Wait time for next segment before emitting audio; 0 disables. |
STT Timing Settings
Control speech-to-text recognition buffering and dispatch thresholds.
| Setting |
Range |
Default |
Description |
commit_merge_ms |
0 – 10000 |
2500 |
Buffer VAD commits this long before translating; merges short fragments. |
stability_timeout_ms |
500 – 5000 |
2000 |
Dispatch partial text unchanged for this long as a complete segment. |
tts_segment_pause_ms |
0 – 500 |
0 |
Pause between TTS audio segments on the frontend. |
max_accumulation_ms |
1000 – 15000 |
8000 |
Max time to accumulate words during continuous speech before dispatching. |
vad_threshold |
0.0 – 1.0 |
0.5 |
Voice Activity Detection sensitivity; higher = stricter noise filter. |
vad_silence_threshold_secs |
0.5 – 3.0 |
1.5 |
Silence duration (seconds) before VAD triggers a commit. |
min_speech_duration_ms |
50 – 500 |
100 |
Ignore speech shorter than this; filters click noise. |
min_silence_duration_ms |
50 – 500 |
100 |
Minimum silence gap between words (ms). |
flush_on_sentence_boundary |
true | false |
true |
Split commits at sentence boundaries (.?!) instead of flushing all at once. |
min_chars_before_dispatch |
10 – 500 |
40 |
Minimum character count before dispatching a chunk for translation. |
Video Call Settings
Separate, faster STT & translation settings for real-time video calls.
| Setting |
Range |
Default |
Description |
stability_ms |
100 – 2000 |
500 |
Wait time for stable partial text before translating in video calls. |
commit_merge_ms |
0 – 500 |
50 |
Merge VAD commits for snappier response in video mode. |
translation_provider |
libretranslate | claude | deepl | google |
claude |
Translation provider used for video call subtitles. |
Related APIs
GET /admin/stt-timing
Response: { settings: SttTimingSettings }
POST /admin/stt-timing
Body: Partial<SttTimingSettings>
Response: { settings: SttTimingSettings }
GET /admin/video-settings
Response: VideoCallSettings
POST /admin/video-settings
Body: Partial<VideoCallSettings>
Response: VideoCallSettings
Notes
- All TTS settings are persisted to Redis and survive server restarts.
- Changes to STT timing apply immediately to new Scribe sessions.
- Video call settings use a separate provider chain optimized for low-latency.
- The
low_water_hold_ms parameter ensures the TTS buffer stays 1–2 segments ahead, preventing audio gaps during playback.
- Sentence-boundary flushing prevents long accumulations and keeps subtitles snappy.
STT Timing Settings
Speech-to-text timing controls how the backend buffers voice input before dispatching for translation.
These settings affect latency, chunk size, and the balance between responsiveness and translation efficiency.
API Endpoints
GET /admin/stt-timing
Returns: { settings: SttTimingSettings }
POST /admin/stt-timing
Body: { commit_merge_ms?, stability_timeout_ms?, tts_segment_pause_ms?, max_accumulation_ms?, vad_threshold?, vad_silence_threshold_secs?, min_speech_duration_ms?, min_silence_duration_ms?, flush_on_sentence_boundary?, min_chars_before_dispatch? }
Returns: { settings: SttTimingSettings }
Settings Reference
| Setting |
Default |
Description |
commit_merge_ms |
2500 |
How long to buffer VAD commits (ms) before translating — merges short pauses into single translation. |
stability_timeout_ms |
2000 |
How long to wait for stable partial text (ms) before forcing translation when text stops changing. |
tts_segment_pause_ms |
0 |
Pause between TTS audio segments (ms) — frontend receives this value to pace audio playback. |
max_accumulation_ms |
8000 |
Max time to accumulate words during continuous speech (ms) before force-dispatching — ensures translation happens during non-stop talking. |
vad_threshold |
0.5 |
Voice Activity Detection sensitivity (0–1) — higher = stricter noise filter, lower = more sensitive to quiet speech. |
vad_silence_threshold_secs |
1.5 |
Seconds of silence required before VAD triggers a commit — controls pause detection sensitivity. |
min_speech_duration_ms |
100 |
Ignore speech shorter than this (ms) — filters out clicks, taps, and brief noise. |
min_silence_duration_ms |
100 |
Minimum silence gap (ms) — prevents mid-word pauses from triggering VAD commits. |
flush_on_sentence_boundary |
true |
When true, dispatch at sentence boundaries (.?!;) instead of all at once — enables quicker translation of complete sentences. |
min_chars_before_dispatch |
40 |
Minimum characters in a chunk before translation (prevents tiny fragments) — stability and accumulation timers wait for this threshold. |
Tuning Guide
-
For responsive/snappy translation: Lower
commit_merge_ms (e.g., 1000–1500), lower stability_timeout_ms (800–1200), and reduce min_chars_before_dispatch (20–30). Trade-off: more translation API calls, smaller chunks.
-
For efficient/batched translation: Increase
commit_merge_ms (3000–4000), increase max_accumulation_ms (10000–12000), and increase min_chars_before_dispatch (60–80). Trade-off: slower response time, fewer API calls.
-
For noisy environments: Increase
vad_threshold (0.6–0.8) to filter more background noise, increase min_speech_duration_ms (150–200) to ignore brief clicks.
-
For quiet/soft speech: Decrease
vad_threshold (0.3–0.4) to catch fainter voices, decrease min_speech_duration_ms (50–80).
-
For continuous speech (sermons, speeches): Rely on
max_accumulation_ms and flush_on_sentence_boundary — these dispatch regularly without waiting for pauses.
-
For interview/dialogue mode: Lower
vad_silence_threshold_secs (0.8–1.0) to detect speaker switches faster, adjust commit_merge_ms downward to react to short speaker turns.
-
For TTS pacing: Adjust
tts_segment_pause_ms to add delays between audio segments so the frontend has time to render captions/scroll. Default 0 means no pause.
Example: Admin Update Request
POST /admin/stt-timing
Content-Type: application/json
{
"commit_merge_ms": 1500,
"stability_timeout_ms": 1200,
"max_accumulation_ms": 6000,
"vad_threshold": 0.4,
"min_chars_before_dispatch": 30,
"flush_on_sentence_boundary": true,
"tts_segment_pause_ms": 100
}
Response:
{
"settings": {
"commit_merge_ms": 1500,
"stability_timeout_ms": 1200,
"tts_segment_pause_ms": 100,
"max_accumulation_ms": 6000,
"vad_threshold": 0.4,
"vad_silence_threshold_secs": 1.5,
"min_speech_duration_ms": 100,
"min_silence_duration_ms": 100,
"flush_on_sentence_boundary": true,
"min_chars_before_dispatch": 30
}
}
Notes
- Settings are persisted in Redis and survive pod restarts.
- Changes apply immediately to new broadcasts; in-flight broadcasts continue with their startup settings.
- The frontend receives
tts_segment_pause_ms via the stt_timing socket event to pace TTS playback.
flush_on_sentence_boundary enables smart dispatch at punctuation (.?!;) so complete sentences translate as units.
max_accumulation_ms is the safety valve for continuous speech: ensures translation happens every N seconds even if VAD and stability never fire.
- VAD parameters (
vad_threshold, vad_silence_threshold_secs, min_speech_duration_ms, min_silence_duration_ms) are sent to ElevenLabs Scribe as WebSocket query parameters.
Authentication: All endpoints require JWT cookie-based authentication. Admin access is granted to users with is_admin=true OR users with at least one assigned role/permission. Unauthenticated requests return 401 Not authenticated; insufficient permissions return 403 Insufficient permissions.
API Keys
List all configured API keys and their status (set/unset).
Update one or more API keys (elevenlabs, anthropic, deepl, libretranslate, google, youtube).
Body: {
"elevenlabs": "string (optional)",
"anthropic": "string (optional)",
"deepl": "string (optional)",
"libretranslate": "string (optional)",
"google": "string (optional)",
"youtube": "string (optional)"
}
YouTube Settings
Get the configured YouTube channel ID and whether it came from environment or was set via UI.
Update the YouTube channel ID for live stream lookups.
Body: {
"channelId": "string (required, e.g., UCxxxxxx)"
}
Search for live streams on a YouTube channel using either the Data API or yt-dlp fallback.
Voice Management
Scan and list all available ElevenLabs voices, highlighting any new voices not yet in the allowed list.
Get the admin-curated list of voice IDs available for user selection.
Update the pool of allowed voice IDs; broadcasts to all connected clients.
Body: {
"voiceIds": ["string (voice ID)", "..."]
}
Feature Flags
Get all feature flags (merged from YAML defaults + Redis overrides).
Get a single feature flag value.
Set a feature flag; auto-pause song detector is stopped if flag is disabled; broadcasts updated flags to all clients.
Body: {
"value": "boolean (required)"
}
TTS & STT Settings
Get current TTS settings (stability, similarity boost, style, speed, speaker boost).
Update TTS voice settings.
Body: Partial<TtsSettings> {
"stability": "number (0-1, optional)",
"similarity_boost": "number (0-1, optional)",
"style": "number (0-1, optional)",
"speed": "number (optional)",
"use_speaker_boost": "boolean (optional)"
}
Get STT timing settings (VAD thresholds, accumulation delays, sentence splitting).
Update STT timing configuration for adaptive transcript dispatch.
Body: Partial<SttTimingSettings> {
"commit_merge_ms": "number (optional)",
"stability_timeout_ms": "number (optional)",
"tts_segment_pause_ms": "number (optional)",
"max_accumulation_ms": "number (optional)",
"vad_threshold": "number (0-1, optional)",
"vad_silence_threshold_secs": "number (optional)",
"min_speech_duration_ms": "number (optional)",
"min_silence_duration_ms": "number (optional)",
"flush_on_sentence_boundary": "boolean (optional)",
"min_chars_before_dispatch": "number (optional)"
}
Get video call STT/TTS settings (stability, commit merge, translation provider).
Update video call translation settings.
Body: Partial<VideoCallSettings> {
"stability_ms": "number (optional)",
"commit_merge_ms": "number (optional)",
"translation_provider": "string (libretranslate|claude|deepl|google, optional)"
}
Languages
Get the current active language pair (source → target).
Set the active language pair; broadcasts to all connected viewers.
Body: {
"languages": ["string (source code)", "string (target code)"]
}
Get the pool of language codes viewers can choose from.
Update the available language pool; broadcasts pool & current pair to all clients.
Body: {
"languages": ["string (language code)", "..."]
}
Translation Provider
Get active translation provider and list of available providers.
Switch to a different translation provider (google, deepl, claude, libretranslate).
Body: {
"provider": "string (google|deepl|claude|libretranslate, required)"
}
Get the currently selected Claude model for translation.
Switch to a different Claude model.
Body: {
"model": "string (model ID, required)"
}
Audio Device
Get the admin-selected audio input device (forces viewers to use this device).
Override viewer audio device selection; broadcasts to all connected clients.
Body: {
"deviceId": "string (optional)",
"label": "string (optional)"
}
Get the saved HTTP audio stream URL (for Icecast/HTTP input source).
Save an HTTP(S) audio stream URL to be used as broadcast source; empty value clears it.
Body: {
"url": "string (http(s) URL, optional)"
}
Broadcast Schedule
Get all scheduled broadcast events.
Update the entire broadcast schedule; past events are auto-pruned on every broadcast start.
Body: {
"events": [
{
"id": "string",
"title": "string",
"datetime": "ISO 8601",
"description": "string (optional)",
"source": "mic|youtube|biblical|remote|stream (optional)",
"voiceId": "string (optional)",
"durationMinutes": "number (optional)",
"youtubeUrl": "string (optional)",
"biblicalPrompt": "string (optional)",
"agentId": "string (optional)",
"agentDeviceId": "string (optional)",
"skipSourceLang": "string|null (optional)",
"allowedLanguages": ["source", "target"] (optional)"
}
]
}
TTS Preview
Generate TTS audio for a preview sentence; returns MP3 or PCM buffer.
Body: {
"text": "string (required)",
"voiceId": "string (optional, defaults to config)",
"format": "mp3|pcm (optional, defaults to mp3)"
}
Voice Training
Clone a voice from browser microphone recordings (base64-encoded audio blobs).
Body: {
"name": "string (voice name, required)",
"clips": ["string (base64 audio)", "..."] (required, min 1),
"mimeType": "string (optional, defaults to audio/webm)"
}
Clone a voice from a YouTube URL using yt-dlp to extract 30-second clips.
Body: {
"name": "string (voice name, required)",
"youtubeUrl": "string (required)",
"clipCount": "number (1-25, optional, defaults to 3)",
"startOffset": "number (optional, defaults to 0)"
}
Sermon Generation
Generate a biblical sermon excerpt using Gemini Flash (for testing/simulation).
Body: {
"apiKey": "string (optional, uses configured key if omitted)",
"language": "string (ru|uk|en, optional)",
"sentences": "number (1-20, optional, defaults to 3)"
}
Monitoring & Logging
Get hallucination detection statistics and recent false-positive transcripts.
Clear the hallucination log.
Get the list of custom filler words stripped from transcripts before translation.
Update custom filler words (e.g., Угу, uh-huh, um…).
Body: {
"words": ["string (filler word)", "..."]
}
Get recent translation activity log (original, translated, timings, provider).
Clear the translation log.
Get current Redis Streams queue depth and active stream statistics.
Broadcast Sessions
List all broadcast sessions from PostgreSQL history.
Get detailed session data including all transcripts with timings.
Export session transcripts; format via query parameter (json, csv, txt).
Video Call Moderation
List all active video call rooms with participant details (participant tokens stripped for security).
Force-close an active video call room; disconnects all participants.
User Management
Requires user_management permission.
List all users (password hashes redacted for security).
Update a user’s admin flag and/or assigned roles.
Body: {
"isAdmin": "boolean (optional)",
"roleId": "string|null (optional, legacy single-role)",
"roleIds": ["string (role ID)", "..."] (optional)"
}
Force-reset a user’s password; user must be at least 6 characters.
Body: {
"password": "string (required, min 6 chars)"
}
Delete a user account (cannot delete your own account).
Roles & Permissions
Requires user_management permission.
List all available permissions that can be assigned to roles.
List all custom roles and their assigned permissions.
Create a new role with a set of permissions.
Body: {
"name": "string (required)",
"permissions": ["string (permission name)", "..."] (required)"
}
Update an existing role’s name and/or permissions.
Body: {
"name": "string (required)",
"permissions": ["string (permission name)", "..."] (required)"
}
API Keys (Legacy)
Get the Gemini API key (for legacy compatibility; use /admin/api-keys instead).
| Event |
Payload |
Description |
feature_flags |
Record<string, boolean> |
Merged feature flags from YAML defaults & Redis overrides. |
languages |
{ languages: string[] } |
Current active language pair for translation. |
available_languages |
{ languages: string[] } |
Pool of languages viewers can select from. |
stt_timing |
{ tts_segment_pause_ms: number } |
Speech-to-text timing configuration. |
broadcast_status |
{ active: boolean; source?: string; pauseReason?: string | null; pauseOrigin?: string | null; skipSourceLang?: string | null; voiceId?: string; orphaned?: boolean } |
Current broadcast state — whether streaming is live, which source, pause status. |
broadcast_viewer_count |
{ count: number } |
Number of connected broadcast viewers. |
remote_audio_sources |
{ sources: RemoteAudioSource[] } |
List of registered remote audio agents. |
broadcast_transcript |
{ text: string; isFinal: boolean; skipped?: boolean } |
Live transcribed text from speech recognition. |
broadcast_transcript_history |
Array<{ original: string; translated: string; detectedLanguage?: string }> |
Recent translations for viewers who rejoin mid-broadcast. |
broadcast_translation |
{ original: string; translated: string; detectedLanguage?: string } |
Translated sentence ready for display & TTS. |
broadcast_tts_audio |
{ audio: string } |
Base64-encoded MP3 audio for the translated text. |
audio_level |
{ data: number[] } |
Waveform samples for live audio visualization. |
broadcast_source_status |
{ stalled: boolean; message?: string } |
Audio source connection status — notifies when feed disconnects/reconnects. |
tts_clear_queue |
{} |
Signal to clear buffered audio segments (pause/resume/voice change). |
stream_ended |
{} |
Broadcast stream has ended. |
error |
{ message: string } |
Error message for display to user. |
admin_audio_device |
{ deviceId: string; label: string } |
Admin-selected audio input device (overrides viewer's local choice). |
broadcast_voice_changed |
{ voiceId: string } |
TTS voice changed mid-broadcast. |
session_started |
{ source: string } |
Private translation session started. |
session_stopped |
{} |
Private translation session ended. |
transcript |
{ text: string; isFinal: boolean } |
Live transcript in private session. |
translation |
{ original: string; translated: string; detectedLanguage?: string } |
Translated text in private session. |
tts_audio |
{ audio: string } |
Base64 audio in private session. |
admin_translate_result |
{ original: string; translated: string; detectedLanguage?: string; audio: string } |
Result of admin quick-test translation. |
agent_auth_error |
{ code: string; message: string } |
Remote agent authentication failed. |
select_device |
{ id: string } |
Instruction to select a specific audio device. |
refresh_devices |
{} |
Request agent to refresh its audio device list. |
device_select_error |
{ socketId: string; message: string } |
Error selecting device on a remote agent. |
remote_audio_error |
{ socketId: string; deviceId: string; message: string } |
Error from remote agent audio stream. |
| Event |
Payload |
Description |
join_broadcast |
{} |
Viewer subscribes to broadcast room. |
leave_broadcast |
{} |
Viewer unsubscribes from broadcast room. |
set_languages |
{ languages: string[] } |
Viewer selects a language pair (must be in available pool). |
start_session |
{ source: 'mic' | 'youtube'; voiceId?: string; youtubeUrl?: string } |
User starts a private translation session. |
stop_session |
{} |
User stops their private session. |
change_voice |
{ voiceId: string } |
Change TTS voice (broadcast admin or private session). |
admin_start_broadcast |
{ voiceId?: string; source: 'mic' | 'youtube' | 'remote' | 'stream'; youtubeUrl?: string } |
Admin starts a broadcast. |
admin_stop_broadcast |
{} |
Admin stops the broadcast. |
reclaim_broadcast |
{} |
Admin reclaims an orphaned broadcast after reconnecting. |
broadcast_pause |
{ reason: 'prayer' | 'song' } |
Admin pauses broadcast translation. |
broadcast_resume |
{} |
Admin resumes broadcast translation. |
broadcast_skip_lang |
{ lang: string | null } |
Admin skips translating a source language (e.g. human translator speaking). |
register_audio_source |
{ agentId?: string; label: string; deviceId: string; devices?: { id: string; name: string }[]; selectedDevice?: string | null } |
Remote agent registers as audio source (requires valid PSK). |
unregister_audio_source |
{} |
Remote agent unregisters. |
select_active_agent |
{ socketId: string } |
Admin picks which registered agent's audio feeds the broadcast. |
select_agent_device |
{ socketId: string; deviceId: string } |
Admin selects which audio device an agent uses. |
refresh_devices |
{ socketId: string } |
Admin requests agent refresh its device list. |
audio_stream_error |
{ deviceId: string; message: string } |
Agent reports an audio stream error. |
audio_chunk |
{ audio: string } |
Base64 PCM audio from mic or remote agent — routes to broadcast or private session. |
test_audio_chunk |
{ audio: string } |
Audio for testing (always private session, never broadcast). |
admin_translate_test |
{ text: string; voiceId?: string; sourceLang?: string; targetLang?: string } |
Admin quick-test translation & TTS. |
start_biblical_sim |
{ anthropicApiKey?: string; geminiApiKey?: string; language: string; voiceId?: string } |
Start biblical sermon simulator broadcast. |
stop_biblical_sim |
{} |
Stop biblical simulator. |
SDK
Uses the official @elevenlabs/elevenlabs-js SDK (v2). The client is lazy-loaded on first use.
Speech-to-Text (Scribe v2 Realtime)
Connects via native WebSocket to wss://api.elevenlabs.io/v1/speech-to-text/realtime. Handles:
- VAD-based commit buffering with configurable merge window
- Stability timeout fallback for stalled VAD
- Text validation (EN/RU/UK character regex filtering)
- Partial and final transcript emission
Text-to-Speech
Uses client.textToSpeech.stream() with the eleven_multilingual_v2 model. Audio is collected into a Buffer and emitted as base64 MP3.
Voice Management
client.voices.getAll() — fetches all voices from account
- Admin can filter which voices are available to viewers
- Voice cloning via IVC API (from recordings or YouTube)
Key File
backend/src/services/elevenlabs.service.ts
Provider Details
Google Translate
Google Cloud Translation API v2. Fast (~200ms), deterministic, and reliable. Requires GOOGLE_TRANSLATE_API_KEY with the Cloud Translation API enabled in Google Cloud Console. Ensure the API key has no HTTP referrer restrictions (server-side requests have no referrer).
File: backend/src/services/google-translate.service.ts
LibreTranslate
Self-hosted in Docker. No API key required by default. Provides language detection and translation via REST API.
File: backend/src/services/libretranslate.service.ts
DeepL
Premium translation API. Auto-detects free vs. paid endpoint based on the API key format.
File: backend/src/services/deepl.service.ts
Claude (Anthropic)
AI-powered translation using claude-haiku-4-5 for speed. Includes language detection and auto-flip logic.
File: backend/src/services/claude-translate.service.ts
Routing
Provider routing is handled by backend/src/services/translation.provider.ts:
- Try admin-selected primary provider
- On failure, try configured fallback provider
- LibreTranslate is always the last-resort fallback
Connection
Uses ioredis with automatic retry strategy. Falls back to in-memory/YAML defaults if Redis is unavailable.
Key Patterns
| Pattern | Example | Purpose |
flag:<name> |
flag:youtube_input |
Feature flag boolean values |
setting:<name> |
setting:tts_settings |
JSON settings objects |
Key File
backend/src/services/redis.service.ts
Local Development
Use docker-compose.local.yml for Redis and LibreTranslate only (backend/frontend run natively):
docker compose -f docker-compose.local.yml up -d
Production
Use docker-compose.yml for all services:
docker compose up -d --build
Services
| Service | Image | Port | Notes |
| frontend |
node:24-alpine + Nginx |
80 (exposed) |
Serves React build, proxies API/WS to backend |
| backend |
node:24-alpine |
3001 (internal) |
Express + Socket.io server |
| redis |
redis:7-alpine |
6379 (internal) |
Feature flags and settings store |
| libretranslate |
libretranslate/libretranslate |
5000 (internal) |
Self-hosted translation engine |
Configuration
ELEVENLABS_API_KEY=sk-your-production-key
ADMIN_PASSWORD=strong-secure-password
FRONTEND_URL=https://translate.example.com
APP_ENV=prod
REDIS_PASSWORD=redis-secret
Deploy
docker compose up -d --build
Reverse Proxy
When running behind Nginx or another reverse proxy:
- Set
LISTEN_PORT in .env (e.g., 8080)
- Proxy pass to
localhost:8080
- Important: Ensure WebSocket upgrades are forwarded for the
/socket.io/ path
server {
listen 443 ssl;
server_name translate.example.com;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
Monitoring
# Check all services
docker compose ps
# View backend logs
docker compose logs -f backend
# Health check
curl http://localhost:3001/api/health
Shipped
v0.1 – v0.2 — Core Translation Engine
- Real-time STT via ElevenLabs Scribe v2 Realtime
- Multi-provider translation (LibreTranslate, DeepL, Claude)
- TTS voice synthesis with ElevenLabs
- Microphone and YouTube live input
- Admin panel with feature flags, voice management, TTS tuning
- Biblical Transcript Simulator for pipeline testing
- Instant Voice Cloning from recordings and YouTube
Shipped
v0.3 — Audio Mixer & Device Selection
Browser-side audio device scanning with support for professional mixing consoles, virtual audio devices, and audio interfaces.
- Browser-side device enumeration with permission flow
- Virtual device detection (Loopback, BlackHole, VB-Audio, Voicemeeter, OBS)
- Categorized device picker (Microphones vs Mixers / Virtual Devices)
- Admin device override broadcast to all viewers via Socket.io
- Real-time feature flag broadcasting
Shipped
v0.7 — Broadcast Service
The /translate route is now a true broadcast service. Admins start one global translation session from the admin panel and all connected viewers receive the live output simultaneously.
- Single global broadcast session (one-to-many)
- Admin "Broadcast Control" panel — Start/Stop with source + voice selection
- Microphone and YouTube source both supported for broadcast
- All translation output (transcript, translated text, TTS audio)
io.emit’d to every viewer
- Viewer shows Waiting for broadcast to start… status when off air
- "On Air" / "Off Air" status pill visible to viewers in real-time
- Broadcast ownership tracked by admin socket ID; auto-stops on admin disconnect
- Biblical Transcript Simulator also broadcasts to all viewers
Shipped
v0.8 — Navigation, Broadcast FF & Transcript UX
Global persistent bottom navigation, feature-flag-gated route visibility, and a refined transcript reading experience.
- Persistent bottom navigation bar on all pages (
/translate, /broadcast, /video, /admin)
- FF-gated nav links — Broadcast and Video Call entries only appear when their flags are enabled
- No extra socket connection — nav reads flags from the page’s existing
useSocket call via props
- Nav renders a frosted dark background gradient so it never overlaps content
/broadcast route is now public (no login required); gated inside the page by the broadcast feature flag
broadcast feature flag added to YAML, backend config, and frontend FeatureFlags interface
- Transcript panel: newest translation is always at the top; older lines scroll down and fade out at the bottom
- Each new transcript entry animates in from above (
transcriptIn keyframe)
- Removed duplicate “Video Call” button from
/translate and /broadcast header bars
Shipped
v0.9 — Translation Pipeline Overhaul & Google Integration
Major improvements to translation chunking, provider support, and admin tooling.
- Google Translate as primary translation provider with automatic fallback chain
- Google Gemini 2.5 Flash for biblical simulator and sermon generation (replaces deprecated Gemini 2.0 Flash)
- Overhauled STT chunking: disabled aggressive sentence-boundary splitting, stability timer defers to accumulation during continuous speech, commit buffer defers when speaker has resumed
- Configurable sermon length (1–20 sentences) in admin UI
- Voice training: AI-generated reading text (Gemini) for mic recording sessions
- Voice training: preview playback of cloned voice after training via TTS
- Broadcast mute/unmute toggle (muted by default, replaces “Tap to enable audio” banner)
- Audio device auto-scan on page load with spinning refresh indicator
- Fixed admin Raw Server Logs auto-scroll toggle re-enabling on new messages
- Updated Claude model list: removed deprecated models, default is
claude-haiku-4-5
- Docker images upgraded to Node.js 24 (Alpine)
Shipped
v0.4 — Mac Audio Agent
Lightweight Node.js daemon that captures Mac microphone audio and streams it to the backend via Socket.io — no browser required on the audio source machine.
- Runs as a macOS LaunchAgent (auto-start on login, auto-restart on crash)
- Captures 16 kHz 16-bit mono PCM via
sox
- Identical chunk format and encoding to the browser client
- Registers as a named remote audio source visible in the Admin UI
- Starts/stops streaming automatically based on
broadcast_status events
- One-command install script (see standalone repo)
Shipped
v0.10 — Projector Output
Unauthenticated /projector route for the room screen — translated text only, no audio, gated by the projector feature flag (ships false).
- Newest text at the bottom, stack rises — no header, status, mute, or schedule chrome
- Adaptive-creep scroll: 18 px/s base drift, speeds up proportionally when behind, caps at 130 px/s, freezes when nobody is speaking, snaps to the live edge on bad desync
- Prayer/song pause fades text out to a quiet message and resumes at the same reading position
bg (dark/transparent/green), layout (full/lower3), plus size, band, speed, tau URL parameters, all clamped
- ProPresenter-ready: 1920×1080 web element,
layout=lower3 + bg=green chroma key
- Admin "Projector Output" panel: URL builder, live Speed and Catch-up (
tau) drag bars (same-browser BroadcastChannel), copy-link, and fullscreen launch with Window Management display picker
- Panel is itself gated by the
projector flag, remembers its settings in the browser, and can close a running projector window over the same BroadcastChannel
Up Next
v0.4.1 — Direct Audio Interface Feed
Accept audio directly from professional mixing consoles and audio interfaces — extend the Mac agent to support Core Audio device selection for broadcast-quality input.
- Direct audio interface input (Core Audio / ASIO / ALSA)
- Multi-channel mixer feed support
- Low-latency audio routing (sub-100ms)
- Hardware device auto-discovery and selection
- Professional broadcast integration (NDI, Dante)
Shipped
v0.5 — Video Call Translation
WebRTC peer-to-peer video calls with real-time bidirectional translation. Two people speak different languages and hear each other translated via TTS.
- Built-in WebRTC video call with room codes
- Full-duplex translation (each person hears the other translated)
- Per-participant STT pipeline with independent Scribe sessions
- Video grid UI with local PiP and remote full-screen
- Mic/video mute controls, hang up, auto-cleanup on disconnect
- Feature-flagged behind
video_translation
Shipped
v0.6 — Auth, Mobile & Voice Cloning in /video
- User-facing login page (
/) with JWT cookie sessions (30-day sticky, HttpOnly)
- All app routes protected — redirect to login if unauthenticated
- Live translator moved to
/translate
- Mobile-responsive UI across Translator, Admin, and Video Call views
- FaceTime-style full-screen in-call layout on mobile with safe-area insets
- “Clone Voice” button in
/video lobby, gated by video_voice_cloning feature flag
- Voice cloning modal with mic recording or YouTube URL, admin-password gated
Shipped
Multi-church deployments
Each church runs an isolated instance with its own account, selectable from the broadcast menu.
Shipped
Audio Stream source
Broadcast directly from a church's own audio feed — any HTTP(S) or Icecast stream URL — instead of scraping a YouTube live stream.
- ffmpeg reads the stream natively (no yt-dlp) and emits 16 kHz mono PCM into the STT pipeline
- Automatic reconnect with capped backoff — a dropout becomes a gap in the transcript, not a dead broadcast
- Read timeout catches a half-open connection that would otherwise stall silently
- Stream URL persisted server-side — entered once, survives refreshes and restarts
- Selectable as a scheduled broadcast source for unattended service starts
- Gated by the
stream_input feature flag
Planned
Future
- Additional language pairs beyond EN/RU/UK
- Speaker diarization (multi-speaker detection)
- Translation memory and glossary support
- Webhooks and API for third-party integrations
- Multi-tenant deployment with user accounts