Cloud transcription backend for StenoDrop's
web app. This is an opt-in "Cloud" mode: the browser app runs Whisper
base locally by default (fully offline), and this server exists only for
visitors who explicitly choose better accuracy at the cost of sending audio
to a server for the duration of one request.
It runs whisper.cpp with the
large-v3-turbo ggml model behind a small Rust/Axum HTTP API.
GET /health
-> 200 { "status": "ok", "model": "large-v3-turbo" }
POST /transcribe
multipart/form-data:
file audio file (wav/mp3/m4a/etc; 16kHz mono WAV preferred)
language ISO-639-1 code, or "auto" (default)
translate "true" | "false"
-> 200 { "text": "...", "language_used": "..." }
-> 400 { "error": "..." } bad input (oversized file, bad field, etc.)
-> 429 { "error": "..." } rate limited
-> 500 { "error": "..." } transcription failed / timed out
Supported language codes (matches the native apps' language list, see
src/languages.rs): auto, ur, en, ar, bn, zh, fr, de, hi, id, it, ja, ko, fa, pt, pa, ps, ru, es, tr.
This is a free, unauthenticated, publicly reachable endpoint, so the following are non-negotiable and always on:
- 50 MB upload cap, rejected with
400before any transcription work begins. - Per-IP rate limit: 10 requests / 10 minutes, returns
429with a clear message when exceeded (seesrc/rate_limit.rs). - CORS locked to
https://fahdi.github.ioexactly — not a wildcard, not "reflect any origin". - 120s request timeout so one stuck job can't hang the server.
- No audio or transcript logging. Uploaded audio is written to a
per-request temp directory and deleted immediately after the response is
sent (success, failure, or timeout — see the
TempDirGuardinsrc/main.rs). Only aggregate metrics (request count, duration, success/failure) go to stdout viatracing.
Requires Docker with Compose v2 (docker compose, not docker-compose).
git clone --recurse-submodules https://github.com/fahdi/stenodrop-server.git
cd stenodrop-server
docker compose up --buildFirst build takes a while: it compiles whisper.cpp from source and
downloads the large-v3-turbo model (~1.6 GB) from Hugging Face
(https://huggingface.co/ggerganov/whisper.cpp). Subsequent builds reuse
Docker's layer cache unless whisper.cpp/ or src/ changed.
Once it's up:
curl http://localhost:8080/health
# {"status":"ok","model":"large-v3-turbo"}
curl -X POST http://localhost:8080/transcribe \
-F "file=@/path/to/audio.wav" \
-F "language=auto" \
-F "translate=false"# 1. Build whisper.cpp once:
cmake -S whisper.cpp -B whisper.cpp/build -DCMAKE_BUILD_TYPE=Release
cmake --build whisper.cpp/build -j --config Release --target whisper-cli
# 2. Download the model once:
mkdir -p models
curl -fL -o models/ggml-large-v3-turbo.bin \
https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin
# 3. Run the server:
export WHISPER_CLI_PATH="$PWD/whisper.cpp/build/bin/whisper-cli"
export WHISPER_MODEL_PATH="$PWD/models/ggml-large-v3-turbo.bin"
cargo run --release# Unit tests (rate limiter, validation, whisper arg building) — no server needed:
cargo test
# End-to-end test against a running instance (macOS only; uses `say` + ffmpeg
# to synthesize real speech and verifies a real transcript comes back):
SERVER_URL=http://127.0.0.1:8080 ./tests/e2e-test.sh
# Abuse-protection checks against a running instance (oversized upload -> 400,
# rate limit -> 429, CORS header scoping):
SERVER_URL=http://127.0.0.1:8080 ./tests/abuse-protection-test.shThis covers deploying behind an existing reverse proxy (e.g. Nginx) on a server like isupercoder.com, where TLS is presumably already terminated for other sites.
-
Get the code onto the server (clone over SSH, or
git archive/scpif you'd rather not put a GitHub deploy key on the box):ssh you@your-server.example.com git clone --recurse-submodules https://github.com/fahdi/stenodrop-server.git cd stenodrop-server -
Build and start the container, bound to localhost only (Nginx will proxy to it; there is no reason for port 8080 to be reachable directly from the internet):
Edit
docker-compose.yml'sports:to bind to loopback:ports: - "127.0.0.1:8080:8080"
Then:
docker compose up --build -d docker compose logs -f # confirm "listening on 0.0.0.0:8080" and no errors curl http://127.0.0.1:8080/health -
Point a subdomain at it, e.g.
cloud.stenodrop.apporstenodrop-api.isupercoder.com. Add an A/AAAA record for that subdomain pointing at the server's IP (same as your other sites on that box). -
Reverse proxy + TLS: if the existing Nginx on that host already handles TLS for other subdomains (e.g. via certbot / an existing wildcard cert), add a new server block for the new subdomain and proxy to the container's loopback port:
server { listen 443 ssl; server_name cloud.stenodrop.app; # reuse your existing cert config here (same as other server blocks), # or run: certbot --nginx -d cloud.stenodrop.app # if this subdomain needs its own certificate. client_max_body_size 55m; # a little above the app's 50MB cap location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 130s; # above the app's 120s request timeout } } server { listen 80; server_name cloud.stenodrop.app; return 301 https://$host$request_uri; }
Reload Nginx:
sudo nginx -t && sudo systemctl reload nginx.If this is a brand-new subdomain with no existing cert coverage, get one first:
sudo certbot --nginx -d cloud.stenodrop.app(assumes certbot is already installed, as it presumably is if it manages other sites on the box). -
Point the browser client at it: set the client's Cloud-mode API base URL to
https://cloud.stenodrop.app(or whatever subdomain you chose). The client checks/healthon load and disables Cloud mode with a clear note if it's unreachable, so this can be done independently of the client deploy. -
Keep it running / restart on reboot:
restart: unless-stoppedindocker-compose.ymlhandles both container crashes and host reboots (as long as the Docker daemon itself is set to start on boot, which is the default on most distros).
cd stenodrop-server
git pull
docker compose up --build -dThe model layer is cached, so this only rebuilds what changed (whisper.cpp
or the Rust server), not a 1.6 GB re-download, unless the Dockerfile's
MODEL_URL line itself changed.
CPU inference is the default and the only thing this repo tests/verifies. If the deploy host has an NVIDIA GPU and nvidia-container-toolkit installed, you can get faster inference:
- In
Dockerfile'swhisper-buildstage, build with CUDA support instead of the default CPU build:(this also requires switching the base images toRUN cmake -S whisper.cpp -B whisper.cpp/build -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=1 \ && cmake --build whisper.cpp/build -j --config Release --target whisper-clinvidia/cuda:...-develand...-runtimevariants instead ofdebian:bookworm-slim— see whisper.cpp's own README section "Nvidia GPU support" for the exact CUDA toolkit version to match your driver). - Uncomment the
deploy.resources.reservations.devicesblock indocker-compose.yml. - Rebuild:
docker compose up --build -d.
This is genuinely optional — CPU inference on large-v3-turbo is
reasonably fast for the one-file-at-a-time use case this server serves.
| Variable | Default | Purpose |
|---|---|---|
BIND_ADDR |
0.0.0.0:8080 |
Address/port the server listens on |
WHISPER_CLI_PATH |
/app/whisper.cpp/build/bin/whisper-cli |
Path to the whisper-cli binary |
WHISPER_MODEL_PATH |
/app/models/ggml-large-v3-turbo.bin |
Path to the ggml model file |
RUST_LOG |
info |
Log verbosity (tracing/env-filter) |
- Why Rust/Axum: keeps this consistent with the engine choice used throughout the rest of the StenoDrop project (whisper.cpp, not a Python stack) and produces a small, dependency-light, easily containerized binary.
- Why
large-v3-turboover fulllarge-v3: meaningfully smaller and faster while retaining most of the accuracy gain over the browser app's localbasemodel — a good balance for a server that's meant to serve many small, one-off requests rather than batch jobs. - Why whisper-cli subprocess instead of linking whisper.cpp as a library
directly: mirrors the exact invocation pattern the native macOS app
already uses (
WhisperEngine.swift):-l <lang>,--translate,-otxt -of <base>,-np. Keeping the same CLI flags across native and server code paths means transcript behavior (formatting, no timestamps, no progress spam) stays consistent everywhere StenoDrop runs.