This project is a job alerts automation system that processes job postings, matches them with user profiles, and sends personalized job alerts.
-
Clone the repository
-
Install dependencies:
npm install -
Set up environment variables: Create a
.envfile in the root directory and add the following variables:EXPRESS_API_PORT=3000 NODE_ENV=development LOG_LEVEL=info JWT_SECRET=your_jwt_secret MONGODB_URI=your_mongodb_connection_string AZURE_STORAGE_CONNECTION_STRING=your_azure_storage_connection_string EXPRESS_GEMINI_API_KEY_2=your_gemini_api_key EMAIL_USER=your_email_address EMAIL_PASS=your_email_passwordReplace the placeholder values with your actual credentials.
-
Set up Azure Blob Storage:
- Create a container named 'resume' in your Azure Blob Storage account.
-
Set up MongoDB:
- Ensure you have a MongoDB instance running and update the
MONGODB_URIin the.envfile.
- Ensure you have a MongoDB instance running and update the
To start the server:
npm start
For development with auto-restart:
npm run watch
server.js: Main entry pointapp.js: Express application setupconfig/: Configuration filescontrollers/: Request handlersmiddleware/: Custom middleware functionsmodels/: Database modelsservices/: Business logicutils/: Utility functions
- User registration and authentication
- Job posting processing and extraction
- Job matching algorithm using Google's Generative AI
- Automated job alerts via email
- POST
/api/user/register: User registration - POST
/api/user/login: User login - GET
/api/user/process-job-alerts: Process job alerts for authenticated user
The system runs a cron job every 3 hours to process unextracted job posts:
cron.schedule('0 */3 * * *', async () => {
console.log('Running job alerts');
processUnextractedJobPosts.catch(error => {
logger.error('Error in processUnextractedJobPosts:', error);
})
});The project uses a custom error handler middleware:
const logger = require('../utils/logger');
module.exports = (err, req, res, next) => {
logger.error(err.stack);
if (err.name === 'ValidationError') {
return res.status(400).json({ message: err.message });
}
if (err.name === 'UnauthorizedError') {
return res.status(401).json({ message: 'Invalid token' });
}
res.status(500).json({ message: 'Something went wrong' });
};Winston is used for logging. Logs are stored in error.log and combined.log files.
Ensure all environment variables in the .env file are properly set before running the application.
Key dependencies include:
- Express
- Mongoose
- @azure/storage-blob
- @google/generative-ai
- node-cron
- nodemailer
- winston
For a full list of dependencies, refer to the package.json file.
This project uses Google's Generative AI for job matching. Ensure you have the necessary API key and permissions set up.