How ashishghadigaonkar/ai-mock-interview works
Project Type and Purpose
• This is a full-stack, server-rendered Next.js application (“Prepwise”) for job interview preparation.
• It uses Next.js’s new App Router (app/ directory) for UI routes and API routes, Firebase for authentication and data storage, and external AI services (Vapi AI voice agents and Google Gemini) for question generation, mock interviewing, and feedback analysis.
File-Structure Analysis
• Top-level folders:
• app/ – Next.js server & client components (layout.tsx, page.tsx, nested route segments for auth and interviews)
• app/api/vapi/… – API route handlers that proxy requests to Vapi AI
• components/ – reusable React UI components and shadcn/ui primitives
• lib/ – shared utilities, Vapi SDK wrapper, and server actions for feedback generation
• firebase/ – Firebase admin (server) and client configuration
• constants/, types/ – static data and TypeScript interfaces
• Key configuration: next.config.ts, tsconfig.json, postcss.config.mjs
README Insights
• Tech stack: Next.js, Firebase (Auth & Firestore), Tailwind CSS, Vapi AI, Google Gemini, Zod, shadcn/ui
• Features highlight: email/password auth, interview creation with voice-agent question generation, live interview simulation, AI-driven feedback, interview dashboard.
Main Components & Interactions
a. Frontend UI (Next.js App)
• Client-side React Components under app/ and components/
• Layouts for authenticated vs. root pages
• Pages: Sign In/Up, Dashboard, Interview Details, Feedback
b. Backend / API Layer (Next.js Server)
• Server Components and API Route handlers (app/api/vapi/generate/route.ts)
• Server Actions in lib/actions to call AI for feedback
c. Firebase Service
• Auth: signin, signup flows via firebase/client.ts
• Firestore (or Realtime DB) via firebase/admin.ts to store interview metadata, transcripts, feedback
d. External AI Services
• Vapi AI Voice Agents (generate questions, conduct voice interview)
• Google Gemini (underlying LLM used by Vapi)
e. Utilities & SDK
• lib/vapi.sdk.ts wraps Vapi REST/WebSocket calls
• lib/utils.ts for shared helpers (classnames, random covers)
Architectural Patterns & Design Principles
• Separation of concerns: UI components vs. API routes vs. services
• Next.js App Router: server vs. client components, colocation of route handlers
• API Proxy pattern: Next.js API routes mediate between client and Vapi AI
• “Backend for Frontend” style: Next.js server acts as BFF to Firebase and AI services