August 22, 2026

How I Built an AI Interview Coaching Platform with Next.js, OpenRouter & Paystack

A technical walkthrough of InterviewIQ's guided interview flow, structured AI feedback, MongoDB session model, and Paystack subscription lifecycle.

The Problem

Interview preparation is often a collection of generic questions and disconnected notes. Candidates need a way to practice in context, answer one question at a time, and understand exactly what to improve after each response.

InterviewIQ is built around that practice loop: configure an interview, answer realistic questions, receive specific feedback, and review the complete session afterward.

The Application Architecture

InterviewIQ is a Next.js App Router application. Server route handlers coordinate authentication, persistence, AI calls, and payments.

The application uses:

How an Interview Works

The candidate chooses a role, seniority level, and interview format. The supported formats are behavioral, technical, and situational. The server validates those inputs before creating an in-progress interview session with five questions.

When the next question is requested, the server rebuilds the conversation history and sends it to OpenRouter with a format-specific system prompt. The prompt asks the model to behave like an interviewer, ask one focused question at a time, and stay aligned with the selected role and format.

When the candidate submits an answer, the answer route sends the question, answer, and previous exchanges through the same interview context. The AI returns structured feedback containing a score, one strength, one improvement, and one practical tip. Each exchange is stored in the MongoDB interview session.

After the final answer, a second summary request produces an overall score, verdict, top strength, top growth area, readiness level, and a three-step action plan.

Key Implementation Decisions

The interview session is the source of truth. It stores the role, level, interview type, progress, exchanges, feedback, final report, timestamps, and duration. Session lookups are scoped to the authenticated user's ID.

The prompt layer gives behavioral interviews STAR-method guidance, technical interviews role-specific problem-solving guidance, and situational interviews hypothetical decision-making guidance.

The response parser is defensive. It looks for the expected JSON feedback block, then tries to extract a JSON object containing a score. If parsing fails, the application falls back to usable feedback instead of breaking the interview flow. Final-report parsing has a similar fallback based on saved answer scores.

Paystack Integration

Paid access is handled through a separate subscription path. An authenticated user selects a plan, the server creates a Paystack customer when needed, initializes a transaction with plan metadata, and stores a pending subscription record in MongoDB.

The payment callback verifies the transaction with Paystack before updating the user's plan. The webhook route verifies Paystack's signature and handles subscription creation, successful charges, cancellations, and failed invoices. Payment credentials stay on the server-side integration boundary.

Challenges

The hardest part of an AI interview flow is maintaining structure while still allowing natural conversation. Rebuilding message history for every question keeps the model aware of the role, format, previous questions, and answers.

Model output is not automatically reliable JSON, so parsing and fallback reports are deliberate safeguards. A malformed response should become recoverable feedback, not an abandoned session.

Payments introduced a separate state-management problem. Checkout, verification, recurring subscription events, plan state, and failed invoices happen at different times, so the product stores pending and active subscription records instead of treating a browser redirect as proof of payment.

Lessons Learned

AI products benefit from a strong application contract around the model. Clear prompt formats, validated inputs, persisted session state, defensive parsing, and explicit fallback behavior make the AI layer easier to reason about.

The project also reinforced the value of keeping integrations behind server routes. Authentication, MongoDB access, OpenRouter credentials, and Paystack secrets are not responsibilities of the browser UI.

The coaching experience is the complete loop rather than a single model call: configure, ask, answer, evaluate, persist, summarize, and review.