Skip to content

hammadsadi/bi-cycle-store

Repository files navigation

🚲 Bicycle Store API

A Node.js, Express.js and MongoDB based API designed to manage a bicycle store. The API enables Admin can Create Bicycle and Manage and users can Create Account place orders and Complete Payment using ShurjoPay.

🚀 Features

  1. Order Bicycles: Users can place orders with Product id and Quantity. Total Price and User Info Automatically Calculate and Added from Backend.
  2. Payment System: User Can pay Using ShurjoPay Payment Gateway.
  3. Profile Manage: User Can Create and Update Personal Profile Information.

🛠️ Installation and Setup

Follow these steps to set up the project locally:

  1. Clone the repository:

    git clone <repository-url>
    cd <project-folder>

2.Install the required dependencies:

npm install
  1. Create a .env file in the root directory and configure the following environment variables:
 PORT=5000
MONGODB_URL=<your-mongodb-url>
NODE_ENV=<deployment>
BCRYPT_SALT_ROUNDS=<bcrypt_salt_number>
JWT_ACCESS_TOKEN_SECRET=<jwt_access_token_secret>
JWT_ACCESS_EXPIRES_IN=<jwt_access_experies_in>
SP_ENDPOINT=<shurjo_pay_sp_end_point>
SP_USERNAME=<shurjo_pay_sp_username>
SP_PASSWORD=<shurjo_pay_sp_password>
SP_PREFIX=<shurjo_pay_sp_prefix>
SP_RETURN_URL=<shurjo_pay_sp_return_url>
DB_FILE=<shurjo_pay_db_file>
  1. Start the server:
 npm run start:dev
  1. The API will be available at
http://localhost:5000

📚 API Endpoints

Product Endpoints

  1. Create a Bicycle Method: POST

URL:

/api/v1/bicycle

Description: Add a new bicycle to the database.

  1. Get All Bicycles Method: GET URL:
/api/v1/bicycle

Description: Retrieves All bicycles. Optional search by type using the searchTerm query parameter by brand, bicycle name, or category and Filters for price range, model, brand, category, and availability.

  1. Get a Single Bicycle Method: GET URL:
/api/v1/bicycle/:productId

Description: Fetch details of a specific bicycle by ID.

  1. Update a Bicycle Method: PATCH URL:
/api/v1/bicycle/:productId

Description: Admin Can Updates the details of a specific bicycle by ID.

  1. Delete a Bicycle Method: DELETE URL:
/api/v1/bicycle/:productId

Description: Deletes a bicycle by ID.

Order Endpoints

  1. Place an Order Method: POST URL:
/api/v1/order/create

Description: User can Place an order for a bicycle.

  1. Update Oder Delivery Status Method: PATCH URL:
/api/v1/order/delivery/status/:orderId

Description: Admin Can Update a Order Delivery Status.

  1. Payment Verify Method: GET URL:
/api/v1/order/verify

Description: User Can Verify Payment.

  1. Get Loggedin user Order Method: GET URL:
/api/v1/order/all

Description: User Can See All Orders.

  1. All Orders Method: GET URL:
/api/v1/order/all-orders

Description: Get All Orders For Admin.

  1. Delete Orders Method: DELETE URL:
/api/v1/order/delete/:orderId

Description: Admin Can Delete Any Orders.

User Endpoints

  1. Create User Method: POST URL:
/api/v1/user

Description: User can Create Account.

  1. Get All User Method: GET URL:
/api/v1/user

Description:Get All User From DB.

  1. User Status Update Method: PATCH URL:
/api/v1/user/update

Description: Admin Can Update User Status.

Auth Endpoints

  1. Login User Method: POST URL:
/api/v1/auth/login

Description: User can Login.

  1. Update User Profile Info Method: PATCH URL:
/api/v1/auth/update

Description: User can Update Profile Info.

  1. Get Logged in User Info Method: GET URL:
/api/v1/auth/me

Description: User can Get Profile Info.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published