Skip to content

KrishnaThakur10/Cover_Letter_Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ AI Cover Letter Generator

An intelligent web application that transforms your resume into tailored cover letters using AI, with seamless Google Docs and Drive integration for document management.

✨ Features

🎯 Core Functionality

  • πŸ“Έ OCR Resume Scanning - Upload resume as image or PDF and extract text automatically using Tesseract.js
  • πŸ€– AI-Powered Generation - Generate personalized cover letters using Google's Gemini AI
  • πŸ“„ Google Docs Integration - Create and edit cover letters directly in Google Docs
  • πŸ“ Google Drive Organization - Automatic folder organization by company name
  • πŸ” Search & Management - Search, list, and manage all your cover letters
  • πŸ‘₯ Easy Sharing - Share documents with recruiters directly from the app

πŸ–ΌοΈ Demo

Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Resume to Cover Letter          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  1. Upload Resume (Image/PDF)       β”‚
β”‚           ↓                         β”‚
β”‚  2. OCR Extracts Text               β”‚
β”‚           ↓                         β”‚
β”‚  3. Enter Job Details               β”‚
β”‚           ↓                         β”‚
β”‚  4. AI Generates Cover Letter       β”‚
β”‚           ↓                         β”‚
β”‚  5. Save to Google Docs/Drive       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Backend

  • Node.js - Server runtime
  • Express.js - Web framework
  • Google APIs - Docs & Drive integration
  • Google Gemini AI - Cover letter generation
  • JSON Web Token - Ready for authentication (future implementation)

Frontend

  • React.js - UI framework
  • Tesseract.js - OCR functionality
  • Axios - API communication
  • Tailwind CSS - Styling

πŸ“‹ Prerequisites

Before you begin, ensure you have:

  • Node.js (v16 or higher)
  • npm or yarn package manager
  • Google Cloud Console account (You can request to add you a test user)
  • Google Gemini API key

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/cover-letter-generator.git
cd cover-letter-generator

2. Install Dependencies

Backend Setup

cd backend
npm install

Frontend Setup

cd ../frontend
npm install

3. Google Cloud Console Setup

Enable Required APIs

  1. Go to Google Cloud Console
  2. Create a new project or select existing one
  3. Navigate to APIs & Services β†’ Library
  4. Search and enable:
    • Google Docs API
    • Google Drive API

Create OAuth 2.0 Credentials

  1. Go to APIs & Services β†’ Credentials
  2. Click Create Credentials β†’ OAuth client ID
  3. Application type: Web application
  4. Add authorized redirect URIs:
    http://localhost:5000/api/resume/auth/callback
    
  5. Download and save the Client ID and Client Secret

4. Get Gemini API Key

  1. Visit Google AI Studio
  2. Click Get API Key
  3. Create new API key or use existing one
  4. Copy the API key

5. Environment Configuration

Create a .env file in the backend directory:

# Gemini AI API Key
GEMINI_API_KEY=your-gemini-api-key-here

# Server Port
PORT=5000

# Google OAuth Credentials
CLIENT_ID=your-client-id.apps.googleusercontent.com
CLIENT_SECRET=your-client-secret
REDIRECT_URIS=http://localhost:5000/api/resume/auth/callback

6. Run the Application

Terminal 1 - Start Backend Server

cd backend
node server.js
# Server will run on http://localhost:5000

Terminal 2 - Start Frontend

cd frontend
npm start
# Frontend will run on http://localhost:3000

7. First Time Setup - Google Authorization

  1. Open the app at http://localhost:3000
  2. Click "Authorize Google" button
  3. Sign in with your Google account
  4. Grant permissions for:
    • Creating and managing Google Docs
    • Organizing files in Google Drive
  5. You'll be redirected back with "Authorization successful!"
  6. A token.json file will be created in your backend folder (keep this secure!)

πŸ“– How to Use

Step 1: Upload Your Resume

  1. Click "Upload Resume" button
  2. Select an image file (PNG, JPG) or PDF
  3. Wait for OCR to extract text
  4. Review and edit the extracted text if needed

Step 2: Enter Job Details

  1. Job Title - Position you're applying for (e.g., "Frontend Developer")
  2. Company Name - Where you're applying (e.g., "Google")
  3. Job Description - Paste the job posting (optional but recommended)

Step 3: Generate Cover Letter

  1. Click "Generate Cover Letter"
  2. AI will create a personalized cover letter
  3. Review and edit the content as needed

Step 4: Save Your Cover Letter

Choose how to save:

  • Copy to Clipboard - Quick copy for pasting elsewhere
  • Create Google Doc - Opens directly in Google Docs
  • Save to Drive (Organized) - Saves with automatic folder organization

Step 5: Manage Your Letters

  • Click "Show Saved Letters" to view all documents
  • Use search to find specific cover letters
  • Export to different formats (PDF, DOCX)
  • Share directly with recruiters
  • Delete unwanted documents

πŸ“ Project Structure

cover-letter-generator/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ aiController.js           # Gemini AI integration
β”‚   β”‚   β”œβ”€β”€ googleDocsController.js   # Google Docs operations
β”‚   β”‚   └── googleDriveController.js  # Google Drive operations
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   └── resume.js                 # API routes
β”‚   β”œβ”€β”€ server.js                     # Express server
β”‚   β”œβ”€β”€ .env                          # Environment variables
β”‚   β”œβ”€β”€ token.json                    # Google OAuth token (auto-generated)
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   └── CoverLetterGenerator.jsx  # Main component
β”‚   β”‚   β”œβ”€β”€ App.js
β”‚   β”‚   └── index.js
β”‚   └── package.json
β”‚
└── README.md

πŸ› Common Issues & Solutions

Issue: "redirect_uri_mismatch" Error

Solution:

  1. Check that redirect URI in .env matches exactly in Google Console:
    http://localhost:5000/api/resume/auth/callback
    
  2. No trailing slashes, exact match required
  3. Wait 5 minutes after updating in Google Console

Issue: "Missing OAuth token" Error

Solution:

  1. Delete token.json if it exists
  2. Click "Authorize Google" again
  3. Complete the authorization flow

Issue: OCR Not Extracting Text

Solution:

  1. Ensure image is clear and high resolution
  2. Try PNG format instead of JPG
  3. Make sure text is horizontal and well-lit
  4. Check browser console for errors

Issue: Google Drive API Not Working

Solution:

  1. Verify Google Drive API is enabled in Cloud Console
  2. Delete token.json and re-authorize
  3. Check that Drive scopes are included in authorization

Issue: Cover Letter Not Generating

Solution:

  1. Verify Gemini API key is correct in .env
  2. Check API quota limits
  3. Ensure all required fields are filled

πŸš€ Deployment Guide (Coming Soon)

The application is currently configured for local development. For production deployment, you'll need to:

  1. Set up MongoDB for user data persistence (replacing local token.json)
  2. Implement JWT authentication for multi-user support
  3. Update OAuth redirect URIs in Google Console
  4. Deploy backend to services like Render, Railway, or Heroku
  5. Deploy frontend to Vercel or Netlify

Note: Full deployment guide with authentication will be added in the next release.

πŸ”’ Security Notes

Current Setup (Development)

  • OAuth token stored locally in token.json
  • Single-user setup (one Google account)
  • Suitable for personal use or development

Important Security Tips

  1. Never commit .env or token.json to Git
  2. Keep your API keys secure and private
  3. Regenerate tokens if accidentally exposed
  4. Use environment variables for all sensitive data

For Production (Future)

  • Implement proper user authentication
  • Store tokens in encrypted database
  • Use HTTPS for all connections
  • Add rate limiting and input validation

πŸ“ Future Enhancements

  • JWT authentication for multi-user support
  • MongoDB integration for data persistence
  • LinkedIn profile import
  • Multiple language support
  • Resume builder feature
  • Email integration for direct sending
  • Batch processing for multiple applications
  • AI-powered job matching
  • Interview preparation tools
  • Mobile app version

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Google Gemini AI for intelligent content generation
  • Google Docs & Drive APIs for document management
  • Tesseract.js for OCR functionality
  • React community for excellent documentation

πŸ“ž Support

For issues or questions:

  • Open an issue on GitHub

⚠️ Disclaimer

This tool is for personal use and assistance in creating cover letters. Always review and customize the generated content to ensure it accurately represents your experience and matches your voice.

Releases

No releases published

Packages

No packages published