A two-person language practice prototype with the pink/green frontend, LiveKit audio/video rooms, Azure Speech pronunciation assessment, and a separate scoring worker. See the integration guide for the connected UI, API routes, and Railway setup.
- Create a LiveKit project and an Azure Speech resource. Copy
.env.exampleto.env.localand fill in the credentials. SetSESSION_SECRETto at least 32 random characters. Keep both provider secrets on the server. - Use Node.js 22.22 or newer (
nvm useif you use nvm). Runnpm cianddocker compose up -d. Yapply uses host port 5433 for PostgreSQL by default; setYAPPLY_POSTGRES_PORTif that port is occupied, and use the same port inDATABASE_URL. - Run
npm run devand openhttp://localhost:3000. - Create a room in one browser profile. Copy its 10-character code into another profile or private window to join. Each profile gets a separate guest session. Allow microphone access, start the match, then click Start pronunciation analysis.
The database init scripts run only when the Docker volume is new. If you already started the database before this code was added, apply the new migration and challenge seed manually:
docker compose exec -T postgres psql -U app -d langgame < db/migrations/0002_pronunciation_attempts.sql
docker compose exec -T postgres psql -U app -d langgame < db/seed.sql
docker compose exec -T postgres psql -U app -d langgame < db/migrations/0003_enable_rls.sqlFor a new Supabase database, use its SQL Editor to run db/migrations/0001_init.sql,
db/migrations/0002_pronunciation_attempts.sql, db/seed.sql, and
db/migrations/0003_enable_rls.sql in that order. The last migration blocks
Supabase's anon and authenticated API roles from accessing the app's tables;
the server continues to use its direct PostgreSQL connection.
- A server-issued, room-scoped LiveKit token lets only match participants join their room. LiveKit carries the human conversation directly. The room is closed when the match ends.
- The browser reads only its local microphone track. An AudioWorklet detects short turns and streams mono 16 kHz PCM to the server while the user speaks. Browsers without streaming request support send a completed WAV clip instead. The prompted Pronunciation Battle can also be recorded on demand.
- The server validates match membership, clip length, locale, and assessment count and feeds streamed audio to Azure as it arrives. Scripted attempts use the seeded challenge phrase as reference text; spontaneous turns use unscripted assessment.
- Azure aggregate scores go into
pronunciation_attempts; notable word and phoneme errors go intopronunciation_results. Azure-recognized text goes intotranscript_turns.match_scoresremains for the separate full conversation grader described in the design document. - Raw audio is held only while scoring and is discarded. The app does not yet offer saved recordings, even when
save_audio_opt_inis true. - Match transcripts are marked for deletion after 30 days. Schedule
npm run db:purge-transcriptsdaily to clear expired text; pronunciation scores remain. - Prosody is requested only for
en-US, following Azure's current locale support.
Run npm run typecheck, npm test, and npm run build. The WAV and Azure result tests do not require provider credentials. A live end-to-end call and assessment require valid LiveKit and Azure credentials.
The app provides guest sessions and share-code rooms. Guest sessions last in that browser for 30 days; there is no account recovery. Random matchmaking, AI opponents, production authentication, moderation, and ElevenLabs transcription remain future features. The separate worker in backend/ supplies overall scoring through the /api/matches/:id/score route.