Building JobGuard: A Full-Stack AI Solution to Detect Fake Job Postings
In today’s digital job market, where millions of positions are posted daily, the threat of fraudulent job listings has become a pervasive problem. According to recent reports, job scams cost victims billions annually, with many falling prey to sophisticated phishing attempts disguised as legitimate opportunities. As a developer and AI enthusiast, I set out to create a practical solution that could instantly verify job postings before job seekers invest their time and personal information.
JobGuard is the result a complete full-stack machine learning application that achieves 97.4% accuracy in detecting fake job postings. This article dives deep into every aspect of the project, from the initial concept to deployment, providing a comprehensive blueprint for building similar AI-powered tools.
The Problem: A Growing Epidemic of Job Scams
Job seekers face an increasingly treacherous landscape. Fake job postings often:
- Promise unrealistic salaries or “work from home” opportunities with no experience required
- Request upfront fees for “training” or “background checks”
- Collect personal information for identity theft
- Waste months of applicants’ time with non-existent positions
The Fake Job Postings dataset from Kaggle reveals that approximately 4.8% of job listings are fraudulent — a small percentage that represents thousands of scams daily. Traditional detection methods rely on manual verification, which is time-consuming and ineffective at scale.
The Solution: AI-Powered Instant Verification
JobGuard addresses this challenge with a three-tier architecture combining modern web technologies and machine learning:
- Frontend: A responsive Next.js application for intuitive job posting analysis
- Backend: A high-performance FastAPI server serving ML predictions
- ML Pipeline: A scikit-learn model trained on 17,880 labeled job postings
The application allows users to paste job details and receive instant verdicts with confidence scores, helping them make informed decisions before applying.
Technology Stack: Modern Tools for Maximum Impact
Frontend: Next.js + TypeScript
- Next.js 16.2.2 with App Router for server-side rendering and optimal performance
- React 19.2.4 with TypeScript 5 for type-safe component development
- CSS Modules for scoped, maintainable styling
- ESLint 9 for code quality enforcement
Backend: FastAPI + Python
- FastAPI 0.115.0 for async API development with automatic OpenAPI documentation
- Uvicorn 0.32.0 as the ASGI server for production deployment
- Pydantic 2.9.2 for data validation and serialization
- scikit-learn 1.5.2 for machine learning algorithms
Supporting Libraries
- pandas 2.2.3 and numpy 2.1.3 for data processing
- joblib 1.4.2 for model serialization
- python-multipart 0.0.12
Backend Deep Dive: The API That Powers Predictions
The backend serves as the intelligent core of JobGuard, exposing three key endpoints:
Health and Status Endpoints
@app.get("/")
def root():
return {"status": "running", "model": "loaded"}
@app.get("/health")
def health():
return {"status": "ok", "model_loaded": True}The Prediction Engine
The /predict endpoint accepts job posting data and returns ML predictions:
@app.post("/predict", response_model=PredictionOutput)
def predict(job: JobInput):
# Input validation
if not job.title.strip() and not job.description.strip():
raise HTTPException(status_code=400, detail="Title or description required")
# Text preprocessing and combination
combined = clean_text(
f"{job.title} {job.company} {job.location} {job.salary} "
f"{job.description} {job.requirements} {job.benefits}"
)
# ML prediction
prediction = pipeline.predict([combined])[0]
probability = pipeline.predict_proba([combined])[0]
is_fake = bool(prediction == 1)
confidence = float(probability[1] if is_fake else probability[0])
return PredictionOutput(
prediction="fake" if is_fake else "real",
confidence=round(confidence, 4),
label="Fake Job" if is_fake else "Real Job",
message="This job posting shows signs of being fraudulent." if is_fake
else "This job posting appears to be legitimate."
)Key features include:
- Flexible Input: Requires only title or description, with other fields optional
- Confidence Scoring: Returns probability of the predicted class (0–100%)
- CORS Support: Enables seamless frontend integration
- Error Handling: Graceful degradation with meaningful error messages
Frontend Experience: Clean, Intuitive, and Educational
The frontend transforms complex ML predictions into an accessible user experience across four main pages.
Homepage: Setting Expectations
The landing page establishes credibility with:
- Clear value proposition: “Detect fake job postings instantly”
- Key metrics: 97.4% accuracy, <1 second response time
- Three-step process visualization
- Feature highlights: scam language detection, company credibility checks
Detection Form: Where the Magic Happens
The /detect page provides a comprehensive input interface:
const [form, setForm] = useState({
title: '',
company: '',
location: '',
salary: '',
description: '',
requirements: '',
benefits: '',
})Interactive elements include:
- Quick-fill buttons for educational examples:
- “Load fake job”: Pre-fills obvious scam patterns
- “Load real job”: Shows legitimate posting characteristics
- Real-time validation ensuring required fields are complete
- Loading states during API calls for better UX
Results Dashboard: Visual Verdict Delivery
Get Anees Ahmad’s stories in your inbox
Join Medium for free to get updates from this writer.
The results page transforms raw predictions into actionable insights:
- Verdict Card: Color-coded badge (red for fake, green for real)
- Confidence Gauge: Animated SVG circle showing prediction certainty
- Risk Classification: High/Medium/Low risk based on confidence thresholds
- Signal Analysis: Specific warning flags or positive indicators detected
Educational Components
- About Page: Explains the ML pipeline and fraud detection signals
- Example Jobs: Teach users to recognize scam patterns
- Actionable Guidance: Next steps based on prediction results
The Machine Learning Pipeline: From Data to Predictions
Dataset and Preprocessing
The model trains on 17,880 job postings with a 95.2%/4.8% real/fake distribution. Text preprocessing includes:
def clean_text(text):
if pd.isna(text):
return ''
text = str(text).lower()
text = re.sub(r'<.*?>', ' ', text) # Remove HTML tags
text = re.sub(r'[^a-z0-9\s]', ' ', text) # Keep alphanumeric + spaces
text = re.sub(r'\s+', ' ', text) # Normalize whitespace
return text.strip()Feature Engineering
- Text Combination: All 11 job fields merged into single feature string
- TF-IDF Vectorization: 15,000 features with unigrams and bigrams
- Class Balancing:
class_weight='balanced'compensates for imbalanced data
Model Training
pipeline = Pipeline([
('tfidf', TfidfVectorizer(
max_features=15000,
ngram_range=(1, 2),
sublinear_tf=True,
min_df=2,
stop_words='english'
)),
('model', LogisticRegression(
class_weight='balanced',
max_iter=1000,
C=1.0,
solver='lbfgs'
))
])The pipeline achieves 97.4% accuracy with sub-second inference times.
Deployment: From Local Development to Production
Monorepo Structure
The project uses a single repository with separate deployment configurations:
fake-job-detector/
├── backend/ # FastAPI application
├── frontend/ # Next.js application
└── README.md # Project documentationBackend Deployment (Render)
# render.yaml
services:
- type: web
name: fake-job-detector-api
runtime: python
rootDir: backend
buildCommand: pip install -r requirements.txt
startCommand: uvicorn main:app --host 0.0.0.0 --port $PORT
envVars:
- key: PYTHON_VERSION
value: 3.11.0Frontend Deployment (Vercel)
- Automatic deployments from Git
- Global CDN distribution
- Environment variable configuration for API endpoint
🌐Live Demo
Frontend (Vercel):
https://fake-job-posting-detector-black.vercel.app/Backend API (Render):
https://fake-job-posting-detector-tn3a.onrender.comAPI Documentation:
https://fake-job-posting-detector-tn3a.onrender.com/docsPerformance and Real-World Impact
Model Evaluation
- Accuracy: 97.4% on held-out test set
- Speed: <1 second per prediction
- Robustness: Handles missing fields gracefully
- Interpretability: Provides confidence scores and signal explanations
User Experience Metrics
- Conversion: Clear CTAs guide users through the detection process
- Education: Example jobs teach fraud recognition patterns
- Accessibility: Responsive design works on all devices
- Trust: Transparent about model limitations and confidence levels
Getting Started: Running JobGuard Locally
Prerequisites
- Node.js 18+ and Python 3.11+
- Git for cloning the repository
Backend Setup
cd backend
pip install -r requirements.txt
python training/train.py # Train the model
uvicorn main:app --reloadFrontend Setup
cd frontend
npm install
npm run devEnvironment Configuration
Create .env.local in the frontend directory:
NEXT_PUBLIC_API_URL=http://localhost:8000Lessons Learned and Future Enhancements
Key Insights
- Imbalanced Data Handling:
class_weight='balanced'prevents bias toward majority class - Bigram Importance: Phrases like “no experience needed” are highly predictive
- User Education: Interactive examples improve fraud awareness
- Confidence Calibration: Probability scores provide intuitive certainty measures
Potential Improvements
- Advanced Models: BERT transformers for better language understanding
- Real-time Learning: User feedback to continuously improve predictions
- Multi-language Support: Expand beyond English job postings
- Integration APIs: Browser extensions or job board partnerships
Conclusion: Democratizing AI for Job Seekers
JobGuard demonstrates how machine learning can solve real-world problems with accessible, production-ready applications. By combining modern web technologies with effective ML engineering, we’ve created a tool that empowers job seekers to make informed decisions in an increasingly complex job market.
The project showcases best practices in:
- Full-stack development with type safety
- ML model deployment and serving
- User-centered design for technical tools
- Educational product development
Whether you’re a developer building AI applications or a job seeker protecting yourself from scams, JobGuard provides a comprehensive blueprint for creating impactful technology solutions.
Try JobGuard today: Visit the deployed application and paste any job posting to see the AI in action.





