NEW ORGANIZATION
AI & ML interests
None defined yet.
๐ฏ Resume Analyzer API - Production-Ready Backend
A complete, interview-grade FastAPI backend for AI-powered resume analysis using modern NLP techniques.
โจ Features
- ๐ Resume Parsing: Extract text from PDF and DOCX files
- ๐ง NLP Skill Extraction: Use spaCy with 200+ predefined skills
- ๐ฏ Semantic Matching: AI-powered resume vs job description matching using sentence-transformers
- ๐ Skill Gap Analysis: Identify missing skills with detailed breakdown
- โก Fast & Efficient: ~350ms end-to-end latency
- ๐ Production Ready: Proper error handling, logging, CORS support
- ๐ Well Documented: Code comments, docstrings, comprehensive guides
- ๐ Interview Grade: Clean architecture, best practices, scalable design
๐ Quick Start
1. Setup Virtual Environment (2 min)
Windows:
python -m venv venv
venv\Scripts\activate
macOS/Linux:
python -m venv venv
source venv/bin/activate
2. Install Dependencies (3 min)
pip install -r requirements.txt
3. Download spaCy Model (1 min)
python -m spacy download en_core_web_sm
4. Run the Server (immediate)
python main.py
You should see:
โ Resume parser initialized
โ Skill extractor initialized
โ Resume matcher initialized
Uvicorn running on http://0.0.0.0:8000
5. Test the API
Open in browser: http://localhost:8000/docs
Use the interactive Swagger UI to test /analyze endpoint!
๐ Documentation
| Document | Purpose |
|---|---|
| SETUP_GUIDE.md | Installation, deployment, troubleshooting |
| ARCHITECTURE.md | Technical deep dive, design decisions |
| QUICK_REFERENCE.md | Quick commands and API reference |
๐ API Endpoint
POST /analyze
Upload a resume and analyze against job description
Request:
curl -X POST "http://localhost:8000/analyze" \
-F "file=@resume.pdf" \
-F "job_description=Senior Python developer needed..."
Response:
{
"match_score": 85.5,
"resume_skills": ["Python", "FastAPI", "PostgreSQL", "Docker"],
"jd_skills": ["Python", "FastAPI", "PostgreSQL", "Docker", "Kubernetes"],
"missing_skills": ["Kubernetes"]
}
๐ Project Structure
backend/
โโโ main.py # FastAPI application
โโโ requirements.txt # Python dependencies
โโโ skills.json # Skill database (200+ skills)
โโโ test_api.py # Testing script
โ
โโโ models/
โ โโโ response_models.py # Pydantic schemas
โ
โโโ services/
โ โโโ resume_parser.py # PDF/DOCX parsing
โ โโโ skill_extractor.py # spaCy skill extraction
โ โโโ matcher.py # Semantic similarity
โ โโโ utils.py # Helpers & logging
โ
โโโ SETUP_GUIDE.md # Installation guide
โโโ ARCHITECTURE.md # Technical documentation
โโโ QUICK_REFERENCE.md # Quick reference
๐ง How It Works
Step 1: Resume Parsing
- Accepts PDF or DOCX files
- Uses pdfplumber for PDFs (accurate, handles tables)
- Uses python-docx for Word documents
- Extracts clean text for processing
Step 2: Skill Extraction
- Uses spaCy NLP for entity recognition
- Matches against 200+ skills database (skills.json)
- Fuzzy matching tolerates typos:
- "Pyton" โ matches "Python" (95% similarity)
- "FastAPI" โ exact match
- Returns unique, sorted skills
Step 3: Semantic Matching
- Uses sentence-transformers (all-MiniLM-L6-v2 model)
- Converts resume and job description to 384-dim embeddings
- Computes cosine similarity between embeddings
- Returns match score: 0-100%
Why semantic matching?
Traditional (keyword matching):
"Python developer" vs "Software engineer with Java" โ 0% match
Semantic (embeddings):
"Python developer" vs "Software engineer with Java" โ 40% match
(Captures meaning: both are developers, different tech stacks)
Step 4: Skill Gap Analysis
- Identifies skills in job description NOT in resume
- Returns missing skills list
- Helps identify training needs
๐ป Usage Examples
Python Script
import requests
# Analyze resume
with open('resume.pdf', 'rb') as f:
response = requests.post(
'http://localhost:8000/analyze',
files={'file': f},
data={
'job_description': '''
Senior Python FastAPI Developer
Requirements:
- 5+ years Python experience
- FastAPI and PostgreSQL
- Docker & Kubernetes
- REST API design
'''
}
)
result = response.json()
print(f"Match Score: {result['match_score']}%")
print(f"Missing Skills: {', '.join(result['missing_skills'])}")
React/JavaScript
const formData = new FormData();
formData.append('file', resumeFile); // From file input
formData.append('job_description', jobDescription);
const response = await fetch('http://localhost:8000/analyze', {
method: 'POST',
body: formData
});
const result = await response.json();
console.log(`Match Score: ${result.match_score}%`);
Command Line Test
python test_api.py # Interactive mode
python test_api.py --file resume.pdf # With default JD
python test_api.py --batch ./resumes/ # Multiple files
โ๏ธ Configuration
Change AI Model (in matcher.py)
# Current: Fast (80MB, 100ms)
ResumeMatcher("all-MiniLM-L6-v2")
# Alternative: More Accurate (420MB, 300ms)
ResumeMatcher("all-mpnet-base-v2")
# Alternative: Highest Quality (700MB, 500ms)
ResumeMatcher("all-roberta-large-v1")
Add Custom Skills (in skills.json)
{
"skills": [
"Python",
"FastAPI",
"Your Custom Skill Here"
]
}
Change Server Port
python -m uvicorn main:app --port 9000
๐ Performance
| Operation | Duration |
|---|---|
| Resume parsing (2-page PDF) | ~100ms |
| Skill extraction | ~50ms |
| Semantic matching | ~100ms |
| Total response time | ~350-500ms |
Memory Usage:
- spaCy model: 100MB
- Sentence-transformers: 80MB
- Runtime: 50MB
- Total: ~230MB
๐ Production Deployment
With Gunicorn (4 workers)
pip install gunicorn
gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app \
--bind 0.0.0.0:8000
Handles: ~12 requests/sec, 4-8 concurrent requests
With Docker
FROM python:3.10
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt && \
python -m spacy download en_core_web_sm
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Run:
docker build -t resume-analyzer .
docker run -p 8000:8000 resume-analyzer
Systemd Service
[Unit]
Description=Resume Analyzer API
After=network.target
[Service]
User=www-data
WorkingDirectory=/opt/resume-analyzer
Environment="PATH=/opt/resume-analyzer/venv/bin"
ExecStart=/opt/resume-analyzer/venv/bin/gunicorn -w 4 \
-k uvicorn.workers.UvicornWorker main:app
[Install]
WantedBy=multi-user.target
๐งช Testing
Health Check
curl http://localhost:8000/health
Interactive Testing
python test_api.py
# Follow prompts to select sample JD and upload resume
Swagger UI
Open http://localhost:8000/docs and click "Try it out"
๐ Learning & Interview Points
Architecture
โ Modular Design: Separated concerns (parsing, extraction, matching) โ Clean Code: Type hints, comprehensive docstrings, logging โ Error Handling: Validation at multiple layers, proper HTTP status codes
NLP Concepts
โ Skill Extraction: spaCy + fuzzy matching (typo tolerance) โ Embeddings: sentence-transformers for semantic understanding โ Similarity Metrics: Cosine similarity for comparing vectors
Performance
โ Caching: Models loaded once, reused for all requests โ Async: FastAPI's async/await for efficient I/O โ Optimization: ~350ms end-to-end, suitable for production
Scalability
โ Multi-worker: Gunicorn with 4+ workers โ Load Balancing: Ready for Nginx/ALB โ Caching: Can add Redis for repeated requests
๐ Key Technologies
| Component | Library | Why |
|---|---|---|
| Web Framework | FastAPI | Modern, async, auto-docs |
| PDF Extraction | pdfplumber | Accurate text extraction |
| DOCX Extraction | python-docx | Direct DOCX parsing |
| NLP | spaCy | Fast, efficient, production-ready |
| Embeddings | sentence-transformers | Pre-trained semantic similarity |
| Similarity | scikit-learn | Cosine similarity computation |
| Validation | Pydantic | Type safety, auto-validation |
๐ Troubleshooting
Issue: spaCy model not found
python -m spacy download en_core_web_sm
Issue: Port 8000 already in use
python -m uvicorn main:app --port 9000
Issue: Out of memory
- Use smaller sentence-transformers model
- Or increase available RAM
- Check SETUP_GUIDE.md for details
Issue: Slow first request
- Normal (3-5s for loading models)
- Subsequent requests are fast (~100-200ms faster)
๐ Files Overview
main.py (200+ lines)
- FastAPI application setup
- CORS configuration
- Health check endpoint
- Main
/analyzeendpoint - Error handlers
- Startup/shutdown events
services/resume_parser.py (150+ lines)
ResumeParserclassparse_pdf(): pdfplumber-based PDF extractionparse_docx(): python-docx-based Word extraction- Error handling for corrupt files
services/skill_extractor.py (200+ lines)
SkillExtractorclass- Load skills from JSON database
extract_skills(): Fuzzy matching algorithm_fuzzy_match(): Typo-tolerant skill detection- Context-aware extraction using spaCy
services/matcher.py (200+ lines)
ResumeMatcherclass- Load sentence-transformers model
compute_match_score(): Semantic similarity_compute_cosine_similarity(): Vector similaritybatch_match(): Multiple JD matching
models/response_models.py (80+ lines)
ResumeAnalysisResponse: Main response schemaErrorResponse: Error schema- Pydantic validation and auto-documentation
services/utils.py (100+ lines)
- Logging setup
- Text cleaning
- Skill normalization
- File validation helpers
skills.json (250+ skills)
- Predefined skill database
- Languages, frameworks, tools, soft skills
- Easy to extend
๐ฏ Next Steps
To Extend the Backend:
- Add Database: Store analysis results in PostgreSQL
- Add Caching: Redis cache for embeddings
- Add Async Processing: Celery for batch analysis
- Add Authentication: JWT tokens for API security
- Add Monitoring: Prometheus metrics, error tracking
- Add Tests: Unit tests, integration tests
- Add Swagger Schemas: OpenAPI documentation
To Integrate with Frontend:
// React component example
const [matchScore, setMatchScore] = useState(null);
const analyzeResume = async (file, jobDescription) => {
const formData = new FormData();
formData.append('file', file);
formData.append('job_description', jobDescription);
const response = await fetch('http://localhost:8000/analyze', {
method: 'POST',
body: formData
});
const result = await response.json();
setMatchScore(result.match_score);
};
๐ License
MIT License - Feel free to use for projects, learning, and interviews!
๐ค Support
For questions or issues:
- Check SETUP_GUIDE.md for installation help
- Check ARCHITECTURE.md for technical details
- Review code comments and docstrings
- Run
python test_api.pyfor functional testing
โ Checklist for Interviews
When discussing this project:
- Explain modular architecture and separation of concerns
- Describe NLP approach: spaCy + fuzzy matching
- Explain embeddings and cosine similarity
- Discuss performance (350ms end-to-end)
- Demonstrate error handling strategy
- Show code organization and documentation
- Discuss scalability (workers, caching, database)
- Mention production readiness (logging, CORS, validation)
- Explain why each library was chosen
- Discuss trade-offs (accuracy vs speed, memory vs quality)
๐ Highlights
โจ Production-Ready Code: Well-commented, type-hinted, properly structured โจ NLP Best Practices: Modern approaches to semantic understanding โจ Clean Architecture: Modular design, easy to test and extend โจ Complete Documentation: Setup, architecture, quick reference guides โจ Interview-Grade: Demonstrates software engineering skills โจ Fully Functional: Works end-to-end immediately after setup
Built with โค๏ธ for learning and interviews
Start with: python main.py โ Open http://localhost:8000/docs