{"id":18743860,"url":"https://github.com/devmarkson/uniclique-ecommerce-api","last_synced_at":"2026-02-27T12:39:17.421Z","repository":{"id":254199989,"uuid":"795235576","full_name":"DevMarkson/UNICLIQUE-ECOMMERCE-API","owner":"DevMarkson","description":"The Uniclique-Ecommerce-API facilitates the management of products in an eCommerce application, integrated with a frontend application to serve a full stack e-commerce website that has processed more than 100 orders @ https://uniclique.com.ng","archived":false,"fork":false,"pushed_at":"2024-08-25T01:50:23.000Z","size":925,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T07:19:03.601Z","etag":null,"topics":["ecommerce-api","ecommerce-application","ecommerce-website"],"latest_commit_sha":null,"homepage":"https://uniclique-ecommerce-api.onrender.com/api-docs/","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/DevMarkson.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":"2024-05-02T21:16:41.000Z","updated_at":"2025-05-31T22:55:38.000Z","dependencies_parsed_at":"2024-11-07T16:12:57.197Z","dependency_job_id":"1061facf-44a2-4de6-8621-bd14088aea00","html_url":"https://github.com/DevMarkson/UNICLIQUE-ECOMMERCE-API","commit_stats":null,"previous_names":["devmarkson/uniclique-ecommerce-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DevMarkson/UNICLIQUE-ECOMMERCE-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevMarkson%2FUNICLIQUE-ECOMMERCE-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevMarkson%2FUNICLIQUE-ECOMMERCE-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevMarkson%2FUNICLIQUE-ECOMMERCE-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevMarkson%2FUNICLIQUE-ECOMMERCE-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevMarkson","download_url":"https://codeload.github.com/DevMarkson/UNICLIQUE-ECOMMERCE-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevMarkson%2FUNICLIQUE-ECOMMERCE-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29895249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T12:09:13.686Z","status":"ssl_error","status_checked_at":"2026-02-27T12:09:13.282Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ecommerce-api","ecommerce-application","ecommerce-website"],"created_at":"2024-11-07T16:12:48.270Z","updated_at":"2026-02-27T12:39:17.385Z","avatar_url":"https://github.com/DevMarkson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uniclique E-Commerce API\n\nThis is an E-commerce API built with Node.js, Express, and MongoDB. It provides endpoints for user authentication, product management, and order processing. It also provides Swagger documentation for easy reference.\n\n## Table of Contents\n- [Swagger Documentation](#swagger-documentation)\n- [API Endpoints](#api-endpoints)\n  - [Authentication](#authentication)\n  - [Products](#products)\n  - [Orders](#orders)\n- [Swagger YAML](#swagger-yaml)\n- [Prerequisites](#prerequisites)\n- [Getting Started](#getting-started)\n- [Database Connection](#database-connection)\n- [Middleware](#middleware)\n- [Models](#models)\n- [Controllers](#controllers)\n\n## Swagger Documentation\nYou can access the Swagger documentation for this API at [API-Docs](https://uniclique-ecommerce-api.onrender.com/api-docs). The Swagger UI provides detailed information about the API endpoints, request schemas, and example requests and responses.\n![Swagger Documentation of Uniclique E-commerce API](swagger-docs.png)\n\n## API Endpoints\n\n### Authentication\n- **POST /api/v1/auth/register**\n  - Register a new user.\n  - Example Request Body:\n    ```json\n    {\n      \"firstName\": \"Favour\",\n      \"lastName\": \"Maparo\",\n      \"email\": \"marksongee@gmail.com\",\n      \"phoneNumber\": \"08020405070\",\n      \"password\": \"Maparo\",\n      \"role\": \"user\"\n    }\n    ```\n\n- **POST /api/v1/auth/login**\n  - Log in an existing user.\n  - Example Request Body:\n    ```json\n    {\n      \"email\": \"maparo165@gmail.com\",\n      \"password\": \"Maparo\"\n    }\n    ```\n\n### Products\n- **POST /api/v1/products**\n  - Create a new product (requires authentication).\n  - Example Request Body:\n    ```json\n    {\n      \"name\": \"Product Name\",\n      \"description\": \"Product Description\",\n      \"price\": 100,\n      \"imageUrl\": \"http://example.com/image.jpg\"\n    }\n    ```\n\n- **GET /api/v1/products**\n  - Retrieve all products.\n\n- **GET /api/v1/products/{id}**\n  - Retrieve a single product by its ID.\n\n- **PATCH /api/v1/products/{id}**\n  - Update a product by its ID (requires authentication).\n  - Example Request Body:\n    ```json\n    {\n      \"name\": \"Updated Product Name\",\n      \"description\": \"Updated Product Description\",\n      \"price\": 150\n    }\n    ```\n\n- **DELETE /api/v1/products/{id}**\n  - Delete a product by its ID (requires authentication).\n\n### Orders\n- **POST /api/v1/orders**\n  - Create a new order (requires authentication).\n  - Example Request Body:\n    ```json\n    {\n      \"products\": [\n        {\n          \"productId\": \"product_id_1\",\n          \"quantity\": 2\n        },\n        {\n          \"productId\": \"product_id_2\",\n          \"quantity\": 1\n        }\n      ],\n      \"paymentStatus\": \"pending\"\n    }\n    ```\n\n- **GET /api/v1/orders**\n  - Retrieve all orders for the authenticated user.\n\n- **GET /api/v1/orders/{id}**\n  - Retrieve a single order by its ID.\n\n- **PATCH /api/v1/orders/{id}**\n  - Update an order by its ID (requires authentication).\n  - Example Request Body:\n    ```json\n    {\n      \"paymentStatus\": \"completed\"\n    }\n    ```\n\n- **DELETE /api/v1/orders/{id}**\n  - Delete an order by its ID (requires authentication).\n\n## Authentication\nThe API uses JSON Web Tokens (JWT) for authentication. When a user registers or logs in, a JWT token is provided in the response. To authenticate for protected routes (products and orders-related endpoints), include this token in the `Authorization` header of your requests with the format: `Bearer \u003ctoken\u003e`.\n\n## Swagger YAML\nThe Swagger documentation is defined in the `swagger.yaml` file. It provides detailed information about the API endpoints, request and response schemas, and example data.\n\n## Prerequisites\nBefore you can use the Uniclique E-commerce API, make sure you have the following installed:\n- Node.js\n- MongoDB\n- Git\n\n## Getting Started\n1. Clone the repository to your local machine:\n    ```sh\n    git clone https://github.com/yourusername/uniclique-ecommerce-api.git\n    ```\n2. Navigate to the project directory:\n    ```sh\n    cd uniclique-ecommerce-api\n    ```\n3. Install the dependencies:\n    ```sh\n    npm install\n    ```\n4. Set up environment variables by creating a `.env` file in the root directory. Use this format:\n    ```env\n    PORT=3000\n    MONGO_URI=your_mongo_uri\n    JWT_SECRET=your_jwt_secret\n    CLOUD_NAME=your_cloudinary_cloud_name\n    CLOUD_API_KEY=your_cloudinary_api_key\n    CLOUD_API_SECRET=your_cloudinary_api_secret\n    PAYSTACK_SECRET_KEY=your_paystack_secret_key\n    ```\n5. Start the server:\n    ```sh\n    npm start\n    ```\n    The API should now be running on `http://localhost:3000`.\n\n## Database Connection\nThe API connects to a MongoDB database using Mongoose. The database connection is managed in the `db/connect.js` file.\n\n## Middleware\nThe API includes several middleware functions for security and request handling:\n- `helmet`: Provides security-related HTTP headers.\n- `cors`: Enables Cross-Origin Resource Sharing.\n- `xss-clean`: Protects against cross-site scripting (XSS) attacks.\n- `express-rate-limit`: Implements rate limiting to prevent abuse of the API.\n- `authentication`: Middleware to verify JWT tokens and authenticate users.\n- `not-found`: Handles requests for non-existent routes.\n- `error-handler`: Centralized error handling and response formatting.\n\n## Models\nThe API uses several mongoose models:\n- **User Model**\n  - Stores user information including name, email, and hashed password.\n  - Provides methods for creating JWT tokens and comparing passwords.\n- **Product Model**\n  - Stores product details like name, description, price, and image URL.\n- **Order Model**\n  - Stores order details including user, products, and payment status.\n\n## Controllers\nThe API controllers handle request processing:\n- **Auth Controller**\n  - `register`: Handles user registration.\n  - `login`: Handles user login.\n- **Product Controller**\n  - `getAllProducts`: Retrieves all products.\n  - `getProduct`: Retrieves a single product by its ID.\n  - `createProduct`: Creates a new product.\n  - `updateProduct`: Updates a product by its ID.\n  - `deleteProduct`: Deletes a product by its ID.\n- **Order Controller**\n  - `getAllOrders`: Retrieves all orders for the authenticated user.\n  - `getOrder`: Retrieves a single order by its ID.\n  - `createOrder`: Creates a new order.\n  - `updateOrder`: Updates an order by its ID.\n  - `deleteOrder`: Deletes an order by its ID.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmarkson%2Funiclique-ecommerce-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevmarkson%2Funiclique-ecommerce-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmarkson%2Funiclique-ecommerce-api/lists"}