{"id":20325553,"url":"https://github.com/hoaian2/tech-store","last_synced_at":"2026-05-09T09:34:34.593Z","repository":{"id":65831686,"uuid":"589146938","full_name":"HOAIAN2/tech-store","owner":"HOAIAN2","description":"Yo, this is demo version for my system design class","archived":false,"fork":false,"pushed_at":"2023-06-12T10:13:58.000Z","size":37018,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T14:27:22.741Z","etag":null,"topics":["mysql","mysql2","nodejs","online-shop"],"latest_commit_sha":null,"homepage":"","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/HOAIAN2.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-01-15T08:07:21.000Z","updated_at":"2023-09-13T11:59:30.000Z","dependencies_parsed_at":"2023-07-07T23:31:41.211Z","dependency_job_id":null,"html_url":"https://github.com/HOAIAN2/tech-store","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HOAIAN2%2Ftech-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HOAIAN2%2Ftech-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HOAIAN2%2Ftech-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HOAIAN2%2Ftech-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HOAIAN2","download_url":"https://codeload.github.com/HOAIAN2/tech-store/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241829106,"owners_count":20027020,"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":["mysql","mysql2","nodejs","online-shop"],"created_at":"2024-11-14T19:40:32.514Z","updated_at":"2026-05-09T09:34:34.558Z","avatar_url":"https://github.com/HOAIAN2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tech-store\n## Prerequisites\n- Nodejs v 18.11.0 or later (yarn or npm)\n- MySQL\n## Installation\n- `git clone https://github.com/HOAIAN2/tech-store.git`\n- `cd tech-store`\n- Run `prepare.bat` to generate .env file and install libs for server and client.\n- `yarn start` or `npm start`\n## Build\n- Run `build.bat` to build ReactJS and start server\n## Database Diagram\n![](/database/Store%20Database%20Diagram.png)\n## API\n### User routes: /api/user/\n\u003e[GET] /: JWT require\n- Response\n``` json\n{\n    \"username\": \"username\",\n    \"firstName\": \"first name\",\n    \"lastName\": \"last name\",\n    \"birthDate\": \"2023-02-09T01:18:02.135Z\",\n    \"sex\": \"M\",\n    \"address\": \"province, city, etc\",\n    \"email\": \"username@email.com\", // NULLABLE\n    \"phoneNumber\": \"+84....\", // phone number in Vietnam, CHAR(12) NULLABLE\n}\n```\n### Auth routes: /api/auth/\n\u003e[POST] login\n- Request\n```json\n{\n    \"username\": \"username\",\n    \"password\": \"password\"\n}\n```\n- Response\n```json\n{\n    \"accessToken\": \"string\",\n    \"refreshToken\": \"string\"\n}\n```\n\u003e[POST] logout: JWT require\n- Request\n```json\n{\n    \"refreshToken\": \"string\"\n}\n```\n- Response\n```json\n{\n    \"message\": \"message\"\n}\n```\n\u003e[POST] change-password: JWT require\n- Request\n```json\n{\n    \"oldPassword\": \"string\",\n    \"newPassword\": \"string\",\n    \"refreshToken\": \"string\"\n}\n```\n- Response\n\u003e[POST] register\n- Request\n```json\n{\n    \"username\": \"username\",\n    \"firstName\": \"first name\",\n    \"lastName\": \"last name\",\n    \"birthDate\": \"2023-02-09T01:18:02.135Z\",\n    \"sex\": \"M\",\n    \"address\": \"province, city, etc\",\n    \"email\": \"username@email.com\", // NULLABLE\n    \"phoneNumber\": \"+84....\", // phone number in Vietnam, CHAR(12) NULLABLE\n    \"password\": \"password\"\n}\n```\n- Response\n```json\n{\n    \"accessToken\": \"string\",\n    \"refreshToken\": \"string\"\n}\n```\n\u003e[POST] refresh\n- Request\n```json\n{\n    \"refreshToken\": \"string\"\n}\n```\n- Response\n```json\n{\n    \"message\": \"message\"\n}\n```\n\u003e[POST] edit: JWT require\n- Request\n```json\n{\n    \"username\": \"username\",\n    \"firstName\": \"first name\",\n    \"lastName\": \"last name\",\n    \"birthDate\": \"2023-02-09T01:18:02.135Z\",\n    \"sex\": \"M\",\n    \"address\": \"province, city, etc\",\n    \"email\": \"username@email.com\", // NULLABLE\n    \"phoneNumber\": \"+84....\", // phone number in Vietnam, CHAR(12) NULLABLE\n}\n```\n- Response\n\u003e[POST] upload\n- Request: formData(file: yourImage) (accept: png, jpeg, jpg)\n- Response: HTTP status code\n### Product routes: /api/products/\n\u003e[GET]\n- Response\n```json\n{\n    \"category\": [\n        {\n            \"productID\": 1,\n            \"productName\": \"string\",\n            \"supplier\": \"string\",\n            \"category\": \"string\",\n            \"price\": 100000,\n            \"discount\": null,\n            \"images\": [\"string\"],\n            \"description\": null\n        }\n    ]\n}\n```\n\u003e[GET] product?id=number\n- Response\n```json\n{\n    \"productID\": 1,\n    \"productName\": \"string\",\n    \"supplier\": \"string\",\n    \"category\": \"string\",\n    \"price\": 100000,\n    \"discount\": null,\n    \"images\": [\"string\"],\n    \"description\": null\n}\n```\n\u003e[GET] suppliers-categories\n- Response\n```json\n{\n    \"categories\": [\n        \"category\"\n    ],\n    \"suppliers\": [\n        \"supplier\"\n    ]\n}\n```\n\u003e[GET] search\n- Request: query params\n  - _name_ : product name\n- Response\n  - _less_\n  ```json\n  [\n    {\n        \"productID\": 1,\n        \"productName\": \"string\",\n        \"price\": 100000,\n        \"discount\": null,\n        \"images\": [\"string\"],\n    }\n  ]\n  ```\n\u003e[GET] search-more\n  - _more_\n  - _sortBy_: price, hot, top-sell\n  - _star_: 1-\u003e5\n  - _brand_\n  - _address_\n  - _sortMode_: asc, desc\n  - _indexToStart_:\n  ```json\n  {\n    \"index\": 5,\n    \"data\": [\n        {\n            \"productID\": 1,\n            \"productName\": \"string\",\n            \"supplier\": \"string\",\n            \"category\": \"string\",\n            \"price\": 100000,\n            \"discount\": null,\n            \"images\": [\"string\"],\n            \"description\": null\n        }\n    ]\n  }\n  ```\n\u003e[POST] add-product: JWT require (token admin)\n- Request\n  - form data: only send String so server gonna parse data type\n  ```json\n  {\n    \"productName\": \"string\",\n    \"supplier\": \"string\",\n    \"category\": \"string\",\n    \"price\": \"100000\",\n    \"quantity\": \"100\",\n    \"description\": \"\"\n  }\n  ```\n  - images \"files\": accept: jpeg, jpg, png, =\u003c 500kbs\n- Response\n```json\n{\n    \"productID\": 1,\n    \"productName\": \"string\",\n    \"supplier\": \"string\",\n    \"category\": \"string\",\n    \"price\": 100000,\n    \"discount\": null,\n    \"images\": [\"string\"],\n    \"description\": null\n}\n```\n### Order routes: /api/order/\n\u003e[POST] create-order: JWT require\n- Request\n- Response\n```json\n{\n    \"orderID\": 1,\n    \"userID\": 1,\n    \"orderDate\": null,\n    \"paidMethod\": null,\n    \"paid\": false,\n    \"products\": [\n        {\n            \"productID\": 3,\n            \"productName\": \"Laptop Lenovo IdeaPad Gaming 3 15IHU6 82K100FBVN (Core i7-11370H/8GB RAM/512GB SSD/15.6-in - Hàng chính hãng\",\n            \"quantity\": 6\n        }\n    ],\n    \"total\": 0,\n    \"voucher\": null\n}\n```\n\u003e[POST] add-product, remove-product (Same input output) JWT require\n- Request\n```json\n{\n    \"productID\": 1,\n    \"quantity\": 2\n}\n```\n- Response\n```json\n{\n    \"orderID\": 1,\n    \"userID\": 1,\n    \"orderDate\": null,\n    \"paidMethod\": null,\n    \"paid\": false,\n    \"products\": [\n        {\n            \"productID\": 3,\n            \"productName\": \"Laptop Lenovo IdeaPad Gaming 3 15IHU6 82K100FBVN (Core i7-11370H/8GB RAM/512GB SSD/15.6-in - Hàng chính hãng\",\n            \"quantity\": 6\n        },\n        {\n            \"productID\": 4,\n            \"productName\": \"Laptop Acer Nitro 5 AN515-45-R6EV R5-5600H |8GB|512GB|GTX 1650 4GB|156 FHD 144Hz|Win 11 Hàng chính hãng\",\n            \"quantity\": 3\n        },\n        {\n            \"productID\": 7,\n            \"productName\": \"Laptop Lenovo Legion 5 15IAH7 82RC003WVN |i5-12500H|8GB|512GB|RTX 3050 Ti|Win11- Hàng chính hãng\",\n            \"quantity\": 3\n        }\n    ],\n    \"total\": 0,\n    \"voucher\": null\n}\n```\n\u003e[POST] make-payment: JWT require\n- Request\n```json\n{\n    \"paymentMethod\": 1\n}\n```\n- Response\n```json\n{\n    \"orderID\": 1,\n    \"userID\": 1,\n    \"orderDate\": \"2023-04-21T11:28:22.000Z\",\n    \"paidMethod\": \"Electronic bank transfers\",\n    \"paid\": true,\n    \"products\": [\n        {\n            \"productID\": 4,\n            \"productName\": \"Laptop Acer Nitro 5 AN515-45-R6EV R5-5600H |8GB|512GB|GTX 1650 4GB|156 FHD 144Hz|Win 11 Hàng chính hãng\",\n            \"quantity\": 3,\n            \"price\": 18790000,\n            \"discount\": null\n        },\n        {\n            \"productID\": 7,\n            \"productName\": \"Laptop Lenovo Legion 5 15IAH7 82RC003WVN |i5-12500H|8GB|512GB|RTX 3050 Ti|Win11- Hàng chính hãng\",\n            \"quantity\": 3,\n            \"price\": 32150400,\n            \"discount\": null\n        }\n    ],\n    \"total\": 152821200,\n    \"voucher\": null\n}\n```\n\u003e[POST] set-voucher JWT require\n- Request\n```json\n{\n    \"voucherID\": \"string\"\n}\n```\n- Response\n```json\n{\n    \"orderID\": 1,\n    \"userID\": 1,\n    \"orderDate\": null,\n    \"paidMethod\": null,\n    \"paid\": 0,\n    \"products\": [\n        {\n            \"productID\": 3,\n            \"productName\": \"Laptop Lenovo IdeaPad Gaming 3 15IHU6 82K100FBVN (Core i7-11370H/8GB RAM/512GB SSD/15.6-in - Hàng chính hãng\",\n            \"quantity\": 6\n        },\n        {\n            \"productID\": 4,\n            \"productName\": \"Laptop Acer Nitro 5 AN515-45-R6EV R5-5600H |8GB|512GB|GTX 1650 4GB|156 FHD 144Hz|Win 11 Hàng chính hãng\",\n            \"quantity\": 3\n        },\n        {\n            \"productID\": 7,\n            \"productName\": \"Laptop Lenovo Legion 5 15IAH7 82RC003WVN |i5-12500H|8GB|512GB|RTX 3050 Ti|Win11- Hàng chính hãng\",\n            \"quantity\": 3\n        }\n    ],\n    \"total\": 0,\n    \"voucher\": {\n        \"voucherID\": \"string\",\n        \"voucherName\": \"string\",\n        \"voucherDiscount\": 0.2,\n        \"expiryDate\": \"date time\",\n        \"description\": \"date\"\n    }\n}\n```\n### Comment routes: /api/comment/\n\u003e[GET] ?productID=1\u0026sortMode=DESC\n- Respone\n```json\n[\n    {\n        \"commentID\":1,\n        \"userID\": 1,\n        \"avatar\":\"1682648528080-hoaian_admin.jpeg\",\n        \"userFirstName\":\"Hoài Ân\",\n        \"userLastName\":\"Lê\",\n        \"productID\":1,\n        \"comment\":\"test comment xem nó hiển thị ra sao\\n:))))))))\",\n        \"rate\":null,\n        \"commentDate\":\"2023-04-27T17:00:00.000Z\"\n    }\n]\n```\n\u003e[POST] /:id JWT require\n- Request\n```json\n{\n    \"content\": \"string\"\n}\n```\n\u003e[DELETE] / JWT require\n- Request: ?commentID?productID\n- Respone: HTTP status code\n### Rating routes: /api/rating/\n\u003e[GET] /:productID JWT require\n- Respone\n```json\n{\n    \"rate\": 3\n}\n```\n\u003e[POST]  JWT require\n- Request\n```json\n{\n    \"productID\": 1,\n    \"rate\": 3\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaian2%2Ftech-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoaian2%2Ftech-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaian2%2Ftech-store/lists"}