Code Monkey home page Code Monkey logo

car-listing-marketplace's Introduction

car-listing-marketplace

Welcome to the Car Listing Marketplace service!

The Car Listing Marketplace service is built with NodeJS and ExpressJS. It leverages a PostgreSQL database with Sequelize as the ORM to provide a robust and scalable solution. Key features of the server include:

  • User Authentication: JWT is employed for secure user authentication, ensuring the safety of user credentials. Tokens expire after 30 days.
  • User Sessions: Cookies are used to manage user sessions.
  • Password Security: User passwords are salted and hashed.
  • Default Admin User: The app comes pre-configured with a default admin user account (username: [email protected] and password: Admin@123).
  • Search/Filter and Pagination Support: API supports search and filter capabilities for cars, including pagination.
  • Booking Integration: Car listings dynamically reflect whether a car has been booked by someone, displaying relevant booking dates.

Live Service URL

This service has been hosted in a free tier platform.

https://car-marketplace.onrender.com/api/v1/<resource>

Getting Started

Please follow the below steps to run the service.

  1. Install Git & Node & Docker and Docker Compose

  2. Clone the Repository

    git clone https://github.com/sajithaliyanage/car-listing-marketplace.git
    cd car-listing-marketplace
  3. Import postman collection

Run Server in Docker Environment

  1. Run docker compose

    docker-compose -f docker-compose.yml up --build
  2. Use postman defined endpoints to access services

Run Server Locally

  1. Start Postgress server locally

    docker run -d --name marketplace-postgres -e POSTGRES_PASSWORD=admin -e POSTGRES_USER=postgres -e POSTGRES_DB=car_marketplace -p 5432:5432 postgres:latest
  2. Install dependencies

    cd api
    npm install
  3. Run server

    npm run dev
  4. Use postman defined endpoints to access services

API Specification

Auth

  • POST /api/v1/auth/signin:

    • Purpose: Login with credentials.
  • POST /api/v1/auth/signup:

    • Purpose: Register new users.
  • GET /api/v1/auth/signout:

    • Purpose: Logout.

Users

  • GET /api/v1/users:

    • Purpose: Get all users (admin only).
  • PATCH /api/v1/users/:userId/mark-as-admin:

    • Purpose: Make a user an admin (admin only).

Cars

  • POST /api/v1/cars:

    • Purpose: Add cars to the listing (admin only).
  • GET /api/v1/cars:

    • Purpose: Search and filter cars with pagination.
    • Query Parameters:
      • search[brand]=<>
      • search[model]=<>
      • filter[color]=<>
      • filter[year]=<>
      • filter[minPrice]=<>
      • filter[maxPrice]=<>
      • filter[minMileage]=<>
      • filter[maxMileage]=<>
      • filter[minYear]=<>
      • filter[maxYear]=<>
      • page=<>
      • limit=<>
  • GET /api/v1/cars/:carId:

    • Purpose: Get car details by ID.

Booking

  • POST /api/v1/bookings:

    • Purpose: Make a car booking for a specific date if the car is available.
  • GET /api/v1/bookings/:referenceNumber:

    • Purpose: Get a booking by reference number.
  • DELETE /api/v1/bookings/:referenceNumber:

    • Purpose: Cancel a booking if made not less than 24 hours ago.

car-listing-marketplace's People

Contributors

sajithaliyanage avatar

Watchers

Marouf Alarnaout avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.