Skip to content

Intelligent job recommendation platform using Java + MySQL + Redis. Supports location-based search, AI keyword extraction, and personalized suggestions.

Notifications You must be signed in to change notification settings

nuglifeleoji/Job-Recommendation-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Job Recommendation System

An intelligent job recommendation system that provides location-based job search with personalized recommendations, built with Java, MySQL, Redis, and modern web technologies.

πŸ“‹ Table of Contents

✨ Features

Core Functionality

  • 🌍 Location-Based Search: Find jobs near any geographic location
  • ⭐ Smart Favorites: Save and manage favorite job listings
  • πŸ” Keyword Extraction: Automatic job keyword extraction using AI
  • πŸ“Š Personalized Recommendations: AI-powered job recommendations
  • ⚑ Redis Caching: High-performance caching for improved response times

Security & Performance

  • πŸ” Secure Authentication: MD5-hashed passwords with session management
  • πŸ›‘οΈ Input Validation: Comprehensive input sanitization and validation
  • πŸ“ Structured Logging: Centralized logging with multiple levels
  • βš™οΈ Environment Configuration: Flexible configuration management
  • 🚦 Error Handling: Structured exception handling with user-friendly messages

User Experience

  • πŸ’» Responsive Web Interface: Modern, mobile-friendly UI
  • πŸ”„ Real-time Updates: Dynamic content loading with AJAX
  • πŸ“± Cross-platform Compatibility: Works on desktop, tablet, and mobile
  • 🎨 Professional Design: Clean, intuitive user interface

πŸ—οΈ Architecture

System Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚    Backend      β”‚    β”‚   External APIs β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ HTML/CSS/JS   │◄──►│ β€’ Java Servlets │◄──►│ β€’ SerpAPI       β”‚
β”‚ β€’ Bootstrap     β”‚    β”‚ β€’ REST APIs     β”‚    β”‚ β€’ EdenAI        β”‚
β”‚ β€’ AJAX          β”‚    β”‚ β€’ Business Logicβ”‚    β”‚ β€’ GeoConverter  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚   Data Layer    β”‚    β”‚     Cache       β”‚
                       β”‚                 β”‚    β”‚                 β”‚
                       β”‚ β€’ MySQL DB      │◄──►│ β€’ Redis         β”‚
                       β”‚ β€’ Connection    β”‚    β”‚ β€’ Session Store β”‚
                       β”‚   Pooling       β”‚    β”‚ β€’ Search Cache  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technology Stack

Backend:

  • Java 11+ with Servlet API
  • Maven for dependency management
  • MySQL 8.0+ for data persistence
  • Redis for caching and session management

Frontend:

  • HTML5, CSS3, JavaScript (ES6+)
  • Bootstrap for responsive design
  • AJAX for asynchronous communication

External Services:

  • SerpAPI: Google Jobs search integration
  • EdenAI: AI-powered keyword extraction
  • GeoConverter: Coordinate to location code conversion

Development & Deployment:

  • JUnit 5 for unit testing
  • Apache Tomcat 9+ as servlet container
  • Environment-based configuration
  • Comprehensive logging system

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Java Development Kit (JDK) 11 or higher
  • Apache Maven 3.6+
  • MySQL 8.0+
  • Redis 6.0+
  • Apache Tomcat 9.0+

Required API Keys

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/your-username/job-recommendation-system.git
cd job-recommendation-system

2. Database Setup

# Start MySQL server
# Create database and user
mysql -u root -p

# Run the initialization script
mysql -u root -p < scripts/init-database.sql

3. Redis Setup

# Start Redis server
redis-server

# Test Redis connection
redis-cli ping

4. Environment Configuration

Run the setup script to configure environment variables:

# Windows
scripts\setup-env.bat

# Or manually set environment variables:
set DB_HOST=localhost
set DB_PORT=3306
set DB_NAME=jobrec
set DB_USERNAME=admin
set DB_PASSWORD=your_password
set REDIS_HOST=localhost
set REDIS_PORT=6379
set REDIS_PASSWORD=your_redis_password
set SERPAPI_KEY=your_serpapi_key
set EDENAI_KEY=your_edenai_key
set APP_ENVIRONMENT=dev

5. Build the Application

mvn clean compile package

6. Deploy to Tomcat

# Copy WAR file to Tomcat webapps directory
cp target/JobSearch-1.0-SNAPSHOT.war $TOMCAT_HOME/webapps/jobrec.war

# Start Tomcat
$TOMCAT_HOME/bin/startup.sh  # Linux/Mac
# or
%TOMCAT_HOME%\bin\startup.bat  # Windows

βš™οΈ Configuration

Application Properties

The application supports environment-specific configuration:

  • application.properties - Default configuration
  • application-dev.properties - Development environment
  • application-prod.properties - Production environment

Key Configuration Options

# Database Configuration
db.host=localhost
db.port=3306
db.name=jobrec
db.username=admin

# Redis Configuration
redis.host=localhost
redis.port=6379
redis.ttl=60

# Search Configuration
search.default.keyword=engineer
search.results.limit=20
search.cache.enabled=true

# Logging Configuration
logging.level=INFO
logging.file.enabled=true
logging.console.enabled=true

🎯 Usage

Web Interface

  1. Access the Application: Navigate to http://localhost:8080/jobrec

  2. User Registration:

    • Click "New User? Register"
    • Fill in username, password, first name, and last name
    • Click "Register"
  3. Login:

    • Enter your username and password
    • Click "Login"
  4. Search for Jobs:

    • The system will use your browser's geolocation
    • Browse nearby job listings
    • Use the search functionality for specific keywords
  5. Manage Favorites:

    • Click the heart icon to favorite/unfavorite jobs
    • View your favorites in the "My Favorites" section
  6. Get Recommendations:

    • Click "Recommendation" to see personalized job suggestions
    • Recommendations are based on your favorite jobs and keywords

Sample Users

The database comes with pre-configured test users:

Username Password Description
admin password123 Administrator account
john_doe password123 Sample user with favorites
jane_smith password123 Sample user with applications
test_user password123 Basic test user

πŸ“š API Documentation

Authentication Endpoints

POST /login

Authenticate user and create session.

Request:

{
    "user_id": "john_doe",
    "password": "password123"
}

Response:

{
    "result": "SUCCESS",
    "name": "John Doe"
}

POST /register

Register a new user account.

Request:

{
    "user_id": "new_user",
    "password": "secure_password",
    "first_name": "John",
    "last_name": "Doe"
}

Response:

{
    "result": "Registration successful"
}

GET /logout

Logout user and invalidate session.

Response:

{
    "result": "Logout successful"
}

Job Search Endpoints

GET /search

Search for jobs based on location and keywords.

Parameters:

  • user_id (required): User identifier
  • lat (required): Latitude coordinate
  • lon (required): Longitude coordinate
  • keyword (optional): Search keyword

Example:

GET /search?user_id=john_doe&lat=37.7749&lon=-122.4194&keyword=software engineer

Response:

[
    {
        "id": "job_12345",
        "title": "Senior Software Engineer",
        "company_name": "TechCorp Inc.",
        "location": "San Francisco, CA",
        "description": "Develop and maintain web applications...",
        "url": "https://example.com/job/12345",
        "keywords": ["Java", "Spring Boot", "REST API"],
        "favorite": false
    }
]

Favorites Management

POST /history

Add or remove job from favorites.

Request:

{
    "user_id": "john_doe",
    "favorite": [
        {
            "item_id": "job_12345",
            "favorite": true
        }
    ]
}

Response:

{
    "result": "SUCCESS"
}

GET /history

Get user's favorite jobs.

Parameters:

  • user_id (required): User identifier

Response:

[
    {
        "id": "job_12345",
        "title": "Senior Software Engineer",
        "company_name": "TechCorp Inc.",
        "location": "San Francisco, CA",
        "url": "https://example.com/job/12345",
        "keywords": ["Java", "Spring Boot"],
        "favorite": true
    }
]

Recommendations

GET /recommendation

Get personalized job recommendations.

Parameters:

  • user_id (required): User identifier
  • lat (required): Latitude coordinate
  • lon (required): Longitude coordinate

Response:

[
    {
        "id": "job_67890",
        "title": "Java Developer",
        "company_name": "DevCorp",
        "location": "San Francisco, CA",
        "description": "Work with Java and Spring framework...",
        "url": "https://example.com/job/67890",
        "keywords": ["Java", "Spring"],
        "favorite": false
    }
]

πŸ’» Development

Project Structure

job-recommendation-system/
β”œβ”€β”€ Source Code/
β”‚   β”œβ”€β”€ Backend/
β”‚   β”‚   β”œβ”€β”€ config/           # Configuration management
β”‚   β”‚   β”œβ”€β”€ db/              # Database connections
β”‚   β”‚   β”œβ”€β”€ entity/          # Data models
β”‚   β”‚   β”œβ”€β”€ exception/       # Custom exceptions
β”‚   β”‚   β”œβ”€β”€ external/        # External API clients
β”‚   β”‚   β”œβ”€β”€ recommendation/  # Recommendation algorithms
β”‚   β”‚   β”œβ”€β”€ servlet/         # HTTP request handlers
β”‚   β”‚   β”œβ”€β”€ test/           # Unit tests
β”‚   β”‚   └── util/           # Utility classes
β”‚   β”œβ”€β”€ Frontend/
β”‚   β”‚   β”œβ”€β”€ scripts/        # JavaScript files
β”‚   β”‚   β”œβ”€β”€ styles/         # CSS files
β”‚   β”‚   β”œβ”€β”€ WEB-INF/        # Web configuration
β”‚   β”‚   └── index.jsp       # Main page
β”‚   └── resources/          # Configuration files
β”œβ”€β”€ scripts/                # Setup and deployment scripts
β”œβ”€β”€ pom.xml                # Maven configuration
└── README.md              # This file

Code Style Guidelines

  • Java: Follow Oracle Java Code Conventions
  • Comments: Use English for all code comments and documentation
  • Naming: Use descriptive names for classes, methods, and variables
  • Error Handling: Use structured exception handling with proper logging
  • Security: Validate and sanitize all user inputs

Adding New Features

  1. Create Feature Branch:

    git checkout -b feature/new-feature-name
  2. Implement Feature:

    • Add necessary classes in appropriate packages
    • Include comprehensive error handling
    • Add logging statements
    • Write unit tests
  3. Test Thoroughly:

    mvn test
  4. Submit Pull Request:

    • Include description of changes
    • Reference any related issues
    • Ensure all tests pass

πŸ§ͺ Testing

Running Unit Tests

# Run all tests
mvn test

# Run specific test class
mvn test -Dtest=ValidationUtilTest

# Run tests with coverage
mvn test jacoco:report

Test Categories

  • Unit Tests: Test individual components in isolation
  • Integration Tests: Test component interactions
  • API Tests: Test HTTP endpoints
  • Database Tests: Test database operations

Test Data

The application includes comprehensive test data:

  • Sample users with different roles
  • Mock job listings with various attributes
  • Test scenarios for edge cases

πŸš€ Deployment

Development Deployment

  1. Configure Environment:

    export APP_ENVIRONMENT=dev
  2. Start Services:

    # Start MySQL
    sudo systemctl start mysql
    
    # Start Redis
    sudo systemctl start redis
    
    # Deploy to Tomcat
    mvn clean package
    cp target/*.war $TOMCAT_HOME/webapps/

Production Deployment

  1. Environment Setup:

    export APP_ENVIRONMENT=prod
    export DB_HOST=your-production-db-host
    export REDIS_HOST=your-production-redis-host
    # Set other production environment variables
  2. Security Configuration:

    • Use strong passwords for all accounts
    • Configure SSL/TLS certificates
    • Set up firewall rules
    • Enable database encryption
  3. Performance Optimization:

    • Configure connection pooling
    • Set appropriate cache TTL values
    • Monitor system resources
    • Set up load balancing if needed
  4. Monitoring:

    • Configure application logs
    • Set up health checks
    • Monitor database performance
    • Track API response times

Docker Deployment (Optional)

# Dockerfile example
FROM tomcat:9.0-jdk11-openjdk

# Copy WAR file
COPY target/JobSearch-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/jobrec.war

# Set environment variables
ENV DB_HOST=localhost
ENV REDIS_HOST=localhost

# Expose port
EXPOSE 8080

# Start Tomcat
CMD ["catalina.sh", "run"]

🀝 Contributing

We welcome contributions! Please follow these guidelines:

How to Contribute

  1. Fork the Repository
  2. Create Feature Branch: git checkout -b feature/amazing-feature
  3. Commit Changes: git commit -m 'Add amazing feature'
  4. Push to Branch: git push origin feature/amazing-feature
  5. Open Pull Request

Contribution Guidelines

  • Follow existing code style and conventions
  • Add tests for new functionality
  • Update documentation as needed
  • Ensure all tests pass
  • Write clear commit messages

Bug Reports

When reporting bugs, please include:

  • Detailed description of the issue
  • Steps to reproduce
  • Expected vs actual behavior
  • Environment information
  • Error logs if applicable

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • SerpAPI for providing job search data
  • EdenAI for AI-powered keyword extraction
  • Bootstrap for responsive UI components
  • Apache Tomcat for servlet container
  • MySQL for reliable data storage
  • Redis for high-performance caching

Made with ❀️ by Leo Ji

Last updated: December 2024

About

Intelligent job recommendation platform using Java + MySQL + Redis. Supports location-based search, AI keyword extraction, and personalized suggestions.

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published