PrepAI is an enterprise-grade technical interview simulation, live polyglot coding studio, and career acceleration platform. Designed with an editorial, minimalist aesthetic inspired by Sarvam.ai, the system combines real-time conversational voice agents, isolated multi-language code execution sandboxes, adversarial stress testing suites, AST static complexity profilers, and autonomous ATS career pipelines.
- System Architecture & Data Flow
- Artificial Intelligence & Machine Learning Stack
- Live Polyglot Coding Studio & Sandbox Engine
- AI Voice Copilot & Technical Interviewer
- AI Career Agent & ATS Confirmation Engine
- Responsive Mobile & Tablet UI/UX
- Database Schema & Persistence Layer
- API Route Reference
- Local Setup & Development
- Production Deployment Guide (Vercel & Render)
- Contributors & License
PrepAI operates as a modern decoupled full-stack architecture. The frontend is built on Next.js 16 (App Router with Turbopack) deployed to Vercel, interfacing with a high-concurrency FastAPI backend service on Render connected to a serverless Neon PostgreSQL cluster.
flowchart TB
subgraph Client ["Frontend: Next.js 16 / React 19 / Sarvam Aesthetic"]
UI[Workspace Dashboard & Analytics]
LCS[Live Coding Studio & Split Editor]
VC[Voice Copilot & Web Audio Meter]
CA[AI Career Agent & Kanban Tracker]
PR[Problem & Math Renderer]
end
subgraph Gateway ["API Gateway: FastAPI / Uvicorn Server"]
AUTH[Auth & Profile Router]
CODE_ROUTER["/api/code (Coding Studio Router)"]
VOICE_ROUTER["/api/voice-copilot (Voice Router)"]
CAREER_ROUTER["/api/career (Career Agent Router)"]
end
subgraph Sandbox ["Polyglot Subprocess Execution Sandbox"]
CPP["C++ GCC 17 (-O2)"]
JAVA["Java OpenJDK 21"]
PY["Python 3.11 Harness"]
NODE["Node.js (JS/TS ES6)"]
GO["Go 1.22 Runner"]
end
subgraph AI_Engines ["AI, ML & Speech Intelligence Layer"]
GROQ_HEAVY["Groq LLaMA-3.3-70B Versatile"]
GROQ_LIGHT["Groq Qwen-3.6-27B / LLaMA-3.1-8B"]
SARVAM_STT["Sarvam saaras:v3 (STT)"]
SARVAM_TTS["Sarvam bulbul:v3 (TTS)"]
AST_ANALYZER["Native AST Static Analyzer"]
CHAOS_ENGINE["Adversarial Stress Tester"]
TFIDF["From-Scratch TF-IDF Vectorizer"]
EMAIL_SVC["SMTP ATS Confirmation Gateway"]
end
subgraph Storage ["Persistence Layer: Neon PostgreSQL"]
PG[(PostgreSQL Relational DB)]
end
Client <-->|REST API / WebSocket / CORS| Gateway
CODE_ROUTER --> Sandbox
CODE_ROUTER --> AST_ANALYZER
CODE_ROUTER --> CHAOS_ENGINE
CODE_ROUTER --> GROQ_HEAVY
VOICE_ROUTER --> SARVAM_STT
VOICE_ROUTER --> SARVAM_TTS
VOICE_ROUTER --> GROQ_HEAVY
CAREER_ROUTER --> TFIDF
CAREER_ROUTER --> EMAIL_SVC
CAREER_ROUTER --> GROQ_LIGHT
Gateway --> PG
PrepAI utilizes a dual-tier model hierarchy orchestrated via the Groq high-speed LPU inference engine:
| Tier | Model Identifier | Primary Responsibilities |
|---|---|---|
| Heavy Reasoning Engine | llama-3.3-70b-versatile (or openai/gpt-oss-120b) |
Complex AST code quality evaluation, algorithmic time/space proofing, Socratic interview generation, hiring committee scorecards, and tailored preparation roadmap synthesis. |
| Low-Latency Agent Engine | llama-3.1-8b-instant (or qwen/qwen3.6-27b) |
Real-time conversational interview guidance, quick prompt hints, rapid resume entity parsing, and ATS cover answer formulation. |
For ultra-low latency, natural voice interactions with Indian English accent optimization and multilingual support:
- Speech-to-Text (
saaras:v3): Transcribes 8kHz/16kHz PCM audio streams, handling domain-specific technical vocabulary, acronyms (e.g.gRPC,Redis,K8s,AST,Big-O), and code-mixed cadence. - Text-to-Speech (
bulbul:v3): Synthesizes expressive, natural audio responses streamed back to the client over WebSocket or REST with configurable voice models and pace parameters. - Multi-Provider Fallbacks: Configured with automatic graceful fallbacks to Groq Whisper-large-v3, OpenAI
tts-1, or local Faster-Whisper / Kokoro TTS.
Located in backend/ml/tfidf/tfidf.py, this matching engine is written entirely from scratch without external dependencies (e.g., scikit-learn). It mathematically ranks job opportunities against parsed candidate resumes.
- Stopword Filtration & Tokenization: Cleans punctuation, normalizes cases, and strips grammatical noise using an internal high-efficiency vocabulary filter.
-
Term Frequency (TF):
$$\text{TF}(t, d) = \frac{f_{t,d}}{\sum_{t' \in d} f_{t',d}}$$ Where$f_{t,d}$ is the raw count of term$t$ in document$d$ . -
Logarithmically Smoothed Inverse Document Frequency (IDF):
$$\text{IDF}(t) = \ln\left(\frac{1 + N}{1 + \text{DF}(t)}\right) + 1$$ Where$N$ is the total document count and$\text{DF}(t)$ is the count of documents containing term$t$ . -
Vector Normalization & Cosine Similarity:
$$\text{Cosine Similarity}(V_{\text{resume}}, V_{\text{job}}) = \frac{V_{\text{resume}} \cdot V_{\text{job}}}{|V_{\text{resume}}| |V_{\text{job}}|} = \frac{\sum_{i=1}^n V_{1i} V_{2i}}{\sqrt{\sum_{i=1}^n V_{1i}^2} \sqrt{\sum_{i=1}^n V_{2i}^2}}$$
Located in backend/ml/evaluation/evaluation.py, this evaluator scores spoken responses during Voice Copilot mock interviews:
- Keyword Alignment Analysis: Tokenizes questions, matches candidate transcripts against expected technical concept dictionaries, and computes dynamic keyword ratios.
-
Semantic Alignment Score:
$$\text{Raw Score} = 0.40 \times \text{Cosine Similarity} + 0.60 \times \text{Keyword Coverage Ratio}$$ $$\text{Final Score} = \min\left(10.0, \max\left(1.0, \text{Raw Score} \times 10 + 3.5\right)\right)$$ -
Speech Cadence & Filler Tracking: Scans for vocal hesitations (
"um","uh","like","basically","actually","so") and calculates Words Per Minute (WPM) to assess fluency and confidence.
The Live Coding Studio (backend/code_studio/) provides a full-featured online judge and real-world system architecture environment.
Deterministic, isolated execution using temporary file harnesses, standard stream isolation, and execution timeouts (timeout_seconds=5.0):
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β POLYGLOT SUBPROCESS EXECUTION PIPELINE β
βββββββββββββββ¬ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ€
β Language β Compiler / Runtime β Execution Harness Strategy β
βββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β C++ β GCC 17 (g++ -O2 -std=c++17β Dynamic test vector wrapper with β
β β β nanosecond std::chrono profiling β
βββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β Java β OpenJDK 21 (javac / java) β Solution.java wrapper with deep β
β β β array/object equality asserts β
βββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β Python β Python 3.11 β Isolated tempfile harness with β
β β β formatted traceback capture β
βββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β JavaScript β Node.js 20+ (ES6) β Sandbox context with deep object β
β TypeScript β Node.js TS Runner β serialization and assertions β
βββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β Go (Golang) β Go 1.22 β Dynamic main.go package testing β
β β β pointers, structs, and slices β
βββββββββββββββ΄ββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ
Located in backend/code_studio/catalog.py (28+ curated challenges across DSA, Backend Systems, and Bug Hunt & Refactoring):
starter_code: Populated in the candidate editor on initial problem load. Provides clean function signatures, parameter typing, and stubs (pass,return 0;,return {};,// TODO: Implement). Running code initially fails test cases, ensuring candidates write solutions.reference_solution: Preserved internal optimal implementation used by the LLM for Socratic invariant hints, AST radar comparisons, and automated benchmarking.- Bug Hunt Mode: Injects genuine buggy code (e.g. concurrency race conditions, memory leaks in cache, off-by-one binary search, SQL injections) where initial tests fail until the candidate patches the flaw.
Located in backend/code_studio/analyzer.py:
- AST Parsing: Parses code into Python/JS Abstract Syntax Trees, extracting nested loop depths, recursive call chains, branch complexity, and space allocations.
-
Big-O Classification: Delivers automated Time (
$O(1)$ ,$O(\log N)$ ,$O(N)$ ,$O(N \log N)$ ,$O(N^2)$ , $O(2^N)$) and Space complexity classifications with code quality scores ($0-100%$ ) and optimization tips.
Located in backend/code_studio/chaos.py:
Submits candidate code against automated extreme production edge cases:
-
Scale Explosions:
$N=10^5$ memory and execution time stress limits. - Monotonic Bursts: Strict ascending/descending arrays testing pivot selection and balance invariants.
-
Boundary Zeros & Overflow: Cross-zero cancellation, zero divisions, and integer maximums (
$2^{31}-1$ ). - Jagged Distributions: Non-uniform nested collections and memory exhaustion checks.
- Outputs an Adversarial Resilience Percentage (
$0-100%$ ) and failure diagnoses.
Implemented in frontend/components/coding/ProblemRenderer.jsx:
- Converts raw markdown, inline backticks (
`variable`), bold markers, constraint subheadings, and LaTeX mathematical expressions ($O(1)$ ,$N=10^5$ ) into clean, styled UI components. - Renders custom terracotta bullet constraint cards without external heavy dependencies.
The AI Voice Copilot conducts stateful, conversational mock technical interviews over WebSocket with sub-second audio latency.
stateDiagram-v2
[*] --> Idle
Idle --> Listening: User Click / Mic Start
Listening --> Thinking: Voice Inactivity / VAD Silence (>1.5s)
Thinking --> Speaking: LLM Response + TTS Stream
Speaking --> Listening: Audio Playback Complete
Speaking --> Interrupted: Candidate Speaks (VAD Threshold Hit)
Interrupted --> Thinking: Interrupt Signal Dispatched
Listening --> Evaluating: Background Worker Loop
Evaluating --> Listening: Metrics Logged
Speaking --> Completed: Interview Finished
Completed --> [*]
- Web Audio Decibel VAD: Analyzes microphone FFT frequency data in real time, detecting candidate speech starts and pauses without requiring manual click-to-talk.
- Instant Audio Interruption: If the candidate speaks while the AI interviewer is talking, a WebSocket interrupt signal instantly pauses audio playback and shifts the agent back to active listening.
- Junior Engineer: Encouraging tone; focuses on coding syntax, core algorithms, and step-by-step guidance.
- Mid-Level Engineer: Probes API contracts, database schema designs, testing strategies, and modular code patterns.
- Senior Engineer: Probes distributed system tradeoffs, caching invalidation, database indexing, and latency vs. throughput.
- Staff Engineer / Bar Raiser: High-pressure architectural screening; challenges assumptions, tests edge cases (split-brain, network partitions, consensus protocols), and evaluates cross-team leadership.
The AI Career Agent automates career tracking, job discovery, and application receipts.
Located in backend/resume_parser.py:
- Extracts text from uploaded PDF resumes using PyPDF.
- Applies multi-layer deterministic RFC-compliant regex patterns and heuristics to extract candidate Email, Phone Number, Full Name, LinkedIn URL, GitHub URL, and Portfolio Website.
Located in backend/email_service.py:
- Requisition Tracking Reference: Automatically generates verified tracking IDs (
APP-COMPANY-XXXXXX). - HTML Email Dispatch: Dispatches responsive HTML application receipts to candidate emails via SMTP.
- In-App Receipt Modal: 1-click modal with tracking ID copy on every Kanban application card.
Analyzes resume skill coverage against job requirements and constructs targeted study plans:
- 2-Day Plan (0 gaps): Syntax refreshers, system design review, final checklists.
- 5-Day Plan (1-2 gaps): Target skill deep dives, prototype builds, algorithmic drills.
- 7-Day Plan (3-4 gaps): Theoretical bridging, distributed components, mock interviews.
- 14-Day Plan (>4 gaps): End-to-end prototype development, advanced DSA, and comprehensive mock reviews.
- Uses Playwright Chromium to navigate job boards (Greenhouse, Ashby, Lever).
- Auto-fills candidate credentials and uses
qwen/qwen3.6-27bto draft context-aware answers to custom screening questions. - Allows candidate review and approval in a drawer before launching the submission action.
PrepAI is built with a responsive layout optimized for smartphones (320pxβ480px), tablets (600pxβ1024px), and desktop viewports:
-
Live Coding Studio Segmented Switcher:
On viewports
$< 1024\text{px}$ , the IDE transitions from a side-by-side split screen to a 1-tap Segmented Pane Switcher:-
π Problem / Guidance: Full problem statement, constraints, and AI Socratic interviewer. -
π» Editor: Full-screen code editor with line numbers, font sizing, and copy tools. -
β‘ Console & Tests: Full-screen test runner, execution logs, and AST complexity radar.
-
-
Intelligent Auto-Pane Switching:
- Tapping
Run Codeautomatically switches the mobile view to the Console tab with live test results. - Tapping
Submit SolutionorStress Testswitches to the Problem tab displaying the scorecard or chaos report.
- Tapping
-
Sliding Navigation Drawer:
- Desktop sidebar collapses into a sliding drawer on mobile with a blur backdrop.
- Touch target sizes meet the 44px minimum standard for mobile ergonomics.
PrepAI uses Neon Serverless PostgreSQL with an automated schema migration system (backend/database.py).
erDiagram
users ||--o{ candidate_profiles : "owns"
users ||--o{ applications : "submits"
users ||--o{ voice_sessions : "conducts"
jobs ||--o{ applications : "receives"
voice_sessions ||--o{ voice_messages : "contains"
users {
int id PK
string email
string password
string name
timestamp created_at
}
candidate_profiles {
string user_id PK "FK"
string job_type
string work_mode
string countries
string cities
string salary_expectations
string notice_period
string tech_stack_preferences
string resume_name
string resume_text
string github_url
string linkedin_url
string portfolio_url
timestamp created_at
}
jobs {
int id PK
string title
string company
string location
string work_mode
string salary
string skills_required
string description
string ats_type
string url
timestamp created_at
}
applications {
int id PK
string user_id "FK"
int job_id "FK"
string status
string submission_logs
timestamp created_at
timestamp updated_at
}
voice_sessions {
int id PK
int user_id "FK"
string role
string interview_mode
real technical_depth
real communication
real problem_solving
real system_design
real ownership
real overall_rating
int duration_seconds
timestamp created_at
}
voice_messages {
int id PK
int session_id "FK"
string role
string content
string evaluation
timestamp created_at
}
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/code/problems |
Fetch all catalog problems (DSA, Backend, Bug Hunt) with starter stubs |
POST |
/api/code/run |
Execute code against test suite in isolated subprocess sandbox |
POST |
/api/code/ast-complexity |
Run static AST parsing and Big-O Time/Space complexity classification |
POST |
/api/code/chaos-test |
Subject code to adversarial scale ( |
POST |
/api/code/copilot-guidance |
Socratic hints, algorithm invariants, and conversational code assistance |
POST |
/api/code/submit-evaluation |
Submit solution for hiring committee scorecard and evaluation |
POST |
/api/code/generate-problem |
Dynamically generate new interview challenges tailored to candidate stack |
| Method | Endpoint | Description |
|---|---|---|
WS |
/api/voice-copilot/ws |
Bi-directional streaming WebSocket for speech audio, VAD, and interrupts |
POST |
/api/voice-copilot/session/start |
Initialize stateful mock interview session with candidate profile |
POST |
/api/voice-copilot/transcribe |
Transcribe audio stream (Sarvam STT saaras:v3 / Groq Whisper) |
POST |
/api/voice-copilot/synthesize |
Synthesize interviewer speech audio (Sarvam TTS bulbul:v3) |
POST |
/api/voice-copilot/session/end |
Finalize session and generate multi-dimensional score rating |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/career/profile |
Retrieve candidate intelligence profile and preferences |
POST |
/api/career/onboard |
Upload resume PDF, parse entities, and save career preferences |
GET |
/api/career/jobs |
Retrieve matched job postings ranked by TF-IDF cosine similarity |
POST |
/api/career/apply/prepare |
Extract form fields and draft custom AI screening answers |
POST |
/api/career/apply/submit |
Launch auto-apply browser agent and dispatch email confirmation receipt |
GET |
/api/career/receipt/{job_id} |
Retrieve verified ATS confirmation receipt and tracking reference |
GET |
/api/career/applications |
Retrieve candidate application pipeline and metrics |
PATCH |
/api/career/applications/{id} |
Update Kanban status (Applied, OA Received, Interview, Offer) |
POST |
/api/career/roadmap |
Generate adaptive 2-day to 14-day gap-bridging preparation calendar |
- Node.js: v18.0 or higher
- Python: v3.11 or higher
- Compilers (for native polyglot sandbox):
- C++:
g++(GCC 17+ or MinGW) - Java: OpenJDK 21
- Go: Go 1.22+
- C++:
- Database: Neon Serverless PostgreSQL (or local PostgreSQL instance)
git clone https://github.com/ApurveKaranwal/PrepAI.git
cd PrepAIcd backend
python -m venv venv
# Windows (PowerShell):
.\venv\Scripts\activate
# macOS / Linux:
source venv/bin/activate
pip install -r requirements.txtCreate backend/.env:
DATABASE_URL=postgresql://<user>:<password>@<host>/<database>?sslmode=require
GROQ_API_KEY=your_groq_api_key
SARVAM_API_KEY=your_sarvam_api_key
# Optional: Outbound SMTP Receipts
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASSWORD=your_app_passwordInitialize database & seed catalog:
python -c "import database; database.init_db()"Start the FastAPI backend server:
uvicorn main:app --reload --port 8001cd ../frontend
npm installCreate frontend/.env.local:
NEXT_PUBLIC_BACKEND_URL=http://localhost:8001Start the Next.js development server:
npm run devOpen http://localhost:3000 in your browser.
- Import repository on Vercel.
- Set Root Directory to
frontend. - Set Framework Preset to
Next.js. - Configure Environment Variables:
NEXT_PUBLIC_BACKEND_URL:https://<your-render-service>.onrender.com(no trailing slash)
- Deploy!
- Create a new Web Service on Render from the repository.
- Set Root Directory to
backend. - Set Environment to
Python 3. - Set Build Command to:
pip install -r requirements.txt
- Set Start Command to:
uvicorn main:app --host 0.0.0.0 --port $PORT - Add Environment Variables:
DATABASE_URL: Your PostgreSQL connection string.GROQ_API_KEY: Your Groq API key.SARVAM_API_KEY: Your Sarvam API key.
- Deploy!
PrepAI was designed and developed by:
- Apurve Karanwal (GitHub)
- Akshita Tomar
- Akash Tiwari
This project is licensed under the MIT License.


