{"id":24653853,"url":"https://github.com/fmahadybd/dream-shop","last_synced_at":"2026-04-30T11:32:26.387Z","repository":{"id":256794161,"uuid":"856152684","full_name":"fmahadyBD/dream-shop","owner":"fmahadyBD","description":"This is an e-commrece website. With have JWT token,Validation, CURD the product and Category. User can add to card product and purch the product ","archived":false,"fork":false,"pushed_at":"2024-12-16T04:41:42.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-20T05:52:04.824Z","etag":null,"topics":["git","java","jwt-authentication","mysql","rest-api","springboot","sql"],"latest_commit_sha":null,"homepage":"","language":"Java","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/fmahadyBD.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-12T04:47:35.000Z","updated_at":"2024-12-16T04:43:28.000Z","dependencies_parsed_at":"2025-10-08T19:09:56.322Z","dependency_job_id":"327fd79e-90ac-4ae3-ae5a-0336a8e1bd8d","html_url":"https://github.com/fmahadyBD/dream-shop","commit_stats":null,"previous_names":["fmahadybd/dream-shop"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fmahadyBD/dream-shop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmahadyBD%2Fdream-shop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmahadyBD%2Fdream-shop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmahadyBD%2Fdream-shop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmahadyBD%2Fdream-shop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fmahadyBD","download_url":"https://codeload.github.com/fmahadyBD/dream-shop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmahadyBD%2Fdream-shop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32463892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["git","java","jwt-authentication","mysql","rest-api","springboot","sql"],"created_at":"2025-01-25T21:14:19.178Z","updated_at":"2026-04-30T11:32:26.350Z","avatar_url":"https://github.com/fmahadyBD.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\n\n# **Dream Shop**\n\n---\n\n## **How to Run**\n\n1. **Clone the repository:**  \n   Use the following command to clone the repository:\n   ```bash\n   git clone https://github.com/fmahadyBD/dream-shop.git\n   ```\n\n2. **Set up the database:**  \n   Follow these steps to configure your database:\n    1. Start the MySQL database server.\n    2. The database will be automatically created.\n    3. If MySQL is running on a port other than `3306`, update the port in the configuration.\n    4. Ensure the correct database username and password are set in the `application.properties` file:\n       ```properties\n       spring.datasource.url=jdbc:mysql://localhost:3305/shopping-card?createDatabaseIfNotExist=true\n       spring.datasource.username=root\n       spring.datasource.password=\n       ```\n\n3. **Navigate to the project directory:**\n   ```bash\n   cd dream-shop\n   ```\n\n4. **Start the Spring Boot application:**  \n   Use Maven to run the application:\n   ```bash\n   mvn spring-boot:run\n   ```\n\n5. **Test the endpoints:**  \n   Test the application's endpoints using tools like [Postman](https://www.postman.com/) or [curl](https://curl.se/).\n\n---\n\n## **User Management API Documentation**\n\n### **Endpoints**\n\n#### **1. User Registration**\n\n- **Endpoint:**  \n  `POST http://localhost:8080/registration`\n\n- **Description:**  \n  Adds a new user to the system.\n\n- **Request Body:**\n  ```json\n  {\n    \"first_name\": \"Mahady Hasan\",\n    \"last_name\": \"Fahim\",\n    \"email\": \"fmahadybd@gmail.com\",\n    \"password\": \"12345\",\n    \"userRole\": \"ADMIN\"\n  }\n  ```\n\n- **Response:**\n    - **Success:**  \n      **HTTP Status:** `200 OK`\n      ```json\n      {\n        \"message\": \"Added new user\",\n        \"data\": {\n          \"userid\": 2,\n          \"first_name\": \"Mahady Hasan\",\n          \"last_name\": \"Fahim\",\n          \"email\": \"fmahadybd@gmail.com\",\n          \"password\": \"$2a$10$IhDAzGDF7TtZgXrfqfwJM.qZs0fIQUjPeV0JR4ugJxYP7QXDkqHsq\",\n          \"userRole\": \"ADMIN\"\n        }\n      }\n      ```\n\n    - **Error:**  \n      **HTTP Status:** `400 Bad Request`\n      ```json\n      {\n        \"error\": \"Validation error\",\n        \"details\": \"Email is already in use\"\n      }\n      ```\n\n---\n\n#### **2. User Login**\n\n- **Endpoint:**  \n  `POST http://localhost:8080/authenticate`\n\n- **Description:**  \n  Authenticates an existing user.\n\n- **Request Body:**\n  ```json\n  {\n    \"email\": \"fmahady01@gmail.com\",\n    \"password\": \"12345\"\n  }\n  ```\n\n- **Response:**\n    - **Success:**  \n      **HTTP Status:** `200 OK`\n      ```json\n      {\n        \"token\": \"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJmbWFoYWR5MDFAZ21haWwuY29tIiwiaWF0IjoxNzMyNDAxMzk5LCJleHAiOjE3MzI0MDE0MTl9.VrX0t8oqmbMqMzIjjUDcyUoZo-2HuaFUc-m3y7OiAra0SM4-xIKNhDc6Wyt32se5qp870KZ8ts2wyDYpp8cJpg\"\n      }\n      ```\n\n    - **Error:**  \n      **HTTP Status:** `403 Forbidden`\n      ```json\n      {\n        \"error\": \"Invalid credentials\"\n      }\n      ```\n\n---\n\n## **Notes**\n\n- The `password` field is hashed using BCrypt when stored in the database.\n- Role-based access control is implemented via the `userRole` field (`ADMIN`, `USER`, `MODERATOR`).\n- Use the authentication token from the login response to access protected routes.\n\n---\n\n## **Category Management API Documentation**\n\n### **Endpoints**\n\n#### **1. Add Category**\n\n- **Endpoint:**  \n  `POST http://localhost:8080/admin/api/v1/categories/add`\n\n- **Authentication:**  \n  Set the Bearer Token from the authentication response.\n\n- **Request Body:**\n  ```json\n  {\n    \"name\": \"Art\"\n  }\n  ```\n\n- **Response:**\n    - **Success:**  \n      **HTTP Status:** `200 OK`\n      ```json\n      {\n        \"message\": \"Add Category Successfully\",\n        \"data\": {\n          \"id\": 1,\n          \"name\": \"Art\"\n        }\n      }\n      ```\n\n---\n\n#### **2. Get All Categories**\n\n- **Endpoint:**  \n  `GET http://localhost:8080/admin/api/v1/categories/all`\n\n- **Authentication:**  \n  Set the Bearer Token from the authentication response.\n\n- **Response:**  \n  **HTTP Status:** `200 OK`\n  ```json\n  {\n    \"message\": \"Found\",\n    \"data\": [\n      {\n        \"id\": 1,\n        \"name\": \"Art\"\n      }\n    ]\n  }\n  ```\n\n---\n\n#### **3. Get Category by ID**\n\n- **Endpoint:**  \n  `GET http://localhost:8080/admin/api/v1/categories/category/id/{id}`\n\n- **Response:**  \n  **HTTP Status:** `200 OK`\n  ```json\n  {\n    \"message\": \"Found\",\n    \"data\": {\n      \"id\": 2,\n      \"name\": \"Art\"\n    }\n  }\n  ```\n\n---\n\n#### **4. Get Category by Name**\n\n- **Endpoint:**  \n  `GET http://localhost:8080/admin/api/v1/categories/category/name/{name}`\n\n- **Response:**  \n  **HTTP Status:** `200 OK`\n  ```json\n  {\n    \"message\": \"Found\",\n    \"data\": {\n      \"id\": 2,\n      \"name\": \"Art\"\n    }\n  }\n  ```\n\n---\n\n#### **5. Update Category by ID**\n\n- **Endpoint:**  \n  `PUT http://localhost:8080/admin/api/v1/categories/category/update/id/{id}`\n\n- **Request Body:**\n  ```json\n  {\n    \"name\": \"The Art Color\"\n  }\n  ```\n\n- **Response:**\n    - **Success:**  \n      **HTTP Status:** `200 OK`\n      ```json\n      {\n        \"message\": \"Update Category Successfully\",\n        \"data\": {\n          \"id\": 2,\n          \"name\": \"The Art Color\"\n        }\n      }\n      ```\n\n    - **Error:**  \n      **HTTP Status:** `404 Not Found`\n      ```json\n      {\n        \"message\": \"Category Not Found!\",\n        \"data\": null\n      }\n      ```\n\n---\n\n#### **6. Delete Category by ID**\n\n- **Endpoint:**  \n  `DELETE http://localhost:8080/admin/api/v1/categories/category/delete/id/{id}`\n\n- **Response:**\n    - **Success:**  \n      **HTTP Status:** `200 OK`\n      ```json\n      {\n        \"message\": \"Delete Category Successfully\",\n        \"data\": null\n      }\n      ```\n\n    - **Error:**  \n      **HTTP Status:** `404 Not Found`\n      ```json\n      {\n        \"message\": \"Category Not Found!\",\n        \"data\": null\n      }\n      ```\n\n---\n\n## **Product API Documentation**\n\n### Add New Product\n**URL:** `http://localhost:8080/admin/api/v1/products/add`  \n**Method:** POST\n\n#### Request Body:\n```json\n{\n  \"name\": \"Laptop\",\n  \"price\": 1200.00,\n  \"brand\": \"Dell\",\n  \"inventory\": 50,\n  \"description\": \"High-performance Dell Laptop\",\n  \"category\": {\n    \"name\": \"Electronics\"\n  }\n}\n```\n\u003e **Note:** If the category with the specified name does not exist in the database, a new category will be created.\n\n#### Error Response:\n```json\n{\n  \"message\": \"Error\",\n  \"data\": \"Cannot invoke \\\"com.fahim.shoppingcard.model.Category.getName()\\\" because the return value of \\\"com.fahim.shoppingcard.request.AddProductRequest.getCategory()\\\" is null\"\n}\n```\n\n#### Success Response:\n```json\n{\n  \"message\": \"Added new Product\",\n  \"data\": {\n    \"id\": 1,\n    \"name\": \"Laptop\",\n    \"price\": 1200.00,\n    \"brand\": \"Dell\",\n    \"inventory\": 50,\n    \"description\": \"High-performance Dell Laptop\",\n    \"category\": {\n      \"id\": 102,\n      \"name\": \"Electronics\"\n    },\n    \"images\": []\n  }\n}\n```\n\n---\n\n### Get All Products\n**URL:** `http://localhost:8080/admin/api/v1/products/all`  \n**Method:** GET\n\n#### Response:\n```json\n{\n  \"message\": \"Found!\",\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": \"Laptop\",\n      \"price\": 1200.00,\n      \"brand\": \"Dell\",\n      \"inventory\": 50,\n      \"description\": \"High-performance Dell Laptop\",\n      \"images\": []\n    }\n  ]\n}\n```\n\n---\n\n### Get Product By ID\n**URL:** `http://localhost:8080/admin/api/v1/products/product/id/{id}`  \n**Method:** GET\n\n#### Example:\n**URL:** `http://localhost:8080/admin/api/v1/products/product/id/1`  \n**Response:**\n```json\n{\n  \"message\": \"Found!\",\n  \"data\": {\n    \"id\": 1,\n    \"name\": \"Laptop\",\n    \"price\": 1200.00,\n    \"brand\": \"Dell\",\n    \"inventory\": 50,\n    \"description\": \"High-performance Dell Laptop\",\n    \"images\": []\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffmahadybd%2Fdream-shop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffmahadybd%2Fdream-shop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffmahadybd%2Fdream-shop/lists"}