How lovelyshades/ai_powered_tech_interview_prep works
Project Type and Purpose
• This is a full-stack, real-time web application (“AI Tech Interview”) built with React/Next.js on the frontend, Supabase (Auth, Postgres, Edge Functions) on the backend, and OpenAI’s Realtime APIs (GPT-4o & Whisper) for AI transcription and feedback.
• It simulates a technical interview environment supporting coding, text, and live voice questions, delivering instant or deferred AI-driven feedback.
a. Frontend Application
• Pages (Landing, Interview, Results, NotFound)
• UI Components (AuthDialog, LiveInterviewPanel, MonacoEditor, AnswerPanel, etc.)
• Hooks & State Store (useAuth, useSecureQuestions, sessionStore)
• Client Integrations (Supabase client.ts, OpenAI Realtime bridge in lib/codeRunner.ts)
b. Supabase Services
• Auth & Storage (built-in Supabase features)
• Postgres Database (questions, sessions, answers)
• Edge Functions (evaluate-answer, get-question, realtime-interview, text-to-speech, transcribe-audio)
• Migrations (schema definitions)
c. External AI Services
• OpenAI Realtime API (WebSocket for GPT-4o feedback)
• Whisper Transcription (audio→text)
d. Supporting Utilities
• Audio utils (AudioRecorder, RealtimeAudio, VoicePlayer)
• Shared utils (utils.ts, use-toast, codeRunner)
• User → Frontend (HTTP/WebSocket):
• Auth requests to Supabase Auth
• Page fetches & static assets via Vite/AWS CDN (if deployed)
• Frontend → Supabase Edge Functions (HTTP/REST):
• get-question → fetch interview questions
• evaluate-answer → run code tests or AI evaluation
• text-to-speech → synthesize questions
• transcribe-audio → receive transcripts
• Frontend ↔ Supabase Realtime (WebSocket):
• realtime-interview function bridges audio stream to OpenAI Realtime
• Frontend ↔ OpenAI Realtime API (WebSocket):
• Stream audio & receive live transcription/feedback
• Edge Functions → Database (internal Postgres connection)
• Edge Functions → External OpenAI APIs (HTTP/WebSocket)
Architectural Patterns & Principles
• Modular Frontend: clear separation of pages, reusable UI primitives, domain-specific components (auth, interview, UI library).
• Backend as Functions: serverless edge functions isolate each use case (evaluation, transcription, TTS, real-time bridging).
• Reactive State Management: sessionStore drives interview state across panels.
• API Gateway Pattern: Supabase functions act as internal API endpoints.
• Event-Driven Streams: WebSocket streams for real-time audio and AI feedback.
1) User (browser)
2) Frontend App (React/Next.js + hooks + UI)
3) Backend:
– Supabase Edge Functions
– Supabase Auth & Postgres DB
– External AI Services
b. Within the Frontend layer, group:
– Pages & Routing
– Component Library
– State Store & Hooks
– Integrations folder (client.ts)
c. Within the Backend layer, group each edge function as a microservice.
d. Postgres DB below the edge functions, connected via internal lines.