Resume Check Karo uses Google Gemini as its sole AI engine, accessed through the officialDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nayalsaurav/resume-analyzer/llms.txt
Use this file to discover all available pages before exploring further.
@google/genai SDK. Every resume analysis is a single multimodal generateContent call: the PDF is uploaded inline as base64-encoded binary data alongside a structured text prompt, and the model is constrained to return a fully typed JSON response matching a predefined schema. No fine-tuning or embeddings are involved — the entire intelligence lives in the prompt and schema.
Client Initialisation
The Gemini client is a module-level singleton created once inlib/google.ts. The API key is read from the server environment so it is never bundled into client-side JavaScript.
Sending PDFs to the Model
Gemini’s multimodal API accepts file data as base64-encoded strings using theinlineData part type. getAiResponse() reads the uploaded File object into an ArrayBuffer, converts it to a Node.js Buffer, then base64-encodes it before attaching it to the contents array alongside the text prompt.
The
inlineData approach is suitable for PDFs up to ~20 MB. For larger files the Gemini Files API (ai.files.upload()) is the recommended alternative — it uploads the file to Google’s servers first and passes a file URI instead of base64 data.Structured JSON Output
SettingresponseMimeType: "application/json" and providing a responseSchema puts the model into constrained decoding mode. Rather than generating free-form text that happens to include JSON, the model’s token sampling is restricted to sequences that conform to the schema at every step. This means:
- The response is always valid JSON — no markdown fences, no preamble text, no apologies.
- Every required field in the schema (
overallScore,ATS,toneAndStyle,content,structure,skills) is guaranteed to be present. - Enum constraints on
FeedbackTip.type("good"|"improve") are enforced by the model itself.
Feedback TypeScript interface with no additional validation layer needed.
The resumeAnalysisSchema
The schema is expressed using the SDK’s Type enum constants, which map to the underlying JSON Schema types accepted by the Gemini API.
ATS tips do not include an explanation field — they are intentionally short, scannable bullet points. The toneAndStyle, content, structure, and skills sections require "type", "tip", and "explanation" as part of their schema definition.Prompt Construction
The text instruction passed togetAiResponse() is assembled by prepareInstructions() in lib/constants.ts. The function injects the user-provided context and evaluation criteria into a structured prompt template.
The prompt instructs the model to:
- Evaluate against the specific role — Company name, job title, and the full job description are injected so the analysis is tailored to the position, not generic.
- Score each category 0–100, and be critical — The prompt explicitly instructs the model to avoid inflated scores. A resume that merely has the correct sections should score in the 50–65 range; only exceptional resumes should approach 90+.
- Return at least one tip per category — Every
tipsarray must contain at least one actionable item, even if the section is strong. - Distinguish “good” from “improve” tips — Tips labelled
"good"acknowledge strengths; tips labelled"improve"call out specific, fixable issues.
Feedback Types
The TypeScript interfaces inlib/google.ts are the single source of truth for the AI response shape. The same types are used in the resumeAnalysisSchema, the server action return value, the Prisma JSON column, and the React components that render feedback.
Error Handling
If the Gemini API call fails for any reason — network error, rate limit, or empty response —getAiResponse() catches the error and calls createErrorFeedback(). This returns a Feedback object with all scores set to 0 and an "improve" tip in each section indicating that analysis could not be completed.
Resume record is still created in the database (with analysis set to the error feedback object) and the user sees a meaningful message rather than an unhandled exception page.
Environment Variables
The AI integration requires two environment variables. Neither is ever exposed to the browser.| Variable | Description |
|---|---|
GOOGLE_API_KEY | Your Google AI Studio API key. Found at aistudio.google.com. |
GOOGLE_AI_MODEL | The Gemini model identifier, e.g. gemini-1.5-flash or gemini-1.5-pro. |