How jeswanthjohn/resume-analyzer-ai works
Project type and purpose
• This is a minimal full-stack web application showcasing a “serverless resume analysis” service.
• Frontend: static HTML/CSS/JS in /public.
• Backend: a single Vercel serverless function at /api/analyze that invokes OpenAI or a deterministic mock fallback.
• Goal: demonstrate defensive API design, reliability under failure, and production-grade engineering.
File structure
Top-level
• .env.example, .gitignore, package.json → environment & build config
• README.md → architecture overview & request lifecycle
Directories
• public/
– app.js, index.html, styles.css → static UI, PDF upload, result rendering
• api/
– analyze.js → single serverless endpoint implementing request handling
• lib/
– constants.js → static config (e.g. rate limits)
– validateInput.js → request validation logic
– rateLimiter.js → abuse protection
– errors.js → error definitions
README for additional insights
• Describes a linear “Request Lifecycle” from frontend submission → /api/analyze → validation → rate limit → AI call → fallback decision → unified response → frontend rendering.
• Emphasizes serverless architecture, horizontal scalability, cost-safe design, graceful degradation.
a. Main components
– User’s Browser & Static UI (public/)
– CDN or Static Hosting (Vercel)
– API Gateway / Serverless Invocation (/api/analyze)
– Input Validation module
– Rate Limiter module
– AI Service (OpenAI API)
– Fallback Mock Analysis
– Response Formatter
– Environment & Secrets Store (OPENAI_API_KEY, MOCK_MODE)
b. Relationships & interactions
1. Browser → GET static files from CDN
2. Browser → POST resume text to /api/analyze
3. Serverless function inbound → validateInput → rateLimiter
4. If rate-limited or invalid → error response
5. Else → invoke OpenAI API
6a. On success → normalize AI response
6b. On failure (quota, network, invalid) → invoke mockAnalysis
7. Return unified JSON → Browser → render results
c. Architectural patterns & principles
• Serverless functions for horizontal scalability & cost predictability
• Defensive programming: input validation + rate limiting + try/catch
• Graceful degradation via fallback mock path
• Single-purpose function reduces blast radius
d. Key technologies & frameworks
• Frontend: Vanilla JS, HTML5, CSS3
• Backend: Node.js, Vercel Serverless Functions
• AI: OpenAI Responses API + deterministic mock logic