·5 min read

Self-Hosted GPU, UI at the Edge: How I Deployed a WhisperX App

build-in-publicaiai-engineeringpythoncloudflarespeech-to-textllm|
PostLinkedIn
A flow diagram from the browser through the Cloudflare Worker, Workers VPC and a tunnel to WhisperX and a gemma4 model on self-hosted GPUs.

My speech-to-text side project, stt.yusypenko.com, transcribes audio, video and links with WhisperX, splits the text by speaker, and lets you summarise or chat with a recording. A rented cloud GPU running around the clock costs more than a side project earns, so the GPU work runs on a self-hosted server with an RTX 3060. Only the UI lives in the cloud.

How a transcript gets made

Every transcription is a BullMQ job. The Express API stores the upload and queues it. The worker sends the file to a FastAPI service that wraps the WhisperX CLI (large-v3 by default, with word alignment and pyannote diarization). That service answers 202 with a job id and runs WhisperX in a worker thread. The API polls its status every 5 s, for up to an hour, so no HTTP request stays open for the length of a transcription.

What you can do with a transcript

When a job finishes, the app sends an in-app notification (and an email, if you turned that on), and the transcript opens with every line labelled by speaker. From there you can:

  • Name the speakers. Click a label like SPEAKER_00 and rename it; the names are saved with the job.
  • Export it as TXT, DOCX, PDF or JSON. Exports run on their own queue and expire after 24 hours.
  • Summarise it. One click each for a summary, action items or key points, and you can save the results you want to keep next to the transcript.
  • Run your own prompts from a prompt library (below), and save the answers next to the transcript too.
  • Chat with it. Open a chat on a recording and ask questions; answers stream in as they are generated. Very long transcripts are trimmed to fit the model's context, with a note telling the model they were cut.

Prompt management

Summaries are just prompts, so prompts get their own page. Each prompt has a name, a description, a category (summary, analysis, extraction or custom) and a template, where {{transcription}} is replaced with the transcript text when it runs.

  • Built-in prompts. Summary, Action Items, Key Points and Questions ship with the app. Everyone sees them, and they can't be edited.
  • Your own prompts. Create, edit and delete prompts for the questions you ask every time: decisions made in a meeting, quotes from an interview, a draft follow-up email.
  • Shared prompts. Mark a prompt public and every account on the app can use it.
  • Let the model write it. Describe what you want and the model drafts the name, description and template; or paste an existing template and ask it to improve it.
  • Most-used first. Every run is counted, and the list shows built-in prompts first, then the rest by how often they're used.
On a transcript, you pick a prompt and run it; the answer can be saved alongside the summaries.

A self-hosted LLM next to WhisperX

All of those AI features run on gemma4 (the 26B model) served by Ollama, on a second GPU next to the one WhisperX uses. While the local model is up, transcripts don't leave the server for summaries or chat. The backend talks to it through the OpenAI-compatible API, so the same client falls back to OpenAI (gpt-4o-mini) when the local model isn't available.

One gotcha: gemma4 "thinks" before it answers by default, and that thinking could use up the whole token budget and return an empty reply. Setting reasoning_effort to none fixed it and made answers faster.

How it's deployed

The UI is a static export of the Next.js 14 app, served by a Cloudflare Worker. OpenNext dropped Next 14, so every page renders on the client. Dynamic routes like /transcriptions/:id export one placeholder page, and the page reads the real id from the URL.

Everything under /api/* is proxied by the Worker through a Workers VPC service into a Cloudflare Tunnel. The tunnel has no public hostname, and the server has no open ports. Two things bit me here:

  • The tunnel can't resolve Docker Compose service names, so the backend gets a fixed IP on the tunnel's network.
  • expect: 100-continue made the VPC proxy answer 520, so the Worker strips hop-by-hop headers before forwarding.
Cloudflare caps a request body at 100 MB, so files over 80 MB upload in 50 MB chunks.

What I learned

Split the system by what each part costs to keep running, not by what's tidy. The UI is cheap and needs to be always up, so it sits at the edge. The GPU is expensive and can be offline, so it runs on its own server behind a queue that waits. The work then goes into the seam between them: the Worker, the VPC service and the tunnel that connect the two.

Oleksandr Yusypenko

Oleksandr Yusypenko

Senior Full-Stack + AI Engineer. Building in public — AI agents, LangGraph, production systems.