Skip to content

Simple eCommerce API built using NodeJS, Express and MongoDB.

Notifications You must be signed in to change notification settings

3laaHisham/MarketNexus-API

Repository files navigation

MarketNexus-API

NodeJS Express.js MongoDB Git Postman Redis JWT

An eCommerce Restful API built using NodeJS, Express and MongoDB. It introduces a flexible solution for managing an online store's backend operations. The API provides endpoints for creating, reading, updating, and deleting products, as well as for processing orders and managing customer information.

Usage

Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos (Postman) work well in this space. You may also link to more resources.

Postman Documentation

API Endpoints

Authentication Services:

  • POST /auth/login : Login with user credentials. [Public]
  • POST /auth/signup : Sign up and create a new user account. [Public]
  • POST /auth/logout : Logout of the session. [User]
  • PUT /auth/change-password : Change the password. [User]

User Services:

  • GET /users/:id : Get user details by ID. [Public]
  • GET /users/search : Query all users by name, email, phone, role. [Public]
  • GET /users/me : Get details of this user. [User]
  • PUT /users/me : Update details of this user. [User]
  • DELETE /users/me : Delete account of this user. [User]
  • DELETE /users/:id : Delete this user by ID. [Admin]

Product Services:

  • GET /products/:id : Get product details by ID. [Public]
  • GET /products/search : Query products by: search term (name, description), category, price, rate. [Public]
  • GET /products/top-cheapest : Get the top 5 cheapest products by category. [Public]
  • GET /products/top-rated : Get the top-rated products by category. [Public]
  • GET /products/most-sold : Get the most sold products by category. [Public]
  • POST /products/ : Create a new product. [Seller]
  • PUT /products/:id : Update product details by ID. [Seller]
  • DELETE /products/:id : Delete product by ID. [Seller]

Review Services:

  • GET /reviews/:id : Get review details by ID. [Public]
  • POST /reviews/:productId : Create a new review on product by id. [User]
  • PUT /reviews/:id : Update review by ID. [User]
  • DELETE /reviews/:id : Delete review by ID. [User]

Cart Services:

  • GET /cart : Get cart details. [User]
  • POST /cart/products : Add a product to the cart. [User]
  • PUT /cart/products/:id/increase : Increase the quantity of a product in the cart by one. [User]
  • PUT /cart/products/:id/reduce : Reduce the quantity of a product in the cart by one. [User]
  • DELETE /cart/products/:id : Delete a product from the cart. [User]
  • DELETE /cart/ : Empty the entire cart. [User]

Order Services:

  • GET /orders/:id : Get order by id. [User]
  • GET /orders/ : Query orders by date. [User]
  • POST /orders/ : Create a new order. [User]
  • PUT /orders/:id/cancel : Cancel an order. [User]
  • PUT /orders/:id/status : Update order status. [Admin]

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

NodeJS & MongoDB should be installed on your machine.

Installation

  1. Clone the repo & navigate to the folder.
    git clone https://github.com/3laaHisham/MarketNexus-API.git && cd MarketNexus-API
  2. Install NPM packages & create an .env file and supply it with variables from .env.sample and values on your own.
    npm install && copy .evn.sample .env
  3. Run the project.
    npm start

Roadmap

  • Registeration, Login, Logout, Change Password.
  • User Management.
  • Product, Review Service.
  • Cart Service.
  • Order Service via Stripe.
  • Tests.
  • Security.
    • Authentication & Authorization.
    • Protection against Cross-Origin attacks (XSS & CSRF).
    • Encryption.
  • Caching & Tokens.
  • API Features (Filters, Sorting, Limit, Pagination & Full Text Search).
  • CI/CD.
  • Documentation.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Acknowledgments

This Project was inspired by these awesome open source APIs.