Loading repository data…
Loading repository data…
rooneyrulz / repository
AI-powered job search API using FastAPI, LangGraph agents & Groq LLM. Scrapes LinkedIn/Glassdoor jobs via BrightData and returns intelligent, ranked recommendations with match scoring.
job-finder-api/
│
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── .env # Environment variables (create from .env.example)
├── .gitignore # Git ignore file
├── README.md # Project documentation
│
├── app/
│ ├── __init__.py
│ │
│ ├── core/
│ │ ├── __init__.py
│ │ └── config.py # Settings and configuration
│ │
│ ├── models/
│ │ ├── __init__.py
│ │ └── schemas.py # Pydantic models
│ │
│ └── services/
│ ├── __init__.py
│ ├── scraper.py # BrightData scraper
│ ├── llm_service.py # Groq LLM service
│ └── job_agent.py # LangGraph agent workflow
│
└── tests/
├── __init__.py
├── test_api.py
└── test_agent.py
# Create project directory
mkdir job-finder-api && cd job-finder-api
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy the environment template
cp example.env .env
# Edit .env and add your API keys:
# - BRIGHTDATA_API_KEY (from https://brightdata.com)
# - GROQ_API_KEY (from https://console.groq.com)
nano .env
# Create app directories
mkdir -p app/core app/models app/services tests
# Create __init__.py files
touch app/__init__.py
touch app/core/__init__.py
touch app/models/__init__.py
touch app/services/__init__.py
touch tests/__init__.py
# Development mode with auto-reload
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Production mode
uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
Once running, visit:
POST /api/v1/jobs/search
{
"keywords": "Senior Python Developer",
"location": "Remote",
"job_type": "full_time",
"experience_level": "senior",
"limit": 10,
"preferences": {
"min_salary": 120000,
"required_skills": ["Python", "FastAPI", "Docker"],
"exclude_companies": []
}
}
Response:
{
"success": true,
"query": "Senior Python Developer",
"total_found": 10,
"jobs": [
{
"job_id": "linkedin_123456",
"title": "Senior Python Developer",
"company": "Tech Corp",
"location": "Remote",
"job_type": "Full-time",
"description": "...",
"requirements": ["5+ years Python", "FastAPI experience"],
"salary_range": "$120k - $180k",
"posted_date": "2024-11-20",
"apply_url": "https://linkedin.com/jobs/123456",
"source": "LinkedIn",
"match_score": 92.5,
"match_reason": "Strong alignment with Python expertise...",
"key_highlights": ["Remote-first culture", "Competitive salary"]
}
],
"search_metadata": {
"sources": ["LinkedIn", "Glassdoor"],
"processing_time_seconds": 3.5,
"total_scraped": 50,
"analyzed_count": 25,
"final_count": 10
},
"timestamp": "2024-11-24T10:30:00Z"
}
POST /api/v1/jobs/recommend
Same request/response format as search endpoint.
GET /health
{
"status": "healthy",
"message": "All systems operational",
"version": "1.0.0"
}
Create a new Postman collection with these requests:
Health Check
http://localhost:8000/healthSearch Jobs - Basic
http://localhost:8000/api/v1/jobs/search{
"keywords": "Python Developer",
"location": "Remote",
"limit": 5
}
Search Jobs - Advanced
http://localhost:8000/api/v1/jobs/search{
"keywords": "Machine Learning Engineer",
"location": "San Francisco, CA",
"job_type": "full_time",
"experience_level": "senior",
"limit": 10,
"preferences": {
"min_salary": 150000,
"required_skills": ["Python", "TensorFlow", "PyTorch"],
"exclude_companies": ["Company X"]
}
}
full_timepart_timecontractinternshipremotehybridanyentryjuniormidseniorleadexecutiveanymixtral-8x7b-32768 (default - fast and capable)llama-3.3-70b-versatile (high quality)gemma2-9b-it (lightweight)llama-3.1-8b-instant (fastest)Change in .env:
GROQ_MODEL=llama-3.3-70b-versatile
✅ Async/Await - Full async support for high performance ✅ LangGraph State Management - Robust workflow orchestration ✅ Pydantic Validation - Type-safe request/response ✅ Structured LLM Output - JSON schema validation ✅ Error Handling - Comprehensive error handling and logging ✅ Retry Logic - Automatic retry for failed scraping ✅ Concurrent Scraping - Parallel data fetching ✅ AI-Powered Matching - Intelligent job recommendations ✅ Scalable Design - Ready for production deployment
.env file - Add to .gitignore.envLogs include:
View logs in console when running with --log-level info
Create Dockerfile:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Build and run:
docker build -t job-finder-api .
docker run -p 8000:8000 --env-file .env job-finder-api
Create service file: /etc/systemd/system/job-finder.service
[Unit]
Description=Job Finder API
After=network.target
[Service]
User=www-data
WorkingDirectory=/opt/job-finder-api
Environment="PATH=/opt/job-finder-api/venv/bin"
EnvironmentFile=/opt/job-finder-api/.env
ExecStart=/opt/job-finder-api/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
[Install]
WantedBy=multi-user.target
uvicorn main:app --workers 4.env__init__.py files existexport PYTHONPATH="${PYTHONPATH}:$(pwd)"This is a production-ready template. Customize as needed:
MIT License - Feel free to use in your projects!