A full-featured Job Portal backend built using Node.js, Express, and MongoDB, with robust API documentation using Swagger.
🔧 Tech Stack
-
Backend Framework: Express.js
-
Database: MongoDB with Mongoose
-
Authentication: JWT (JSON Web Token)
-
Security & Utilities:
bcryptjs for password hashing
cors, helmet, express-rate-limit, express-mongo-sanitize for security
morgan for logging
API Documentation: Swagger (swagger-jsdoc, swagger-ui-express)
📁 Project Structure
JOB-PORTAL/
├── config/
│ └── db.js # MongoDB connection
├── controllers/
│ └── *.js # Route logic
├── middlewares/
│ └── errorMiddleware.js
├── models/
│ └── *.js # Mongoose schemas
├── routes/
│ └── authRoutes.js # Auth APIs
│ └── jobsRoutes.js # Job management APIs
│ └── userRoutes.js # User APIs
│ └── testRoutes.js
├── utils/
│ └── *.js # Utility functions
├── jobs-data.json # Sample jobs data
├── server.js # Entry point
├── .env # Environment variables
└── package.json
🚀 Getting Started
- Clone the Repository
git clone https://github.com/your-username/job-portal-backend.git
cd job-portal-backend/JOB-PORTAL
- Install Dependencies
npm install
- Set Up Environment Variables Create a .env file in the root directory:
PORT=8080
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
- Run the Server
npm run server
Server will start at: http://localhost:8080
📘 API Documentation Once the server is running, access the Swagger UI at:
👉 http://localhost:8080/api-doc
🔐 Features ✅ User Registration & Login (JWT based)
✅ Role-based access (Admin/User)
✅ Create, Update, Delete, and Filter Jobs
✅ Swagger UI for live API testing
✅ Validation and error handling
✅ Security middleware integrated
🧪 Sample Routes 1)POST /api/v1/auth/register – Register user
2)POST /api/v1/auth/login – Login user
3)POST /api/v1/job/create-job – Create job (auth required)
4)GET /api/v1/job/get-jobs – Fetch jobs
5)PUT /api/v1/job/update-job/:id – Update job
6)DELETE /api/v1/job/delete-job/:id – Delete job
https://jobportal-nodejs-project.onrender.com/api-doc/
✨ Author Aastha