{"id":19316901,"url":"https://github.com/pushpendra-1697/ecommerce-api","last_synced_at":"2026-04-12T15:02:01.942Z","repository":{"id":183453126,"uuid":"670160570","full_name":"Pushpendra-1697/Ecommerce-API","owner":"Pushpendra-1697","description":"This project will deliver a comprehensive e-commerce API set that enables seamless product and category management, user authentication, secure cart management, and order processing. The integration of Mongodb as the database and token management system ensures efficient data storage and user authentication with minimal server-side setup.","archived":false,"fork":false,"pushed_at":"2023-08-02T17:00:59.000Z","size":117,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-06T04:13:02.299Z","etag":null,"topics":["bcrypt","bson","cors","dotenv","express-rate-limit","expressjs","http","ip","jsonwebtoken","model","mongodb","mongoose","nodejs","nodemon","relationships","schema","thunder-client","token-based-authentication"],"latest_commit_sha":null,"homepage":"https://ecommerce-api-ao7n.onrender.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pushpendra-1697.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-24T12:29:13.000Z","updated_at":"2024-09-01T11:52:20.000Z","dependencies_parsed_at":"2024-11-10T01:13:09.705Z","dependency_job_id":"c7f1c3e4-30b1-403b-b453-7ed7e21f214c","html_url":"https://github.com/Pushpendra-1697/Ecommerce-API","commit_stats":null,"previous_names":["pushpendra-1697/ecommerce-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pushpendra-1697%2FEcommerce-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pushpendra-1697%2FEcommerce-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pushpendra-1697%2FEcommerce-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pushpendra-1697%2FEcommerce-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pushpendra-1697","download_url":"https://codeload.github.com/Pushpendra-1697/Ecommerce-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240420938,"owners_count":19798501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bcrypt","bson","cors","dotenv","express-rate-limit","expressjs","http","ip","jsonwebtoken","model","mongodb","mongoose","nodejs","nodemon","relationships","schema","thunder-client","token-based-authentication"],"created_at":"2024-11-10T01:13:03.065Z","updated_at":"2025-10-07T13:35:54.673Z","avatar_url":"https://github.com/Pushpendra-1697.png","language":"JavaScript","readme":"# E-commerce-API\n# Overview\nThis project will deliver a comprehensive e-commerce API set that enables seamless product and category management, user authentication, secure cart management, and order processing. The integration of MongoDB as the database and token management system ensures efficient data storage and user authentication with minimal server-side setup.\n\n## Live/deploy link on the render\nhttps://ecommerce-api-ao7n.onrender.com/\n\n## Installation \u0026 Tech Stack\n\nClone the Repository from GitHub. Then do the following steps:\n\n```bash\n    npm init -y\n\n    npm i express mongoose cors bcrypt dotenv jsonwebtoken nodemon express-rate-limit\n```\n## To run server (PORT = 8080)\n```bash\n    npm run server\n```\n\n## Some HTTP (Hyper Text Transfer Protocol) Status Code Which I used :\n     \n     200 ---\u003e  OK/Success/get/put\n\n     201 ---\u003e Created/post\n\n     202 ----\u003e Delete Successfully\n\n     204 ----\u003e Delete Failure\n\n     404 ---\u003e Not Found/failure\n\n### NOTE: Used Timestamps \u0026 Date datatypes which allow by BSON.\n\n## Database Name:\necommerce\n# Schema\n\n#### 1) *Users*:\n\nCollection Name: users\n\n- name --\u003e String\n\n- password --\u003e String\n\n#### 2) *products*:\n  Collection Name: products\n\n   - id: Number,\n  \n   - brand: String,\n  \n   - name: String,\n  \n   - price: Number,\n  \n   - price_sign: String,\n  \n   - image_link: String,\n  \n   - image_link1: String,\n  \n   - description: String,\n  \n   - rating: Number,\n  \n   - review: Number,\n  \n   - category: String,\n  \n   - product_type: String,\n  \n   - quantity: Number,\n\n#### 3) *carts*:\nCollection Name: carts\n\n  - userId: ObjectId as ref=user\n\n -  products: [{productId: ObjectId as ref=product, quantity: Number, default:1}]\n  \n - active: Boolean, default: true\n  \n - modifiedOn: Date, default: Date.now\n\n#### 4) *orders*:\nCollection Name: orders\n\n - userId: ObjectId as ref=user\n  \n - cartId: ObjectId as ref=cart\n  \n - status: Array\n  \n - currentStatus : String\n  \n - priceTotal: Number\n  \n - paymentMethod: String\n  \n - DeliveryAdress: String\n  \n - OrderDelivered: Boolean, default: false\n  \n - DeliveryDate: String,\n\n\n## NOTE: I used Thunder Client Extension for testing all REST APIs.\n\n### Routes / End Points tested by Thunder Client Extension :\n\n#### 1. */users/register*: (POST)\n\n###### Sample Input: \n\n name: \"Pushpendra Singh\"\n\n password: \"Push1697@\"\n \n##### Output: Success Message and data will store in MongoDB\n\n#### 2.  */users/login*: (POST)\n\nif you use the same existing details for login then you got the JWT token, Login Successfully Message and user_id\nelse you got Wrong Password || Wrong Username || Login failed (according to your wrong credential)\n\n##### Sample Input: \n\n name: \"Pushpendra Singh\"\n \n password: \"Push1697@\"\n \n##### Output: Success Message and JSON web token\n\n##### Sample Input: \n\n name: \"Pushpendra\"\n \n password: \"Push1697@\"\n \n##### Output: Wrong Username\n\n##### Sample Input: \n\n name: \"Pushpendra Singh\"\n \n password: \"Push\"\n \n##### Output: Wrong Password\n\n#### 3) */products/addProduct*: (POST)\n\n##### Sample Input:\n\n{\n  \"id\": 922,\n  \n  \"brand\": \"nyx\",\n  \n  \"name\": \"High Definition Blush Pro Refills\",\n  \n  \"price\": 6,\n  \n  \"price_sign\": \"₹\",\n  \n  \"image_link\": \"https://www.nyxcosmetics.com/dw/image/v2/AANG_PRD/on/demandware.static/-/Sites-cpd-nyxusa-master-catalog/default/dw587b93a7/ProductImages/Face/High_Definition_Pro_Blush_Refills/highdefinitionproblushrefills_main.jpg?sw=390\u0026sh=390\u0026sm=fit\",\n  \n  \"image_link1\": \"//s3.amazonaws.com/donovanbailey/products/api_featured_images/000/000/915/original/open-uri20171224-4-uv4oww?1514082622\",\n  \n  \"description\": \"Add a touch of color with our creamy and extremely pigmented Stick Blush! Available in eight rich shades! Apply and receive the perfect glow every day!\",\n  \n  \"rating\": 5,\n  \n  \"review\": 9,\n  \n  \"category\": \"concealer\",\n  \n  \"product_type\": \"blush\",\n  \n  \"quantity\": 5\n}\n\n##### Output: Success Message and data will store in MongoDB\n\n#### 4) */products/allProducts*: (GET)\n##### Output: Retrieves all products\n\n#### 5) */products/particularProduct/`${id}`*: (GET)\n##### output: Retrieves Particular products by id\n\n## NOTE:  For the Below routes pass the token from headers (Required)\n\n#### 6) */cart/addToCart: update quantities* --\u003e (POST)\nUsed for add to cart / Update quantities (default 1 quantity at first addToCart)\n\n##### Input Sample: \n  - productId:\"64be95a1f0dd493feb5c8210\",\n  -  \"qty\": 3\n##### Output:  \n{\n  \"msg\": \"Product added in cart\",\n  \"cart\": {\n    \"userId\": \"64be861288ff9ba7252aa32e\",\n    \"products\": [\n      {\n        \"productId\": \"64be95a1f0dd493feb5c8210\",\n        \"quantity\": 1,\n        \"_id\": \"64beab3bd64361dbbb125fa1\"\n      }\n    ],\n    \"active\": true,\n    \"_id\": \"64beab3bd64361dbbb125fa0\",\n    \"modifiedOn\": \"2023-07-24T16:47:55.609Z\",\n    \"createdAt\": \"2023-07-24T16:47:55.612Z\",\n    \"updatedAt\": \"2023-07-24T16:47:55.612Z\"\n  }\n}\n\n#### 7) */cart/deleteFromCart*: (DELETE)\n\n##### Input Sample: \n  - productId: \"64be95a1f0dd493feb5c8210\"\n  - cartId: \"64bebf684ac081d8292327a8\"\n\n##### Output: Particular Product will be deleted\n\n#### 8) */cart/fetchCartItems*: (GET)\nIt will populate all cart Items || Empty Cart\n\n## NOTE: Ignore Payment Gateway Methods API like Razorpay, Braintree, etc.\n\n#### 9) */order/orderPlaced*: (POST)\n\nUsed for orderconfirmed / Order Placement by particluar authenticated user\n\n##### Input Sample: \n\n  - cartId: \"64bebf684ac081d8292327a8\",\n  - priceTotal: 36, \n  - paymentMethod:\"Net Banking\",\n  - DeliveryAdress:\"Kanpur UP\"\n\n##### Output: \n\n{\n  \"msg\": \"OK\",\n  \"newOrder\": {\n    \"userId\": \"64be861288ff9ba7252aa32e\",\n    \"cartId\": \"64bebf684ac081d8292327a8\",\n    \"status\": [\n      \"orderconfirmed\"\n    ],\n    \"currentStatus\": \"orderconfirmed\",\n    \"priceTotal\": 36,\n    \"paymentMethod\": \"Net Banking\",\n    \"DeliveryAdress\": \"Kanpur UP\",\n    \"OrderDelivered\": false,\n    \"DeliveryDate\": \"29/07/2023\",\n    \"_id\": \"64bf4d78a141a7319b7aa1e7\",\n    \"createdAt\": \"2023-07-25T04:20:08.451Z\",\n    \"updatedAt\": \"2023-07-25T04:20:08.451Z\"\n  }\n}\n\n\n\n#### 10) */order/orderDetails* : (GET)\nUsed to get Order details of particular authenticated user by order ID.\n\n\n## NOTE: Some Extra Routes which is accessible by only role===admin\n\n#### 11) */order/orderHistory* : (GET)\n\nUsed to get all orders of authenticated users by admin.\n\n#### 12) */order/changeStatusOfOrder*: (POST)\n\nUsed for Change order's current Status by Admin --\u003e This person should have token + role===admin\n\n##### Input Sample-1: \n\n  - status: \"Delivered\",\n  - orderId: \"64bf4d78a141a7319b7aa1e7\"\n\n##### Output-1: \n\n{\n  \"msg\": \"Status of order has been changed\",\n  \"status\": \"Delivered\"\n}\n\n##### Input Sample-2: \n\n  - status: \"Shipping\",\n  - orderId: \"64bf4d78a141a7319b7aa1e7\"\n\n##### Output-2: \n\n{\n  \"msg\": \"Status of order has been changed\",\n  \"status\": \"Shipping\"\n}\n\n#### 13) */order/getDeliveredOrders* : (GET)\n\nUsed to get all the orders  list  of delivered items by admin which have OrderDelivered===true\n\n\n#### 14) */order/getNotDeliveredOrders* : (GET)\n\nUsed to get all the orders  list  of Not-delivered items by admin which have OrderDelivered===false\n\n## NOTE:  API rate limiting to prevent abuse and maintain server stability.\n\nAPI RATE LIMIT used for the amount of time and no.of req valid for your application.\n\nmiddleware --\u003e express-rate-limit\n\n##### Example Which I set in this assignment: \n - max: 2, //no. of req users can make within the time\n - windowMs: 60000  // time frame in (ms)\n\nAfter 60000ms you got the Error: \"Too many requests, please try again later\" with a 429 status code if you try to make more than 2 requests.\n##### So Finally you can make 2 requests in 1 Minute.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushpendra-1697%2Fecommerce-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpushpendra-1697%2Fecommerce-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushpendra-1697%2Fecommerce-api/lists"}