Language · 2026
VieCareer, an AI mock-interview platform
A live product that reads your CV against a job description, then interviews you out loud with a real-time voice interviewer that asks about that job and that CV, on the web and on mobile.
Live at viecareer.site · voice interviews over WebRTC and WebSocket
- Problem
- Interview practice is either a generic question bank or a paid human coach. A candidate needs to know how their CV reads against one specific job, then rehearse out loud with an interviewer who asks about that job and that CV, in Vietnamese or English.
- Approach
- A FastAPI backend behind a React + Tailwind web app and a mobile app. CVs are parsed to text, filtered by a spam guard, fingerprinted and analysed against the job description with low-temperature JSON calls to the OpenAI API. The analysis seeds an interview blueprint, and the interview runs live on the OpenAI Realtime API: straight from the browser over WebRTC with a short-lived token, or through a server-owned WebSocket relay that enforces the plan's time limit and scores each answer.
- Result
- In production at viecareer.site with free and paid plans, voice interviews in Vietnamese and English, coding interviews with AI grading, and 23 backend test suites. [Add one measured number: interviews run, median delay from end of answer to interviewer reply, or CV analyses per week.]
Problem
Most interview-prep tools stop at text: paste a CV, get a score. Real interviews are spoken, follow up on what you just said, and run against a clock. VieCareer tries to cover the whole loop: show the gap between a CV and a job description, turn that gap into an interview plan, run the interview by voice, and hand back a report that says where the candidate was weak.
What I built
- Backend and AI integration. The FastAPI service (17 routers), every prompt and LLM call, retries and usage tracking, plan quotas and billing hooks.
- Realtime streaming. The voice interview path: WebRTC token minting, the WebSocket relay, push-to-talk transcription, live scoring and transcript persistence.
- Data and CV handling. File parsing, the spam guard and dedupe cache, normalising LLM output before it reaches the database, the sync API that keeps web and mobile on the same state, and the job-market ingester.
- Front end. Co-designed the web app with React + Tailwind; designed and built the mobile UI and app, which talks to its own versioned realtime protocol on the relay.
Architecture
Web + mobile clients. React + Tailwind web app on Vercel and a mobile app. Sign-in through Clerk; every API call carries a Clerk JWT that the backend verifies against the JWKS.
FastAPI edge. Middleware stack: payload-size limit (rejects oversized uploads before parsing), a 90 s timeout for AI routes (180 s for crawler preview and report export), a 120 req/min IP limit with Redis as shared storage, and strict CORS in production.
CV + JD analysis. PDF, DOCX or TXT is parsed to plain text (pypdf, then PyPDF2, then pdfminer as fallbacks). A spam guard checks length bounds and repetition, a SHA-256 fingerprint of the pair hits a 10-minute Postgres cache, and only then does a low-temperature JSON call score ATS components, gaps and readiness signals.
Interview blueprint. The analysis and the candidate profile feed a blueprint designer prompt. An adaptive selector then picks the next unanswered question from the blueprint, so the interviewer follows the plan instead of improvising.
Realtime voice. Two transports on the OpenAI Realtime API. WebRTC: the backend mints an ephemeral client secret so the API key never reaches the browser. WebSocket relay: the server holds the OpenAI socket and runs three tasks (client to model, model to client, time-limit watchdog).
Scoring + report. Push-to-talk answers go through gpt-4o-mini-transcribe, a gpt-4o transcript polish, then a live answer scorer. At the end a combiner prompt merges per-answer scores and the CV analysis into the final report.
Postgres on Supabase. Profiles, analyses, gap items, interview sessions, transcript events, Q&A pairs, quotas and billing, managed with dated SQL migrations. A sync endpoint returns one snapshot for web and mobile.
The realtime path
The voice interview was the hardest part to get right, because three clocks run at once: the candidate speaking, the model generating audio, and the plan’s time limit.
- Two transports, one session model. A browser can talk to OpenAI directly over WebRTC for the lowest latency; the backend only mints a short-lived client secret with the session config (blueprint, CV context, voice mode) baked in. The mobile app (on its own versioned protocol) and push-to-talk mode go through a server-owned WebSocket relay instead, so the server sees every event and can persist the transcript.
- The relay is three tasks. Client to OpenAI, OpenAI to client, and a watchdog that ends the session when the plan’s duration runs out. Whichever finishes first cancels the other two, and a
finallyblock always closes the session and logs a cost estimate, even when the browser just disappears. - Keeping the interviewer on script. The relay tracks which blueprint questions were asked and answered, classifies whether a candidate turn actually answers the active question, and keeps a repeated question attached to its original id so progress is not counted twice. Clarification requests repeat the question without advancing.
- Push-to-talk. Audio chunks are buffered as base64 PCM, transcribed, polished by a second model to fix ASR errors (diacritics in Vietnamese especially), then scored, with progress events sent to the client at each step so the UI never looks frozen.
CV and data handling
- Parsing that degrades instead of failing. Three PDF parsers in sequence, plus DOCX and TXT, with extracted text capped at 60,000 characters before it is stored.
- Spam guard before spend. A CV must be 250–60,000 characters and a JD 120–50,000, repeated filler is rejected, and identical CV + JD pairs within 10 minutes are served from cache instead of calling the model again.
- Never trust the model’s JSON. The analysis prompt pins the gap categories to five fixed names; on top of that, the service normalises categories, statuses and scores before inserting gap items and readiness signals, so a drifting model output cannot break the reports page.
- Job market. A crawler reads JSON-LD
JobPostingdata, checksrobots.txtbefore fetching, waits between requests, and keeps each third-party source switched off until the operator records written permission.
Keeping it up
Rate limiting is layered: per IP (slowapi, Redis-backed so it holds across instances), per user, stricter limits on AI, upload and scoring routes, a daily AI request budget, a cap of 10 concurrent AI calls that fails fast with a retryable AI_BUSY instead of queueing, and at most 3 realtime sockets per IP and 50 overall. OpenAI calls retry only on transient errors (rate limit, timeout, dropped connection) with exponential backoff, and every call is logged with its duration and token usage. The service ships as a two-stage Docker image running as a non-root user.
Challenges and lessons
- Latency is a product decision. [Note what end-of-answer to first-audio delay you measured on WebRTC versus the relay, and why mobile ended up on the relay.]
- Quotas have to survive bad networks. An interview attempt is charged when the session is created, and a dropped connection does not refund it. [Describe the abuse or support case that pushed you to this rule.]
- Vietnamese ASR. [Which errors the polish step fixed most often, and whether it was worth the extra model call.]
Links
- Backend (FastAPI, realtime relay, CV pipeline): github.com/x23d8/viecareer_backend
- Live product: viecareer.site (sign-in needed for the interview features)
The demo is hosted at www.viecareer.site. Nothing loads until you ask.