App Live : https://ai-coverletter.netlify.app/
GitHub: https://github.com/kwagle7/AI-Personalized-Cover-Letter


Author: Kshitij Wagle (@kwagle)
๐ Introduction
This project is a complete AI-powered cover letter generator built with real-time personalization, PDF export, and secure API integrationโall deployable in minutes. But it didnโt start that way.
๐ Project Origin: From Gemini App to Production
The idea began as a prototype using Gemini App, where I experimented with generative AI prompts to write cover letters based on a resume and job description.
What I did was: after building the initial app inside Gemini, I exported the app and completely revamped it using Windsurf and version control. This gave me flexibility to:
- โ Rebuild the UI using Next.js and Tailwind CSS
- ๐ Move Gemini logic to a secure Netlify Function
- ๐ Add PDF downloads with jsPDF
- ๐ Deploy the final version on Netlify
SWE-1-lite and O3, and tracking logs. It made versioned deployment and prompt refinement much easier.
This guide will walk you through exactly how I went from a Gemini prototype to a secure, production-ready web app with built-in AI and PDF export.
๐ฏ Key Features
- ๐ฎ Personalized cover letter via Google Gemini API
- ๐งพ Downloadable PDF output using jsPDF
- ๐ API key hidden via Netlify Functions
- ๐จ Deployed using Netlify (with optional Vercel)
- ๐ Debugging and testing with Windsurf
๐งฐ Tech Stack
- Frontend: Next.js, Tailwind CSS
- Backend: Netlify Functions (Node.js)
- AI: Google Gemini API
- PDF: jsPDF
- Automation & Debug: Windsurf
- Deployment: Netlify (primary), Vercel (optional)
โ๏ธ Step 1: Setup Project
# Create a Next.js project
npx create-next-app AI-Personalized-Cover-Letter
cd AI-Personalized-Cover-Letter
# Install packages
npm install tailwindcss @google/generative-ai jsPDF
npx tailwindcss init -p
globals.css and configure it in tailwind.config.js
๐ผ Step 2: Design the UI
- ๐จ Clean card layout for input + preview
- โ Real-time form validation
- ๐ฑ Mobile responsive using Tailwind
- ๐ Tab navigation for switching views
Solution: Reusable components and Tailwind iterations
๐ Step 3: Secure Gemini API
Created a serverless function /netlify/functions/generate-cover-letter.js that:
- Receives prompt from frontend
- Calls Google Gemini API
- Returns generated cover letter
๐ Step 4: Generate PDF with jsPDF
- Formatted AI response into styled single-page PDF
- Parsed basic markdown (headings, bold, bullets)
- Ensured fit on standard A4
Solution: Wrote custom markdown-to-PDF parser
๐งช Step 5: Local Testing
# Install all dependencies
npm install
# Create .env.local
echo "GEMINI_API_KEY=your-google-gemini-key" > .env.local
# Run local server
npm run dev
Visit: http://localhost:3000
โ๏ธ Step 6: Deploy to Netlify
# One-time CLI setup
npm install -g netlify-cli
netlify login
# Init new project
netlify init
# Set environment variable
netlify env:set GEMINI_API_KEY your-google-gemini-key
# Build and deploy
npm run build
netlify deploy --build
# Deploy to production
netlify deploy --prod
๐ Step 7: Optional Vercel Deployment
- Push your repo to GitHub
- Go to vercel.com and import
- Set
GEMINI_API_KEYin environment settings - Vercel auto-detects and deploys
๐งญ Windsurf Integration
Used Windsurf for:
- ๐ Real-time Gemini prompt debugging
- ๐ Viewing logs in
/logs/YYYYMMDD* - โ๏ธ Enhancing prompts with models like
SWE-1-liteandO3
๐ง Common Challenges & Fixes
| Challenge | Solution |
|---|---|
| API key exposure | Used serverless Netlify function |
| CORS errors | Moved Gemini API logic to backend |
| Markdown โ PDF | Custom parser & layout manager |
| Deployment fail | Used Netlify CLI logs & env setup |
| Prompt debugging | Used Windsurf models & logs |
โ Terminal Command Summary
# Local dev
npm install
npm run dev
# Netlify CLI setup
npm install -g netlify-cli
netlify login
# Project init
netlify init
netlify env:set GEMINI_API_KEY your-google-gemini-key
# Deploy
npm run build
netlify deploy --build
netlify deploy --prod
๐ Conclusion
This project combined AI, automation, and full-stack skills to create a smart, deployable cover letter tool. Starting from Gemini, then revamped with Windsurf and deployed on Netlifyโitโs fast, scalable, and ready for real-world use.

โจ Quick Note: What This App Delivers
This AI-powered app generates professionally structured, visually appealing, and job-tailored cover lettersโinstantly.
- โ Starts directly with a subject line or greeting
- โ Clearly states the position being applied for
- โ Highlights the applicantโs strengths in a dynamic, non-generic tone
- โ Uses markdown structure (headers, bullets, bold) for readability
- โ
Includes sections like
## Key Strengthsand optional breaks like---***--- - โ Ends with a clean, professional closing
- โ Exports as a styled one-page PDFโno extra text, no fluff
The result? A concise, impactful cover letter tailored for every job, every time.

Discover more from Data Engineer Journey
Subscribe to get the latest posts sent to your email.
