Overview
The Resume Generation feature creates ATS-friendly, job-tailored resume PDFs using AI. The system analyzes the user’s original resume/profile and the target job description, then generates an HTML resume optimized for the specific role and converts it to PDF using Puppeteer.User Workflow
Users can generate a tailored resume directly from their interview report:- Navigate to an interview report page (
/interview/:id) - Click “Download Resume” button in the left sidebar
- AI generates job-specific resume in ~10-15 seconds
- PDF automatically downloads to browser
Interview.jsx:105-110
The resume is dynamically generated each time - it’s not cached. This ensures the latest AI model improvements are always used.
API Endpoint
Generate Resume PDF:POST /api/interview/resume/pdf/:interviewReportId
Authentication: Required (JWT token)
Parameters:
interviewReportId(path parameter) - The ID of the interview report
- Content-Type:
application/pdf - Content-Disposition:
attachment; filename=resume_{interviewReportId}.pdf - Body: PDF file buffer
Backend Processing Flow
1. Retrieve Interview Report Data
The controller fetches the associated interview report:interview.controller.js:172-193
2. AI HTML Generation
The AI service generates structured HTML content using a Zod schema:ai.service.js:100-102
ai.service.js:104-115
ai.service.js:117-124
The AI is specifically instructed to create ATS-friendly content that doesn’t sound AI-generated. It tailors the resume to highlight relevant experience for the target job description.
3. HTML to PDF Conversion
Puppeteer converts the AI-generated HTML to a professionally formatted PDF:ai.service.js:79-96
- Format: A4 (standard resume size)
- Margins: 20mm top/bottom, 15mm left/right
- Wait Strategy:
networkidle0ensures all resources are loaded
4. Complete Generation Flow
The full service combines AI generation and PDF conversion:ai.service.js:98-133
Resume Tailoring Strategy
The AI optimizes resumes using several strategies:Keyword Optimization
Incorporates relevant keywords from the job description for ATS compatibility
Experience Highlighting
Emphasizes relevant experience and de-emphasizes unrelated roles
Skill Matching
Prominently displays skills that match job requirements
Format Optimization
Creates clean, professional formatting that renders well in PDF
Design Guidelines
The AI follows specific design principles:Professional Appearance
- Simple, clean layouts
- Appropriate use of color for highlights
- Consistent font styles and sizes
- Proper spacing and hierarchy
ATS Compatibility
- Text-based content (no images or graphics that can’t be parsed)
- Standard section headings
- Simple table structures if used
- No complex formatting that breaks parsing
Length Optimization
- Target: 1-2 pages when converted to PDF
- Concise bullet points
- Focus on quality over quantity
- Relevant information prioritized
- Content Strategy
- Technical Implementation
The AI analyzes:
- User’s original resume content
- Self-description if provided
- Target job description requirements
- Skills and experience alignment
- Summary/objective statement
- Work experience descriptions
- Skills section order and content
- Education and certifications relevance
File Download Flow
The frontend handles the PDF download:interview.api.js (typical pattern)
- POST request to PDF generation endpoint
- Server generates PDF and returns binary data
- Frontend creates blob URL from response
- Programmatic anchor click triggers download
- Cleanup blob URL after download
Performance Considerations
Generation Time
~10-15 seconds average (AI generation + PDF conversion)
File Size
Typically 50-200 KB depending on content length
Browser Compatibility
Works in all modern browsers with blob download support
Concurrent Requests
Puppeteer handles concurrent generations with separate browser instances
Error Handling
The system handles various error scenarios: Interview Report Not Found:404
AI Generation Failure:
If Gemini AI fails, the error is caught and a 502 is returned (similar to interview report generation).
PDF Conversion Failure:
If Puppeteer fails to launch or convert, the server will throw an error. Production systems should catch this and return appropriate error responses.
Best Practices
For Users:
- Upload detailed resumes for best tailoring results
- Include self-description to provide additional context
- Review and customize the generated PDF before submitting to employers
- Generate fresh PDFs for each unique job application
Technical Notes:
- PDFs are generated on-demand (not pre-generated/cached)
- Each generation gets the latest AI model improvements
- Puppeteer runs in headless mode for server efficiency
- Browser instances are properly closed after each generation
Security Considerations
User Isolation:- Resumes are only generated for interview reports owned by the authenticated user
- No access to other users’ data
- Puppeteer browser instances are properly closed
- Prevents memory leaks from abandoned browser processes
- AI-generated HTML is from trusted source (Gemini API)
- No user-provided HTML is rendered (prevents XSS)
Future Enhancements
Potential improvements to the resume generation system:- Multiple resume template styles
- Custom branding/color schemes
- Resume editing before PDF generation
- Version history and comparison
- A/B testing different resume variations
- Integration with LinkedIn profile data
- Export to DOCX format option