Real-time voice-to-English captioning app with a modern web UI and streaming backend.
- Captures microphone audio in the browser.
- Streams PCM audio to a FastAPI WebSocket endpoint.
- Transcribes speech with Deepgram.
- Translates/captions through Groq in near real time.
- Renders clean, rolling English captions in a Next.js interface.
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 19, TypeScript, Tailwind |
| Backend | FastAPI, WebSockets, Pydantic Settings |
| Speech-to-Text | Deepgram SDK |
| Translation/LLM | Groq API |
.
|- app/ # Next.js app router frontend
|- public/ # Static assets (includes PCM worklet)
|- backend/
| |- app/
| | |- api/websockets/ # /ws/translate endpoint
| | |- core/ # Settings/configuration
| | |- services/ # Deepgram + Groq streaming pipeline
| |- main.py # FastAPI entrypoint
| |- .env.example # Backend env template
| |- pyproject.toml # Python dependencies
|- package.json # Frontend scripts/deps
- Browser captures mono mic audio.
- Frontend sends PCM chunks over
ws://<host>:8000/ws/translate. - Backend forwards/transforms stream for Deepgram STT.
- Transcript is translated/refined through Groq.
- Frontend receives
non_finalandfinalupdates and renders captions.
- Node.js 20+ and npm
- Python 3.10+
- Deepgram API key
- Groq API key (
gsk_...)
cd backend
python -m venv venv
venv\Scripts\activate
pip install -e .Create backend/.env from template:
copy .env.example .envPopulate required values:
DEEPGRAM_API_KEYGROQ_API_KEY- Optional:
CORS_ORIGINS,WS_CLIENT_KEY, model tuning values
Run backend:
uvicorn main:app --reload --host 0.0.0.0 --port 8000Health checks:
http://127.0.0.1:8000/healthhttp://127.0.0.1:8000/health/keyshttp://127.0.0.1:8000/health/pipeline
From repo root:
npm install
npm run devOpen: http://localhost:3000
The app auto-targets <current-host>:8000, but you can override:
NEXT_PUBLIC_WS_HOST(example:127.0.0.1:8000)NEXT_PUBLIC_WS_CLIENT_KEY(if backend usesWS_CLIENT_KEY)
GET /health- basic statusGET /health/keys- key presence and formatting checksGET /health/pipeline- active pipeline configurationWS /ws/translate- real-time stream endpoint- Query params:
language(hidefault in backend)sample_rate(8000-96000, frontend usually sends actual context rate)client_key(optional, required when backend key auth is enabled)
- Query params:
4401 Unauthorizedon WebSocket:- Ensure
WS_CLIENT_KEYin backend matchesNEXT_PUBLIC_WS_CLIENT_KEYon frontend.
- Ensure
4000close code:- Missing or invalid backend API keys; verify
backend/.envand restart server.
- Missing or invalid backend API keys; verify
- Groq key rejected:
- Use a real Groq secret key from console; must start with
gsk_.
- Use a real Groq secret key from console; must start with
- No transcript updates:
- Confirm browser mic permission and backend terminal logs.
- Keep secrets in
.envfiles only; never commit live keys. - Media fixtures and local caches are gitignored.
- Recommended flow: backend first, then frontend.
- Add role-based auth for secure multi-user usage.
- Add session history export and searchable transcript logs.
- Add language expansion beyond Hindi/Urdu input streams.
- Add CI pipeline with lint/test gates for frontend and backend.
- Add deployment profiles (Docker + cloud templates).
No license file is currently defined. Add one before public distribution.