A comprehensive FastAPI backend that uses AI to match employees with employers based on resume analysis, voice communication assessment, and job requirements.
- Employers create job postings with specific requirements (skills, experience, education, communication needs)
- Employees upload resumes (PDF/Word) and/or voice recordings
- AI analyzes employee profiles and matches them against job requirements
- Smart matching provides scored recommendations for both parties
- Application tracking manages the hiring process
- π§ AI Resume Analysis - Extract skills, experience, education from documents
- π€ Voice Communication Assessment - Analyze speech patterns, clarity, confidence
- π― Smart Job Matching - AI-powered compatibility scoring
- π₯ Dual User System - Separate interfaces for employees and employers
- π Detailed Analytics - Match breakdowns and improvement suggestions
- π Secure Authentication - JWT-based user management
- Python 3.8+
- MySQL 8.0+
- 4GB+ RAM (for AI models)
- 2GB+ free storage
# Clone repository
git clone <your-repo-url>
cd ai-resume-server
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate# Upgrade pip
pip install --upgrade pip
# Install all requirements
pip install -r requirements.txt
# Download spaCy language model
python -m spacy download en_core_web_sm# Install MySQL and create database
mysql -u root -p
CREATE DATABASE your_database_name;
CREATE USER 'your_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON your_database_name.* TO 'your_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;# Copy environment template
cp .env.example .env
# Edit .env with your settings
nano .envRequired .env settings:
# Database
MYSQL_HOST=your-mysql-host
MYSQL_PORT=3306
MYSQL_USER=your-mysql-user
MYSQL_PASSWORD=your-secure-password
MYSQL_DATABASE=your-database-name
# Security
SECRET_KEY=your-super-secret-key-here
ACCESS_TOKEN_EXPIRE_MINUTES=1440
ALGORITHM=HS256
# File Upload Settings
MAX_FILE_SIZE=26214400
UPLOAD_FOLDER=uploads
# AI/ML Model Settings
WHISPER_MODEL=base
MAX_AUDIO_DURATION=600
SIMILARITY_THRESHOLD=0.7
# Matching Algorithm Settings
DEFAULT_MATCH_LIMIT=50
MINIMUM_MATCH_SCORE=70
# CORS Settings
CORS_ORIGINS=http://localhost:3000,http://localhost:3001,http://127.0.0.1:3000
# Development
DEBUG=True# Recommended: Use the startup script
chmod +x start_server.sh
./start_server.sh
# Or with uvicorn directly
uvicorn main:app --host 0.0.0.0 --port 8000 --reload- API Docs: http://localhost:8000/docs
- Health Check: http://localhost:8000/api/health
- Root: http://localhost:8000/
POST /api/auth/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123",
"first_name": "John",
"last_name": "Doe",
"user_type": "employee", // or "employer"
"phone": "+1234567890",
// For employers only:
"company_name": "Tech Corp",
"company_website": "https://techcorp.com",
"company_size": "50-100"
}POST /api/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}POST /api/employer/jobs
Authorization: Bearer <token>
Content-Type: application/json
{
"title": "Senior Python Developer",
"description": "We are looking for an experienced Python developer...",
"location": "San Francisco, CA",
"remote_allowed": true,
"job_type": "full_time",
"experience_level": "senior",
"salary_min": 12000000, // $120,000 in cents
"salary_max": 15000000, // $150,000 in cents
"required_skills": ["python", "django", "postgresql", "docker"],
"preferred_skills": ["kubernetes", "aws", "react"],
"required_experience": {
"min_years": 5,
"areas": ["web development", "api design"]
},
"required_education": {
"min_degree": "bachelor",
"field": "computer science"
},
"communication_requirements": {
"presentation_skills": true,
"client_interaction": true,
"min_communication_score": 75
},
"minimum_match_score": 70
}GET /api/employer/jobs/{job_id}/applications
Authorization: Bearer <token>POST /api/employee/resume/upload
Authorization: Bearer <token>
Content-Type: multipart/form-data
file: <resume.pdf>POST /api/employee/voice/upload
Authorization: Bearer <token>
Content-Type: multipart/form-data
file: <voice_recording.wav>POST /api/employee/apply/{job_id}
Authorization: Bearer <token>
Content-Type: application/json
{
"resume_id": 1,
"voice_analysis_id": 2,
"cover_letter": "I am excited to apply for this position..."
}GET /api/matching/jobs
Authorization: Bearer <token>
Query Parameters:
- limit: 20 (optional)
- min_score: 70 (optional)GET /api/matching/candidates/{job_id}
Authorization: Bearer <token>
Query Parameters:
- limit: 50 (optional)
- min_score: 70 (optional)- Stores both employees and employers
- Fields: id, email, password_hash, first_name, last_name, user_type, company_info
- Employer job requirements and criteria
- Fields: id, employer_id, title, description, requirements (JSON), matching_weights
- Employee resume files and AI analysis results
- Fields: id, employee_id, file_info, analysis_results (JSON), skills, experience
- Employee voice recordings and communication assessment
- Fields: id, employee_id, file_info, transcript, communication_scores
- Links employees to jobs with match scores
- Fields: id, employee_id, job_id, resume_id, voice_id, match_score, status
- AI-generated proactive matches
- Fields: id, employee_id, job_id, match_score, match_details (JSON)
- Text Extraction - PyPDF2, pdfplumber, python-docx
- NLP Processing - spaCy for named entity recognition
- Skills Extraction - Keyword matching + semantic analysis
- Experience Parsing - Pattern recognition for job history
- Education Analysis - Degree and institution extraction
- Speech-to-Text - OpenAI Whisper (runs locally)
- Audio Features - Librosa for speech characteristics
- Communication Analysis - TextBlob for sentiment and language quality
- Professional Assessment - Custom scoring algorithms
- Skills Matching - TF-IDF + semantic similarity
- Experience Scoring - Years and relevance analysis
- Education Matching - Degree level and field comparison
- Communication Fit - Voice analysis vs job requirements
- Weighted Scoring - Customizable importance weights
ai-resume-server/
βββ app/
β βββ models/ # SQLAlchemy database models
β β βββ user.py # User model (employees & employers)
β β βββ job_posting.py # Job posting model
β β βββ resume.py # Resume analysis model
β β βββ voice_analysis.py # Voice analysis model
β β βββ application.py # Application tracking model
β βββ routers/ # FastAPI route handlers
β β βββ auth.py # Authentication endpoints
β β βββ employer.py # Employer-specific endpoints
β β βββ employee.py # Employee-specific endpoints
β β βββ matching.py # AI matching endpoints
β βββ services/ # Business logic layer
β β βββ ai_service.py # AI/ML processing service
β β βββ auth_service.py # Authentication service
β β βββ file_service.py # File handling service
β βββ schemas/ # Pydantic models for validation
β βββ utils/ # Utility functions
β βββ config.py # Configuration settings
β βββ database.py # Database connection setup
βββ uploads/ # File storage directory
βββ tests/ # Test files
βββ alembic/ # Database migrations
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ main.py # FastAPI application entry point
βββ README.md # This documentation
# In .env file
WHISPER_MODEL=base # tiny, base, small, medium, large
SIMILARITY_THRESHOLD=0.7 # 0.0 to 1.0
MAX_AUDIO_DURATION=600 # seconds (10 minutes)# Customize in job posting or config
SCORE_WEIGHTS = {
"skills": 0.4, # 40% weight
"experience": 0.3, # 30% weight
"education": 0.2, # 20% weight
"communication": 0.1 # 10% weight
}MAX_FILE_SIZE = 25 * 1024 * 1024 # 25MB
ALLOWED_RESUME_EXTENSIONS = ["pdf", "doc", "docx", "txt"]
ALLOWED_AUDIO_EXTENSIONS = ["wav", "mp3", "mp4", "m4a", "ogg"]# Install test dependencies
pip install pytest pytest-asyncio httpx
# Run all tests
pytest
# Run with coverage
pytest --cov=app tests/
# Run specific test file
pytest tests/test_auth.py -vUse the interactive docs at /docs or test with curl:
# Test health endpoint
curl http://localhost:8000/api/health
# Test registration
curl -X POST http://localhost:8000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123","first_name":"John","last_name":"Doe","user_type":"employee"}'-
Use Production Database
MYSQL_HOST=your-production-host MYSQL_PASSWORD=your-secure-production-password SECRET_KEY=your-production-secret-key DEBUG=False
-
Run with Gunicorn
pip install gunicorn gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker
-
Environment Variables
SECRET_KEY=your-production-secret-key MYSQL_PASSWORD=your-secure-production-password CORS_ORIGINS=https://yourdomain.com
# Dockerfile
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN python -m spacy download en_core_web_sm
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]python -m spacy download en_core_web_sm- Verify MySQL is running
- Check credentials in .env
- Ensure database exists
- Ensure stable internet connection
- Check available disk space (models are 100MB+)
- Try smaller model:
WHISPER_MODEL=tiny
- Check file size limits
- Verify upload directory permissions
- Ensure supported file format
- Use Redis for caching
- Implement background job queue
- Optimize database queries
- Use CDN for file storage
# Reduce model memory usage
WHISPER_MODEL=tiny # Smallest model
torch.set_num_threads(2) # Limit CPU threads- User registration rates (employees vs employers)
- Resume/voice upload success rates
- AI analysis completion times
- Match accuracy feedback
- Application conversion rates
# Check system health
curl http://localhost:8000/api/health
# Monitor database performance
curl http://localhost:8000/api/admin/stats- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: http://localhost:8000/docs
- Issues: Create GitHub issue
- Email: support@yourcompany.com
Your AI-powered employee-employer matching system is now ready to use. The system provides:
β
Complete user management for employees and employers
β
AI-powered resume analysis with skill extraction
β
Voice communication assessment with detailed scoring
β
Smart job matching with customizable criteria
β
Full application tracking and management
β
RESTful API with comprehensive documentation
β
Production-ready with proper error handling
Start by registering users and creating job postings to see the AI matching in action!