A Go-based HTTP server that analyzes resumes against job descriptions using OpenAI's GPT model. The API fetches PDF resumes from Google Cloud Storage, extracts their content, and provides detailed analysis including match percentage, strengths, improvements, and missing skills.
- PDF Resume Parsing: Extracts text content from PDF files stored in Google Cloud Storage
- AI-Powered Analysis: Uses OpenAI GPT to analyze resume-job description matches
- Batch Processing: Analyze multiple resumes at once or individual resumes
- Detailed Insights: Provides strengths, improvements, and missing skills analysis
- RESTful API: Clean HTTP endpoints with JSON request/response format
- Go 1.21 or higher
- Google Cloud Platform account with a Storage bucket
- OpenAI API key
- Service account with GCS access
git clone git@github.com:ccrawford4/resume-api.git
cd resume-api
go mod tidy-
Create a Service Account:
- Go to Google Cloud Console
- Navigate to IAM & Admin > Service Accounts
- Create a new service account
- Assign the
Storage Object Viewerrole (or higher if needed) - Download the JSON key file
-
Set up Authentication:
# Copy your service account JSON to keys.json in the root directory cp /path/to/your/service-account.json keys.json # Set environment variables export GCS_BUCKET_NAME="your-resume-bucket-name" export OPENAI_API_KEY="your-openai-api-key"
- Upload PDF resume files to your Google Cloud Storage bucket
- Ensure the service account has read access to the bucket
go run main.goThe server will start on http://localhost:8080
GET /
Returns a simple health check message.
Response:
hello world
POST /
Analyzes all PDF resumes in the GCS bucket against a job description.
Request Body:
{
"jobDescription": "Your detailed job description here..."
}Response:
{
"success": true,
"data": [
{
"id": "1",
"name": "Software_Engineer_Resume_2024.pdf",
"uploadDate": "2024-01-15",
"fileUrl": "/api/resume-analysis/resumes/1/preview",
"matchPercentage": 87,
"insights": {
"strengths": [
"Strong React and TypeScript experience",
"Previous experience with modern frontend frameworks",
"Good understanding of state management"
],
"improvements": [
"Could highlight more testing experience",
"Add specific examples of performance optimization"
],
"missingSkills": [
"Next.js experience not mentioned",
"Limited backend integration examples"
]
}
}
],
"totalResumes": 3
}POST /new-resume
Analyzes a specific resume file against a job description.
Request Body:
{
"resumeName": "Software_Engineer_Resume_2024.pdf",
"jobDescription": "Your detailed job description here..."
}Response:
{
"success": true,
"data": [
{
"id": "1",
"name": "Software_Engineer_Resume_2024.pdf",
"uploadDate": "2024-01-15",
"fileUrl": "/api/resume-analysis/resumes/1/preview",
"matchPercentage": 87,
"insights": {
"strengths": [...],
"improvements": [...],
"missingSkills": [...]
}
}
],
"totalResumes": 1
}| Variable | Description | Required | Default |
|---|---|---|---|
GCS_BUCKET_NAME |
Google Cloud Storage bucket name | Yes | "user-resumes-hs-hackathon" |
OPENAI_API_KEY |
OpenAI API key for GPT analysis | Yes | - |
resume-api/
├── main.go # HTTP server and routes
├── go.mod # Go module dependencies
├── go.sum # Dependency checksums
├── keys.json # Google Cloud service account credentials
├── gcloud/
│ └── client.go # Google Cloud Storage client
├── openai/
│ └── client.go # OpenAI API client
└── parser/
└── parser.go # PDF parsing utilities
The API returns appropriate HTTP status codes:
200: Success400: Bad request (invalid JSON, missing required fields)500: Internal server error (GCS/OpenAI connection issues)
Error responses include:
{
"success": false,
"error": "Error description"
}- New Endpoints: Add routes in
main.go - GCS Operations: Extend
gcloud/client.go - AI Analysis: Modify
openai/client.go - File Parsing: Update
parser/parser.go
# Test health endpoint
curl http://localhost:8080/
# Test resume analysis
curl -X POST http://localhost:8080/ \
-H "Content-Type: application/json" \
-d '{"jobDescription": "Software Engineer position..."}'-
"could not find default credentials"
- Ensure
keys.jsonexists in the project root - Check that the service account has proper permissions
- Ensure
-
"bucket doesn't exist"
- Check the bucket name in
GCS_BUCKET_NAME - Ensure the service account has access to the bucket
- Check the bucket name in
-
"OpenAI API error"
- Verify
OPENAI_API_KEYis set and valid - Check OpenAI API quota and billing
- Verify
-
"PDF parsing error"
- Ensure files in GCS are valid PDFs
- Check file permissions and accessibility
- Never commit
keys.jsonto version control - Use environment variables for sensitive configuration
- Consider using Google Cloud's workload identity for production deployments