Skip to content

amnkarn/GenAi-PrepAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– PrepAI β€” AI-Powered Interview Preparation Platform

PrepAI is a full-stack web application that analyzes your resume against a job description using Google Gemini AI, generates a detailed interview report, and produces a tailored, ATS-friendly resume PDF β€” all in one place.


✨ Features

🧠 AI Interview Report Generation

  • Upload your resume (PDF) or write a self-description
  • Paste any job description
  • Gemini AI analyzes the match and generates:
    • Match Score (0–100) β€” how well your profile fits the role
    • Technical Questions β€” with interviewer intention + how to answer
    • Behavioral Questions β€” with context and suggested answers
    • Skill Gaps β€” missing skills with severity (low / medium / high)
    • Day-wise Preparation Roadmap β€” structured plan to prepare

πŸ“„ AI Resume PDF Generator

  • Generates a tailored, ATS-friendly resume based on your profile and the target job description
  • Resume is formatted in clean HTML by Gemini AI
  • Converted to a downloadable A4 PDF using Puppeteer
  • One-click download from the interview report page

πŸ” Authentication System

  • JWT-based authentication using access + refresh tokens
  • Tokens stored in HTTP-only cookies (XSS safe)
  • OTP email verification on signup
  • Token blacklisting on logout (stored in DB)
  • Protected routes on both frontend and backend

πŸ“Š Dashboard

  • View all previously generated interview reports
  • Each report stores: match score, job title, resume, self-description
  • Click any report to revisit the full interview analysis

πŸ›  Tech Stack

Backend

Technology Usage
Node.js + Express.js REST API server
TypeScript Type safety
Prisma ORM Database queries
PostgreSQL Relational database
Google Gemini AI (gemini-2.5-flash) AI report + resume generation
Puppeteer HTML to PDF conversion
Zod Input validation + AI schema enforcement
zod-to-json-schema Convert Zod schema to JSON Schema for Gemini
pdf-parse Extract text from uploaded resume PDF
Multer File upload handling
JWT Authentication tokens
Nodemailer OTP email sending
bcrypt Password hashing

Frontend

Technology Usage
React + TypeScript UI framework
Vite Build tool
React Router v6 Client-side routing
Axios HTTP requests
Tailwind CSS Styling
Lucide React Icons
Context API Global state management

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Frontend                         β”‚
β”‚  React + TypeScript + Context API + Axios            β”‚
β”‚                                                      β”‚
β”‚  Pages: Home β†’ InterviewPage β†’ Dashboard             β”‚
β”‚  Hooks: useInterview, useAuth                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ HTTP (withCredentials: true)
                     β”‚ Cookies (JWT tokens)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Backend                          β”‚
β”‚  Express.js + TypeScript                             β”‚
β”‚                                                      β”‚
β”‚  Routes:                                             β”‚
β”‚    POST /api/auth/signup                             β”‚
β”‚    POST /api/auth/login                              β”‚
β”‚    GET  /api/auth/logout                             β”‚
β”‚    GET  /api/auth/get-me                             β”‚
β”‚    POST /api/interview          (generate report)    β”‚
β”‚    GET  /api/interview          (all reports)        β”‚
β”‚    GET  /api/interview/report/:id                    β”‚
β”‚    POST /api/interview/resume/pdf/:id                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   PostgreSQL    β”‚   β”‚   Google Gemini   β”‚
β”‚   via Prisma    β”‚   β”‚   AI API          β”‚
β”‚                 β”‚   β”‚                  β”‚
β”‚  Users          β”‚   β”‚  generateContent β”‚
β”‚  InterviewReportβ”‚   β”‚  JSON Schema     β”‚
β”‚  TechnicalQ     β”‚   β”‚  enforced via    β”‚
β”‚  BehavioralQ    β”‚   β”‚  Zod             β”‚
β”‚  SkillGap       β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚  PreparationPlanβ”‚
β”‚  Otp            β”‚
β”‚  Blacklist      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—„ Database Schema

User
 β”œβ”€β”€ id, username, email, password, verified
 └── reports[]  ──→  InterviewReport
                          β”œβ”€β”€ matchScore, title, jobDescription
                          β”œβ”€β”€ technicalQuestion[]
                          β”œβ”€β”€ behavioralQuestions[]
                          β”œβ”€β”€ skillGaps[]
                          └── preparationPlan[]

Relations are one-to-many β€” one user has many reports, one report has many questions.


πŸ€– How AI Works

Interview Report Generation

1. Resume PDF uploaded β†’ text extracted via pdf-parse
2. Text + selfDescription + jobDescription sent to Gemini
3. Zod schema defines exact output structure
4. zod-to-json-schema converts it to JSON Schema
5. Gemini returns structured JSON (enforced by schema)
6. Data saved to PostgreSQL via Prisma nested writes

Resume PDF Generation

1. Resume text + job description sent to Gemini
2. Gemini generates tailored HTML resume (inline CSS, A4 size)
3. Puppeteer opens HTML in headless Chrome
4. page.pdf() converts it to PDF buffer
5. Buffer sent to frontend as application/pdf blob
6. Frontend creates download link and triggers download

Why zod-to-json-schema?

Gemini supports structured output via JSON Schema. Instead of writing raw JSON Schema manually, Zod schemas are written in TypeScript and converted automatically β€” giving both type safety and AI output enforcement.

⚠️ Note: zod-to-json-schema converts camelCase keys to snake_case. So matchScore in Zod becomes match_score in Gemini's response. Handle this in your backend mapping.


πŸ“ Project Structure

GenAi-PrepAI/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/          # DB connection (Prisma)
β”‚   β”‚   β”œβ”€β”€ controller/      # Route handlers
β”‚   β”‚   β”œβ”€β”€ middleware/       # Auth middleware
β”‚   β”‚   β”œβ”€β”€ routes/          # Express routers
β”‚   β”‚   β”œβ”€β”€ services/        # AI logic (Gemini + Puppeteer)
β”‚   β”‚   β”œβ”€β”€ utils/           # Zod schemas, helpers
β”‚   β”‚   └── generated/       # Prisma generated client
β”‚   β”œβ”€β”€ prisma/
β”‚   β”‚   └── schema.prisma
β”‚   └── package.json
β”‚
└── frontend/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ features/
    β”‚   β”‚   └── interview/
    β”‚   β”‚       β”œβ”€β”€ components/   # Interview UI components
    β”‚   β”‚       β”œβ”€β”€ hooks/        # useInterview
    β”‚   β”‚       β”œβ”€β”€ services/     # API calls
    β”‚   β”‚       └── types/        # TypeScript types
    β”‚   β”œβ”€β”€ pages/               # Home, Dashboard, InterviewPage
    β”‚   └── App.tsx
    └── package.json

πŸš€ Local Setup

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • Google Gemini API key
  • pnpm (or npm)

1. Clone the repo

git clone https://github.com/amankarn2007/GenAi-PrepAI.git
cd GenAi-PrepAI

2. Backend setup

cd backend
pnpm install

Create .env:

DATABASE_URL=postgresql://user:password@localhost:5432/prepai
GEMINI_API_KEY=your_gemini_api_key
JWT_ACCESS_SECRET=your_access_secret
JWT_REFRESH_SECRET=your_refresh_secret
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
NODE_ENV=development
npx prisma migrate dev
npx prisma generate
npx puppeteer browsers install chrome
pnpm dev

3. Frontend setup

cd frontend
pnpm install

Create .env:

VITE_API_URL=http://localhost:3000
pnpm dev

☁️ Deployment (Render)

Backend β€” Web Service

Root Directory:  backend
Build Command:   pnpm install && npx prisma generate && npx prisma migrate deploy && npx puppeteer browsers install chrome && pnpm build
Start Command:   pnpm start

Environment variables: same as .env above (add production values)

Frontend β€” Static Site

Root Directory:    frontend
Build Command:     pnpm install && pnpm build
Publish Directory: dist

Environment variables:

VITE_API_URL = https://your-backend.onrender.com

πŸ“Έ Screenshots

Home Page β†’ Interview Report β†’ Dashboard β†’ PDF Download


πŸ“ License

MIT License β€” feel free to use and modify.


πŸ‘¨β€πŸ’» Author

Aman Kumar Karn

About

πŸ€– AI-powered interview prep β€” upload resume + job description and prepare with AI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages