Skip to content
RAKIB.
How I Built MockMate AI
Next.js
Jul 4, 2026
2 min read

How I Built MockMate AI

A deep dive into the design decisions, real-time voice integration, and prompt engineering strategies behind MockMate AI.

#Next.js#Generative AI#Speech Recognition#Tailwind CSS

Why MockMate AI?#

Preparation is the difference between passing and failing technical interviews. But practicing alone is hard—you can't assess your own responses objectively. That's why I built MockMate AI, a real-time web platform that acts as a simulated interviewer, giving developers instant actionable feedback.

The Key Pillars of Architecture#

Building a real-time voice-driven application presents unique challenges: 1. Low Latency: Interview conversations feel awkward if there's a 5-second delay. 2. Audio Transcription Cost: Server-side transcription APIs can get expensive quickly. 3. Structured Outputs: The AI must output deterministic ratings and feedback categories.

Here is how I resolved these issues:

Local Transcription via Speech Recognition API Instead of recording audio files, uploading them, and invoking Whisper on the server, I offloaded transcription entirely to the client's device using the browser's native Web Speech API:#

javascript
Loading code...

This reduced our transcription costs to $0.00 and eliminated API call roundtrip delays.


Designing the Structured AI Prompt#

The server receives the transcribed text, compares it against the generated question, and formats a payload for Gemini 1.5 Flash. To ensure we get a clean JSON response, we use prompt-enforced schemas: The server receives the transcribed text, compares it against the generated question, and formats a payload for Gemini 2.5 Flash. To ensure we get a clean JSON response, we use prompt-enforced schemas:

Important: Prompt engineering is essentially programming in English. If you don't constrain the output, the model will return conversational text instead of raw database-friendly JSON.
typescript
Loading code...

What I Learned#

Building this SaaS platform single-handedly was a great learning experience. The hardest part was managing local browser voice constraints on Safari/iOS, which require active user click gestures to start audio recording tracks.

In my next iteration, I plan to add streaming WebSockets for model token generation, allowing MockMate to talk back to users word-by-word like a real phone call.

Have thoughts, feedback, or want to discuss this architecture? Drop an email