A full-stack web application that simulates real job interviews using AI. Candidates answer voice questions from an animated AI interviewer, receive instant scoring, and get detailed feedback reports.
- 🎙️ Live Voice Interview — Split-screen video call UI with webcam + AI robot avatar
- 🧠 AI-Generated Questions — Tailored to your resume, role, and experience level
- 📄 Resume Analysis — Upload PDF, AI extracts skills and projects automatically
- 📊 Real-Time Scoring — Technical knowledge, communication, and relevance scored per answer
- 📋 Detailed Reports — Strengths, improvements, skill suggestions, study topics
- 📈 Progress Tracking — Full history of all sessions and scores
- 🔍 ATS Resume Analyzer — Role-specific ATS score with formatting, grammar, and keyword checks
- 📝 Resume Generator — Build and download a professional ATS-friendly resume
- 🔐 JWT Authentication — Secure signup/login system
- 📱 Fully Responsive — Mobile, tablet, and desktop
| Layer | Technology |
|---|---|
| Frontend | React 18 + Vite + Tailwind CSS |
| Backend | Node.js + NestJS + TypeScript |
| Database | MongoDB Atlas (Mongoose) |
| AI | Google Gemini API |
| Speech | Web Speech API (browser-native) |
| Auth | JWT + Passport |
| PDF Parsing | pdf-parse |
| Password Hashing | bcryptjs |
⚡ Backend migrated from Python FastAPI to NestJS — all API endpoints, business logic, and Gemini prompts are 100% preserved.
ai-mock-interview/
├── README.md
│
├── backend/ # NestJS Backend
│ ├── nest-cli.json
│ ├── package.json
│ ├── tsconfig.json
│ ├── .env # ⚠️ Never commit this
│ ├── .env.example
│ ├── .gitignore
│ └── src/
│ ├── main.ts # App entry point, CORS config
│ ├── app.module.ts # Root module
│ ├── app.controller.ts # Health + root endpoints
│ ├── config/
│ │ ├── configuration.ts # Env variable loader
│ │ └── database.config.ts # MongoDB connection factory
│ ├── auth/ # JWT auth module
│ │ ├── auth.controller.ts
│ │ ├── auth.service.ts
│ │ ├── auth.module.ts
│ │ ├── jwt.strategy.ts
│ │ ├── dto/auth.dto.ts
│ │ ├── guards/jwt-auth.guard.ts
│ │ └── schemas/user.schema.ts
│ ├── resume/ # Resume upload + parsing
│ │ ├── resume.controller.ts
│ │ ├── resume.service.ts
│ │ ├── resume.module.ts
│ │ ├── resume-parser.service.ts
│ │ └── schemas/resume.schema.ts
│ ├── interview/ # Interview session management
│ │ ├── interview.controller.ts
│ │ ├── interview.service.ts
│ │ ├── interview.module.ts
│ │ ├── dto/interview.dto.ts
│ │ └── schemas/interview.schema.ts
│ ├── ats/ # ATS resume analyzer
│ │ ├── ats.controller.ts
│ │ ├── ats.service.ts
│ │ └── ats.module.ts
│ ├── resume-generator/ # HTML resume builder
│ │ ├── resume-generator.controller.ts
│ │ ├── resume-generator.service.ts
│ │ ├── resume-generator.module.ts
│ │ └── dto/resume-generator.dto.ts
│ └── ai/ # Gemini AI service
│ ├── gemini.service.ts
│ └── ai.module.ts
│
└── frontend/
├── index.html
├── vite.config.js
├── tailwind.config.js
├── package.json
├── .env # ⚠️ Never commit this
├── .gitignore
└── src/
├── App.jsx
├── main.jsx
├── index.css
├── context/
│ └── AuthContext.jsx
├── services/
│ └── api.js
├── hooks/
│ ├── useSpeechSynthesis.js
│ └── useSpeechRecognition.js
├── components/
│ └── AppLayout.jsx
└── pages/
├── Landing.jsx
├── Login.jsx
├── Signup.jsx
├── Explore.jsx
├── InterviewHub.jsx
├── Scores.jsx
├── ResumeUpload.jsx
├── LiveInterview.jsx
└── InterviewReport.jsx
- Node.js 18+
- MongoDB Atlas account (free tier)
- Google AI Studio account (free Gemini API key)
git clone https://github.com/Pranav18M/Ai-mock-interview-.git
cd Ai-mock-interview-cd backend
npm installCreate backend/.env:
MONGODB_URL=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/ai_mock_interview?retryWrites=true&w=majority
DATABASE_NAME=ai_mock_interview
JWT_SECRET=your_super_secret_key_change_this
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440
GEMINI_API_KEY=your_gemini_api_key_here
OPENAI_API_KEY=
PORT=8000Start the backend:
npm run start:devAPI running at: http://localhost:8000
cd frontend
npm installCreate frontend/.env:
VITE_API_URL=http://localhost:8000Start the frontend:
npm run devApp running at: http://localhost:5173
- Visit mongodb.com/atlas → create free cluster
- Database Access → add a user with password
- Network Access → add IP
0.0.0.0/0for development - Connect → Drivers → copy connection string into
.env
- Visit aistudio.google.com/app/apikey
- Click Create API Key → copy into
.env
⚠️ Warning: If your Gemini key is pushed to a public GitHub repo, Google auto-revokes it. Always use.envand keep it in.gitignore.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /auth/signup |
Register new user | ❌ |
| POST | /auth/login |
Login, receive JWT | ❌ |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /resume/upload |
Upload + parse PDF resume | ✅ |
| GET | /resume |
Get current resume data | ✅ |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /interview/generate-questions |
AI generates 5 questions | ✅ |
| POST | /interview/submit-answer |
Submit + score one answer | ✅ |
| POST | /interview/complete/:id |
Finalize + generate report | ✅ |
| GET | /interview/history |
All past sessions | ✅ |
| GET | /interview/report/:id |
Full report for session | ✅ |
| POST | /interview/greeting |
AI interviewer greeting | ✅ |
| POST | /interview/intro-response |
AI response to user intro | ✅ |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /ats/analyze |
Analyze resume ATS score | ✅ |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /resume-gen/preview |
Generate resume HTML preview | ✅ |
| POST | /resume-gen/download |
Download resume as PDF | ✅ |
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
API info |
| GET | /health |
Health check |
User signs up / logs in
↓
Uploads PDF resume → AI extracts skills, projects, experience
↓
Selects job role + difficulty (beginner / intermediate / advanced)
↓
Backend calls Gemini API → generates 5 tailored interview questions
↓
Live interview screen:
┌──────────────────┬──────────────────┐
│ AI Robot Image │ User Webcam │
│ (video call) │ (live feed) │
└──────────────────┴──────────────────┘
AI reads question aloud → User speaks answer → Transcript captured
↓
Each answer scored by Gemini (1–10):
• Technical knowledge
• Communication clarity
• Relevance to question
↓
After 5 questions → Full report generated:
• Overall score ring
• Per-question breakdown
• Strengths / Areas to improve
• Skill suggestions + study topics
Powered by Google Gemini API with automatic model fallback:
| Priority | Model | Free Limit |
|---|---|---|
| 1st | gemini-1.5-flash |
1500 req/day |
| 2nd | gemini-1.5-flash-8b |
1500 req/day |
| 3rd | gemini-1.0-pro |
60 req/min |
| Collection | Description |
|---|---|
users |
User accounts |
resumes |
Parsed resume data per user |
interviews |
Sessions, answers, scores, feedback |
| Breakpoint | Layout |
|---|---|
Mobile < 768px |
Hamburger nav, stacked video panels, single column |
Tablet 768–900px |
Horizontal nav, 2-col grids |
Desktop > 900px |
Full split layout, sticky image panel, 4-col grids |
# Start command
npm run start:prod
# Set all .env variables in your platform dashboard
# Update CORS origins in main.ts to allow only your frontend domainnpm run build
# Deploy the dist/ folder
# Set environment variable: VITE_API_URL=https://your-backend-url.com| Note | Detail |
|---|---|
| Speech Recognition | Requires Chrome or Edge — Firefox not supported |
| Webcam | Browser permission prompt on first interview load |
| CORS | Configured for localhost + Vercel — restrict for production |
| LiveInterview routing | Requires location.state from setup page |
| PDF Upload | Max 5MB, PDF only |
@nestjs/common, @nestjs/core, @nestjs/config
@nestjs/mongoose, mongoose
@nestjs/passport, @nestjs/jwt, passport-jwt
bcryptjs
pdf-parse
class-validator, class-transformer
axios
multer
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
MIT License — see LICENSE for details.
Pranav — Full Stack Developer
Built with React, NestJS, MongoDB Atlas, and Google Gemini AI