RESTful API built with Express.js, MongoDB, and Socket.io for a modern job search platform
JobHuntly Backend is a robust, scalable REST API that powers the JobHuntly job search platform. Built with Express.js and MongoDB, it provides comprehensive endpoints for job management, user authentication, application tracking, real-time notifications, and payment processing.
π Related Repositories:
- Frontend Application - React + TypeScript
- Admin Dashboard - Next.js Admin Panel
- π Authentication & Authorization - JWT-based auth with role-based access control
- π€ User Management - Job seekers, recruiters, and admin roles
- πΌ Job CRUD Operations - Complete job posting and management system
- π Application System - Job application submission and tracking
- π’ Company Profiles - Company information and branding management
- π Real-time Notifications - Socket.io powered instant updates
- π³ Payment Integration - Stripe for premium subscriptions
- π§ Email Service - Nodemailer for verification and notifications
- π File Upload - Multer for resume and document handling
- π‘οΈ Security - bcrypt password hashing, JWT tokens, input validation
- Auth - Registration, login, password reset, email verification
- Jobs - CRUD operations, filtering, search, recommendations
- Applications - Submit, track, update application status
- Companies - Profile management, job listings
- Applicants - Profile, resume, application history
- Admin - User management, platform analytics
- Notifications - Real-time updates via WebSocket
- Stripe - Payment processing and subscription management
- Settings - User preferences and account settings
- Skills - Skill management and matching
- Express.js 5.2.1 - Fast, minimalist web framework
- MongoDB 9.0.0 (Mongoose) - NoSQL database with ODM
- Socket.io 4.8.3 - Real-time bidirectional communication
- Node.js 18+ - JavaScript runtime
- bcrypt 6.0.0 - Password hashing
- jsonwebtoken 9.0.3 - JWT token generation/verification
- crypto-js 4.2.0 - Encryption utilities
- cors 2.8.5 - Cross-origin resource sharing
- Joi 18.0.2 - Schema validation
- Nodemailer 7.0.11 - Email sending service
- Multer 2.0.2 - Multipart/form-data file uploads
- Stripe 20.1.0 - Payment processing
- Nodemon 3.1.11 - Auto-restart during development
- dotenv 17.2.3 - Environment variable management
- Node.js 18 or higher
- MongoDB (local or Atlas)
- npm or yarn
- Clone the repository
git clone https://github.com/shehabgamaleldeen/JobHuntly-Backend.git
cd JobHuntly-Backend- Install dependencies
npm install- Environment Configuration
Create a .env file in the root directory:
# Server Configuration
PORT=3000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/jobhuntly
# OR for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/jobhuntly
# JWT Secrets
JWT_SECRET=your_super_secret_jwt_key_here
JWT_REFRESH_SECRET=your_refresh_token_secret_here
JWT_EXPIRES_IN=7d
# Email Configuration (Nodemailer)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-app-specific-password
# Stripe
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:5173
ADMIN_URL=http://localhost:3001
# File Upload
MAX_FILE_SIZE=5242880
UPLOAD_PATH=./uploads- Run the server
# Development mode with auto-restart
npm run dev
# Production mode
npm startThe API will be available at http://localhost:3000
npm start # Run server in production
npm run dev # Run with nodemon (auto-restart)
npm run watch # Run with Node.js --watch flagsrc/
βββ Config/ # Configuration files
β βββ database.js # MongoDB connection
βββ DB/
β βββ Models/ # Mongoose schemas
β βββ UserModel.js
β βββ JobModel.js
β βββ ApplicationModel.js
β βββ CompanyModel.js
βββ Middlewares/ # Express middlewares
β βββ auth.middleware.js
β βββ validation.middleware.js
β βββ upload.middleware.js
βββ Modules/ # Feature modules
β βββ auth/ # Authentication
β βββ job/ # Job operations
β βββ applicant/ # Applicant features
β βββ company/ # Company management
β βββ jobApplications/ # Application handling
β βββ admin/ # Admin operations
β βββ notification/ # Real-time notifications
β βββ Stripe/ # Payment processing
β βββ settings/ # User settings
β βββ Skills/ # Skill management
β βββ upload/ # File uploads
βββ Utils/ # Utility functions
β βββ routerHandler.utils.js
β βββ validation.utils.js
βββ Main.js # Application entry point
POST /api/auth/register # Register new user
POST /api/auth/login # User login
POST /api/auth/verify-email # Email verification
POST /api/auth/forgot-password # Request password reset
POST /api/auth/reset-password # Reset password
POST /api/auth/refresh-token # Refresh JWT token
GET /api/jobs # Get all jobs (with filters)
GET /api/jobs/:id # Get single job
POST /api/jobs # Create job (recruiter only)
PUT /api/jobs/:id # Update job (recruiter only)
DELETE /api/jobs/:id # Delete job (recruiter only)
GET /api/jobs/search # Search jobs
GET /api/jobs/recommended # Get recommended jobs
GET /api/applications # Get user applications
POST /api/applications # Submit application
GET /api/applications/:id # Get application details
PUT /api/applications/:id # Update application status
DELETE /api/applications/:id # Withdraw application
GET /api/companies # Get all companies
GET /api/companies/:id # Get company profile
PUT /api/companies/:id # Update company (recruiter only)
GET /api/companies/:id/jobs # Get company jobs
GET /api/admin/users # Get all users
PUT /api/admin/users/:id # Update user status
GET /api/admin/analytics # Platform analytics
DELETE /api/admin/users/:id # Delete user
POST /api/stripe/create-checkout # Create payment session
POST /api/stripe/webhook # Stripe webhook handler
GET /api/stripe/subscription # Get subscription status
Socket Events:
- connection # Client connects
- notification:new # New notification
- application:status # Application status update
- disconnect # Client disconnects
- User registers β Email verification sent
- User verifies email β Account activated
- User logs in β JWT access token + refresh token returned
- Client includes token in
Authorization: Bearer <token>header - Protected routes validate JWT via middleware
- Token expires β Use refresh token to get new access token
{
email: String (unique),
password: String (hashed),
role: Enum ['applicant', 'recruiter', 'admin'],
profile: Object,
isVerified: Boolean,
isPremium: Boolean,
createdAt: Date
}{
title: String,
company: ObjectId (ref: Company),
description: String,
requirements: [String],
salary: { min: Number, max: Number },
location: String,
type: Enum ['full-time', 'part-time', 'contract'],
status: Enum ['active', 'closed'],
createdAt: Date
}{
job: ObjectId (ref: Job),
applicant: ObjectId (ref: User),
resume: String (file path),
status: Enum ['pending', 'reviewed', 'accepted', 'rejected'],
answers: [Object],
appliedAt: Date
}- Password Hashing - bcrypt with salt rounds
- JWT Authentication - Secure token-based auth
- Input Validation - Joi schema validation
- CORS Protection - Configured allowed origins
- Rate Limiting - Prevent brute force attacks
- SQL Injection Prevention - Mongoose parameterized queries
- XSS Protection - Input sanitization
- File Upload Validation - Type and size restrictions
The backend implements WebSocket connections for:
- New job application notifications
- Application status updates
- New job postings matching user preferences
- System announcements
Automated emails sent via Nodemailer:
- Welcome email
- Email verification
- Password reset
- Application confirmation
- Application status updates
- Premium subscription confirmation
# Run tests (if configured)
npm testEnsure all environment variables are configured in your hosting platform.
- Heroku - Easy deployment with MongoDB Atlas
- Railway - Modern deployment platform
- DigitalOcean - VPS with full control
- AWS EC2 - Scalable cloud hosting
- Set
NODE_ENV=production - Use MongoDB Atlas or managed database
- Configure CORS for production domains
- Set up SSL/TLS certificates
- Enable rate limiting
- Configure logging and monitoring
- Set up automated backups
This is a capstone project for the NTI Full-Stack Development Program. Contributions are welcome!
Shehab Gamal El-Deen
- GitHub: shehabgamaleldeen
- LinkedIn: Shehab Gamal El-Deen
This project is part of the NTI Open-Source Applications Developer Program.
- National Telecommunication Institute (NTI)
- Open-Source Applications Developer Program
- All team members and instructors
β If you find this project helpful, please give it a star!