{"id":22740202,"url":"https://github.com/HebaHamdan2/E-commerce-Backend-API","last_synced_at":"2025-03-30T03:41:25.956Z","repository":{"id":203175082,"uuid":"708367822","full_name":"HebaHamdan2/E-commerce-Backend-API","owner":"HebaHamdan2","description":"This repository contains the backend for an e-commerce application built using Node.js, Express.js, MongoDB and Mongoose. It provides functionalities such as user authentication, product management, cart management, order processing, and review systems.","archived":false,"fork":false,"pushed_at":"2025-03-29T14:44:02.000Z","size":130,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T15:29:44.825Z","etag":null,"topics":["api","backend","cloudinary","javascript","mongodb","mongoose","multer","nodejs","postman","render"],"latest_commit_sha":null,"homepage":"https://documenter.getpostman.com/view/28559046/2s9YRB4D3y","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/HebaHamdan2.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-10-22T11:04:23.000Z","updated_at":"2025-03-29T14:44:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c513c64-6120-4447-9963-9b3a77f59ff3","html_url":"https://github.com/HebaHamdan2/E-commerce-Backend-API","commit_stats":null,"previous_names":["hebahamdan2/ecommerce","hebahamdan2/ecommerce-api","hebahamdan2/e-commerce-backend-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HebaHamdan2%2FE-commerce-Backend-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HebaHamdan2%2FE-commerce-Backend-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HebaHamdan2%2FE-commerce-Backend-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HebaHamdan2%2FE-commerce-Backend-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HebaHamdan2","download_url":"https://codeload.github.com/HebaHamdan2/E-commerce-Backend-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246273519,"owners_count":20750904,"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":["api","backend","cloudinary","javascript","mongodb","mongoose","multer","nodejs","postman","render"],"created_at":"2024-12-10T23:07:52.558Z","updated_at":"2025-03-30T03:41:25.950Z","avatar_url":"https://github.com/HebaHamdan2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# E-commerce Backend API\n\nThis repository contains the backend for an e-commerce application built using **Node.js**, **Express.js**, **MongoDB**, **Mongoose**, and **Cloudinary** for handling image uploads. It provides functionalities such as user authentication, product management, cart management, order processing, and review systems.\n\n## Features\n\n- **User Authentication**: Sign up, sign in, and password reset functionality.\n- **Admin Capabilities**: Product, category, subcategory, and coupon management (create, update, delete).\n- **Order Management**: Cart management and order status updates.\n- **Product Reviews**: Users can add, edit, or delete product reviews.\n- **Coupon System**: Admins can create and users can apply coupons.\n- **Role-Based Authorization**: Different user roles (Admin/User) with specific permissions.\n\n## Technologies Used\n\n- **Node.js**: JavaScript runtime for building scalable and high-performance applications.\n- **Express.js**: Web framework for routing and handling HTTP requests.\n- **MongoDB**: NoSQL database for storing and managing application data.\n- **Mongoose**: ODM (Object Data Modeling) library for MongoDB to manage data relationships and schema.\n- **Cloudinary**: Image and media storage and management service.\n- **bcryptjs**: Library for hashing passwords securely.\n- **jsonwebtoken**: For creating and verifying JWT tokens for authentication.\n- **multer**: Middleware for handling file uploads (used for product image uploads).\n- **dotenv**: For managing environment variables.\n- **slugify**: Converts strings into URL-friendly slugs.\n- **joi**: Data validation library to ensure incoming requests follow the required structure.\n- **nodemailer**: For sending emails (used for password reset and confirmation emails).\n- **cors**: Middleware to allow cross-origin resource sharing.\n- **nanoid**: Used to generate unique IDs, like verification codes for forgotten passwords.\n\n## Model Relationships\n\n1. **User - Order**:  \n   - A **User** can place multiple **Orders**. The `Order` model references `User` via `userId`.\n   \n2. **Product - Category \u0026 Subcategory**:  \n   - A **Product** belongs to a **Category** and a **Subcategory**. Both are referenced via `categoryId` and `subcategoryId`.\n   \n3. **Product - Review**:  \n   - A **Product** can have multiple **Reviews**, and each review belongs to a **Product**. Reviews are linked to products using `productId`.\n\n4. **Product - Cart**:  \n   - A **Cart** stores products that a **User** has added. Each product in the cart is linked to the `Product` model by `productId`.\n\n5. **Order - Product**:  \n   - An **Order** contains multiple **Products**, with each product referencing the `Product` model by `productId`.\n\n6. **Coupon - User**:  \n   - A **Coupon** can be used by multiple **Users**, and each coupon has a list of `usedBy` referencing users who have applied it.\n\n## Postman Collection\n\nYou can use the Postman collection for testing the API. The collection includes all the endpoints listed above with examples for each request.\n\n- **Postman Collection URL**: [here](https://documenter.getpostman.com/view/28559046/2s9YRB4D3y) \n\n---\n## Setup Instructions\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/HebaHamdan2/E-commerce-Backend-API.git\ncd E-commerce-Backend-API\n```\n### 2. Install Dependencies\n```bash\nnpm install\n```\n### 3. Environment Variables\n - Create a .env file in the root directory and set the following variables\n```bash\nDB=\"mongodb://your-database-uri\"\ncloud_name=\"your-cloudinary-cloud-name\"\napi_key=\"your-cloudinary-api-key\"\napi_secret=\"your-cloudinary-api-secret\"\nAPP_NAME=\"your-app-name\"\nSALT_ROUND=\"number\"\nLOGINSECRET=\"your-jwt-secret\"\nBEARERKEY=\"your-bearer-key\"\nCONFIRMEMAILSECRET=\"your-confirm-email-secret\"\nEMAILSENDER=\"your-email-sender-address\"\nPASSWORDSENDER=\"your-password-sender-email\"\nFORGETPASSWORDFORM=\"your-forget-password-form-link\"\nLOGINFRONTEND=\"your-frontend-login-url\"\n```\n### 4. Run the Server\n - Start the server in development mode:\n```bash\nnpm run dev\n```\n\n## Deployment\n\nThis backend is deployed on **Render**. To deploy it yourself:\n\n1. Create an account on [Render](https://render.com).\n2. Connect your GitHub repository.\n3. Set up environment variables in the Render dashboard.\n4. Deploy the application.\n\n## Contributing\n\nContributions are welcome! Please feel free to create an issue or submit a pull request for enhancements or bug fixes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHebaHamdan2%2FE-commerce-Backend-API","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHebaHamdan2%2FE-commerce-Backend-API","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHebaHamdan2%2FE-commerce-Backend-API/lists"}