Real-time speech · edge-to-cloud pipeline
Hear it once, read it on screen—live. Caption Live listens to speech in 55+ languages from around the world and shows it on screen in your own language, with 200+ languages supported for captions and translation. It runs in your browser, so you can bring that to meetings, classes, and events without a complicated setup—and your sensitive account details stay protected on the server, not exposed in the page.
Production-grade captioning requires low-latency partial results, stable final segments for downstream translation, and a trust boundary that never ships vendor master keys to end users. This application implements that split: ephemeral Speechmatics realtime JWTs minted on the server, translation executed in Next.js route handlers, and presentation logic isolated in React hooks and typed services.
The client acquires microphone input via getUserMedia, then runs a Web Audio graph to produce 16 kHz mono floating-point PCM aligned with Speechmatics "raw" binary frames. Chunks are pushed over a realtime WebSocket using a configurable regional endpoint, with explicit stream lifecycle messages (start / end-of-stream) to bound sessions and recover cleanly.
Each finalized transcript segment can be sent to POST /api/translate, which supports both Cloud Translation v2 (basic) and v3 (advanced) clients based on environment configuration. Source and target BCP-47-style language codes are validated against a curated picker; translation can be disabled when the target is "none" for pure captioning workflows.
/share/[id].A web app manifest and service worker registration enable install-to-homescreen flows and static asset caching appropriate for field deployments on tablets or dedicated captioning hardware—without compromising the realtime requirement that live audio still traverse the network during active sessions.
The codebase is structured as a Next.js App Router project with colocated Vitest coverage on transcript coalescing, phrase buffering, PCM helpers, and Speechmatics client protocol edges. Cross-cutting concerns—language metadata, speaker display strings, caption layout storage—live in small modules with explicit types for transcript segments and publish payloads, which keeps UI components thin and testable.
This page is the default route; the interactive studio runs under /live. Use the sidebar logo anytime to return here.
| Layer | Technology | Purpose in this app |
|---|---|---|
| Hosting / runtime | Vercel (Next.js App Router) | Deploys server routes and static assets; runs API handlers for token minting, translation, and summary generation. |
| Frontend | React 19 + Next.js 15 + TypeScript | Powers the live caption interface, settings UX, and share/read views. |
| Styling | Tailwind CSS 4 | Provides utility-first styling for responsive operator and viewer layouts. |
| Speech-to-text | Speechmatics Realtime API (WebSocket) | Converts live microphone audio into partial/final transcripts with optional diarization. |
| Translation | Google Cloud Translation (v2/v3) | Translates finalized transcript segments into the target display language. |
| AI summaries | OpenRouter Chat Completions (`OPENROUTER_SUMMARY_MODEL`, default `openrouter/free`) | Generates session summaries from transcript text through the/api/ai/summaryroute. |
| Database (cloud) | Postgres via Vercel/Neon integration | Stores published sessions (`published_sessions`) for shareable public links. |
| Persistence fallback | Filesystem JSON storage | Used when cloud Postgres is not configured (`POSTGRES_URL` absent). |
| On-device storage | IndexedDB + localStorage | Keeps private session history and operator preferences on the local browser. |
| PWA capabilities | Web App Manifest + Service Worker | Enables install-to-homescreen and static asset caching for field usage. |
| ZIP export tool | JSZip | Builds downloadable archive files containing transcript, translation, summaries, and manifest metadata. |
| Testing | Vitest + Testing Library | Covers transcript processing, audio helpers, and critical client behavior. |