Skip to content

A RESTful API for managing job applications, built with Node.js, Express, and MongoDB. Includes JWT-based authentication and full CRUD functionality. βš™οΈπŸš€

License

Notifications You must be signed in to change notification settings

ShayanBlaze/jobs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Jobs API

License: MIT Made with: Node.js Documentation: Swagger UI

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 ✨


πŸ“˜ API Documentation (Swagger UI)

The API comes with an interactive Swagger UI that allows for easy testing and exploration of all endpoints.

Swagger UI Demo

Note: The image above shows a preview of the interactive Swagger documentation provided with the project.


🎨 Landing Page

A clean and modern landing page built using Tailwind CSS and a glassmorphism effect to showcase the API branding.

Landing Page Screenshot

The landing page provides a professional introduction to the API, with links to the docs and a stylish animated header.


🚫 Custom 404 Page

A user-friendly 404 page for unmatched routes, keeping the user experience consistent and visually appealing.

404 Page Screenshot

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.


πŸ“š Full API Documentation

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


πŸ› οΈ Tech Stack

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 hashing
    • helmet: To secure HTTP headers
    • cors: To enable Cross-Origin Resource Sharing
    • xss-clean: To prevent Cross-Site Scripting (XSS) attacks
    • express-rate-limit: To limit repeated requests and prevent brute-force attacks
  • Documentation: Swagger UI
  • Error Handling: Custom middleware for handling 404 and 500 errors

πŸ“‚ Project Structure

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

🏁 Getting Started & Local Setup

Follow these steps to set up and run the project on your local machine.

Prerequisites

  • 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).

Installation Steps

  1. Clone the repository:

    git clone [https://github.com/your-username/jobs-api.git](https://github.com/your-username/jobs-api.git)
  2. Navigate to the project directory:

    cd jobs-api
  3. Install dependencies:

    npm install
  4. 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
  5. Run the application:

    npm start

Your server should now be running at http://localhost:3000 (or whichever port you define in your .env file).


πŸ”‘ Environment Variables

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).

πŸ—ΊοΈ API Endpoints Overview

Authentication (Auth)

  • POST /api/v1/auth/register: Register a new user
  • POST /api/v1/auth/login: Log in and receive a token

Jobs Management (Jobs) - Protected

  • GET /api/v1/jobs: Get a list of all jobs for the authenticated user
  • POST /api/v1/jobs: Create a new job
  • GET /api/v1/jobs/:id: Get information for a specific job
  • PATCH /api/v1/jobs/:id: Update a job's information
  • DELETE /api/v1/jobs/:id: Delete a job

πŸ“„ License

This project is distributed under the MIT License. See the LICENSE file for more information.


Built with ❀️ and code.

About

A RESTful API for managing job applications, built with Node.js, Express, and MongoDB. Includes JWT-based authentication and full CRUD functionality. βš™οΈπŸš€

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published