Hello! Welcome to the Jobs API documentation. This project is a powerful and secure API for managing job postings and application processes, built with Node.js and Express.js.
This API allows users to register, log in, and then manage their own job listings (create, read, update, and delete).
β¨ View the Live Demo β¨
The API comes with an interactive Swagger UI that allows for easy testing and exploration of all endpoints.
Note: The image above shows a preview of the interactive Swagger documentation provided with the project.
A clean and modern landing page built using Tailwind CSS and a glassmorphism effect to showcase the API branding.
The landing page provides a professional introduction to the API, with links to the docs and a stylish animated header.
A user-friendly 404 page for unmatched routes, keeping the user experience consistent and visually appealing.
This page appears when users try to access non-existent routes in the frontend or API β fully customized and styled to match the overall theme.
To see the complete list of endpoints, required parameters, and to test the API directly, please visit our interactive documentation built with Swagger UI:
β‘οΈ Link to Interactive API Docs
This project was built using the latest and most popular technologies in the Node.js ecosystem:
- Core Framework: Express.js
- Database: MongoDB with Mongoose for object data modeling
- Authentication: JSON Web Tokens (JWT) for secure user sessions
- Security:
bcrypt.js
: For secure password hashinghelmet
: To secure HTTP headerscors
: To enable Cross-Origin Resource Sharingxss-clean
: To prevent Cross-Site Scripting (XSS) attacksexpress-rate-limit
: To limit repeated requests and prevent brute-force attacks
- Documentation: Swagger UI
- Error Handling: Custom middleware for handling 404 and 500 errors
The file and folder structure is designed for easy readability and maintainability:
JOBS-API/
βββ controllers/
β βββ auth.js
β βββ jobs.js
βββ db/
β βββ connect.js
βββ errors/
β βββ bad-request.js
β βββ custom-api.js
β βββ index.js
β βββ not-found.js
β βββ unauthenticated.js
βββ middleware/
β βββ authentication.js
β βββ error-handler.js
β βββ not-found.js
βββ models/
β βββ Job.js
β βββ User.js
βββ public/
β βββ 404.html
β βββ index.html
βββ routes/
β βββ auth.js
β βββ jobs.js
βββ .env
βββ .gitignore
βββ app.js
βββ package.json
βββ swagger.yaml
Follow these steps to set up and run the project on your local machine.
- Node.js (version 14 or higher)
- An running instance of MongoDB (you can use a local community edition or a free cluster on MongoDB Atlas).
-
Clone the repository:
git clone [https://github.com/your-username/jobs-api.git](https://github.com/your-username/jobs-api.git)
-
Navigate to the project directory:
cd jobs-api
-
Install dependencies:
npm install
-
Create an environment variables file (
.env
): Create a file named.env
in the project's root directory and add the following values:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_super_long_and_random_jwt_secret JWT_LIFETIME=30d
-
Run the application:
npm start
Your server should now be running at http://localhost:3000
(or whichever port you define in your .env
file).
This project uses environment variables to manage sensitive information:
MONGO_URI
: The connection string for your MongoDB database.JWT_SECRET
: A long, random secret key for signing JWTs.JWT_LIFETIME
: The expiration time for tokens (e.g.,30d
,24h
,1h
).
POST /api/v1/auth/register
: Register a new userPOST /api/v1/auth/login
: Log in and receive a token
GET /api/v1/jobs
: Get a list of all jobs for the authenticated userPOST /api/v1/jobs
: Create a new jobGET /api/v1/jobs/:id
: Get information for a specific jobPATCH /api/v1/jobs/:id
: Update a job's informationDELETE /api/v1/jobs/:id
: Delete a job
This project is distributed under the MIT License. See the LICENSE
file for more information.
Built with β€οΈ and code.