{"id":20839751,"url":"https://github.com/pranavarora1895/hardwarehouseinventory","last_synced_at":"2025-07-25T17:34:10.089Z","repository":{"id":52407207,"uuid":"520963451","full_name":"pranavarora1895/hardWareHouseInventory","owner":"pranavarora1895","description":"An inventory management app for a hypothetical shop hardWareHouse that uses Redis as its primary database.","archived":false,"fork":false,"pushed_at":"2024-10-18T00:25:39.000Z","size":840,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-08T21:44:38.810Z","etag":null,"topics":["bootstrap","crud-application","devto","flask","react","redis","redishackathon"],"latest_commit_sha":null,"homepage":"https://youtu.be/ahwKhVpx3OQ","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pranavarora1895.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"pranavarora1895","thanks_dev":null,"custom":null}},"created_at":"2022-08-03T16:56:15.000Z","updated_at":"2024-10-18T00:25:42.000Z","dependencies_parsed_at":"2024-08-25T01:32:59.136Z","dependency_job_id":"018a1977-84da-4640-972d-da73663bf923","html_url":"https://github.com/pranavarora1895/hardWareHouseInventory","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pranavarora1895/hardWareHouseInventory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavarora1895%2FhardWareHouseInventory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavarora1895%2FhardWareHouseInventory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavarora1895%2FhardWareHouseInventory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavarora1895%2FhardWareHouseInventory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pranavarora1895","download_url":"https://codeload.github.com/pranavarora1895/hardWareHouseInventory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavarora1895%2FhardWareHouseInventory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260380298,"owners_count":23000242,"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":["bootstrap","crud-application","devto","flask","react","redis","redishackathon"],"created_at":"2024-11-18T01:14:21.434Z","updated_at":"2025-06-17T14:35:32.772Z","avatar_url":"https://github.com/pranavarora1895.png","language":"JavaScript","funding_links":["https://buymeacoffee.com/pranavarora1895"],"categories":[],"sub_categories":[],"readme":"# hardWareHouse Inventory Management Application \n\n## Runner-up of Redis x DevTo Competition. View here -\u003e [![devto-runner-up](https://github.com/pranavarora1895/hardWareHouseInventory/assets/48170643/65166f0d-5f02-4878-ac36-30c5aa042ed0)](https://dev.to/devteam/redis-hackathon-winners-announced-524d)\n\n\nAn inventory management application for a shop to keep the track of its products data. It uses Redis as its primary database, Flask as the backend that connects with Redis, and React as the frontend that renders the data on the browser.\n\n| ![architecture](https://user-images.githubusercontent.com/48170643/183287691-e1d6f7c1-59b4-4dfc-a289-a8804d98410f.png) |\n|:--:|\n\n| ![appPage](https://user-images.githubusercontent.com/48170643/183287720-2631aeeb-e3f8-40a5-aeea-bb0b41feba84.JPG) |\n|:--:|\n| *hardWareHouse Inventory Dashboard* |\n\n| ![newProduct](https://user-images.githubusercontent.com/48170643/183287718-b986896f-8bd0-4c2b-a24a-92250b6561b4.JPG) |\n|:--:|\n| *Way to Add a new Product* |\n\n| ![editProduct](https://user-images.githubusercontent.com/48170643/183287721-af856e0a-9e44-4cbf-81ba-9448d1048621.JPG) |\n|:--:|\n| *Way to Update any Product* |\n\n| ![searchProduct](https://user-images.githubusercontent.com/48170643/183287779-cf23fc53-c7ed-46d2-a47c-360715bddbdb.JPG) |\n|:--:|\n| *Search a Product and the table will render accordingly* |\n\n# Overview video\n\nHere's a short video that explains the project and how it uses Redis:\n\n[![hardwarehouseYoutubeThumbnail](https://user-images.githubusercontent.com/48170643/183334490-ba865a00-b4b2-4d90-bf52-09560e929d73.png)](https://youtu.be/ahwKhVpx3OQ)\n\n## Technical Stack\n\n- Database: *Redis*\n- Backend: *Flask*\n- Frontend: *React*\n\n## How it works\n\n### How the data is stored:\n\n- From `redis_om` module, following are used to create the `Product` schema:\n  - `JsonModel`\n  - `Field`\n\n- The product data is stored in various keys and various data types.\n  - product_name: str\n  - product_desc: str\n  - price: PositiveInt\n  - units: PositiveInt\n  - lower_limit_stock: PositiveInt\n  - timestamp: datetime\n  \n```python\nfrom redis_om import Field, JsonModel\nfrom pydantic import PositiveInt\nfrom datetime import datetime\n# Added Product Schema\n\n\nclass Product(JsonModel):\n\n    product_name: str = Field(index=True, full_text_search=True)\n    product_desc: str = Field(index=True)\n    price: PositiveInt = Field(index=True)\n    units: PositiveInt = Field(index=True)\n    lower_limit_stock: PositiveInt = Field(index=True)\n    timestamp: datetime = Field(index=True, default=datetime.now())\n```\n| ![newProduct](https://user-images.githubusercontent.com/48170643/183287718-b986896f-8bd0-4c2b-a24a-92250b6561b4.JPG) |\n|:--:|\n| *Way to Add a new Product* |\n\n- When user clicks on the `Add Product` button on the dashboard, the `addProduct` method triggers the following `POST` request from the frontend.\n```js\n  const addProduct = async (product_name, product_desc, price, units, lower_limit_stock) =\u003e {\n    // POST API Call\n    try {\n      const url = `${host}/product/new`;\n      const response = await fetch(url, {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n        },\n\n        body: JSON.stringify({\n          product_name,\n          product_desc,\n          price: parseInt(price),\n          units: parseInt(units),\n          lower_limit_stock: parseInt(lower_limit_stock),\n        }),\n      });\n      const json = await response.json();\n    } catch (error) {\n      console.error(error);\n    }\n  };\n  ```\n- This invokes the `create_product()` method in the backend that handles the `POST` request. It performs the relevant validations and then saves the data in the database.\n```python\n@app.route(\"/product/new\", methods=[\"POST\"])\ndef create_product():\n    try:\n        print(request.json)\n        new_product = Product(**request.json)\n        new_product.save()\n        return json.dumps(new_product.pk)\n\n    except ValidationError as e:\n        print(e)\n        return \"Bad request.\", 400\n```\n\n- The product update also follows the similar pattern.\n\n- Sample data stored: `Key Name: :product.Product:01G9W6KP7S4K3DS3BRD5AEREDX`\n```js\n{\npk: \"01G9VZ5C9PPXF3WYYB7JYN8WAR\",\nproduct_name: \"Mechanical Keyboard\",\nproduct_desc: \"Built for extensive typing\",\nprice: 8250,\nunits: 23,\nlower_limit_stock: 5,\ntimestamp: \"2022-08-07T16:25:04.834860\",\n}\n```\n\n### How the data is accessed:\n\n- The `GET` request is initiated from the frontend.\n```js\n   const getAllProducts = async () =\u003e {\n    try {\n      const url = `${host}/product/fetchall/`;\n      const response = await fetch(url, {\n        method: \"GET\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n        },\n      });\n      const json = await response.json();\n    } catch (error) {\n      console.error(error);\n    }\n  };\n  ```\n- This invokes the `fetch_all_products()` method in the backend that handles the `GET` request. It sorts the data by `timestamp` in descending order and returns an array of fetched products.\n```python\n@app.route(\"/product/fetchall/\", methods=[\"GET\"])\ndef fetch_all_products():\n    products = Product.find().sort_by(\"-timestamp\").all()\n    return build_results(products)\n```\n\n## How to run it locally?\n\n### Prerequisites\n\n- Python - v3.8.5\n- Docker - v20.10.17\n- Nodejs - v8.11.0\n\n### Local installation\n\n1. Clone the repository from github\n```shell\n\ngit clone https://github.com/pranavarora1895/hardWareHouseInventory.git\n```\n2. **Server Side:** _Make sure your **docker** is up and running._ Go to `hardWareHouseInventory\\hardWareHouseInventory\\` folder and then:\n```shell\n# Go to server side\ncd .\\hardWareHouseInventory\\hardWareHouseInventory\\\n\n# Get redis image\ndocker compose up -d\n\n# Create virtual env\npython -m venv venv\n\n# Activate env for powershell\n.\\venv\\Scripts\\Activate.ps1\n\n# Install dependencies\npip install -r requirements.txt\n\n# Run server\nflask run\n```\n3. To load some sample data, run `productsloader.py` script in the `hardWareHouseInventory\\hardWareHouseInventory\\` folder:\n```shell\n# Open a new PowerShell window\ncd .\\hardWareHouseInventory\\hardWareHouseInventory\\\n\n.\\venv\\Scripts\\Activate.ps1\n\npython .\\productsloader.py\n\n# After loading the products, you can close that powershell window\n```\n4. **Client Side**: Go to `hardWareHouseInventory\\hardwarehouse-dashboard\\` folder and then:\n```shell\n# Open another powershell window\ncd .\\hardWareHouseInventory\\hardwarehouse-dashboard\\\n\n# Install dependencies\nnpm install\n\n# Start the client server\nnpm run start\n```\n\n---\n\n## Thank You!!\n\n### Let's get connected:\n\n[![devto](https://img.shields.io/badge/dev.to-0A0A0A?style=for-the-badge\u0026logo=devdotto\u0026logoColor=white)](https://dev.to/dashboard)\n[![facebook](https://img.shields.io/badge/Facebook-1877F2?style=for-the-badge\u0026logo=facebook\u0026logoColor=white)](https://www.facebook.com/cosmicpranav007/)\n[![linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/in/pranav-arora-354b71bb/)\n[![instagram](https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge\u0026logo=instagram\u0026logoColor=white)](https://www.instagram.com/arorapranav187/)\n\n#### :hourglass_flowing_sand: *Time taken to build this app:* [![wakatime](https://wakatime.com/badge/user/e72a1859-4793-4da2-b36b-49c7378256a0/project/e60d1b21-00c0-4f29-bfba-5f5175700f5a.svg)](https://wakatime.com/@pranavarora1895/projects/jzwipwmfui?start=2022-08-02\u0026end=2022-08-09)\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavarora1895%2Fhardwarehouseinventory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpranavarora1895%2Fhardwarehouseinventory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavarora1895%2Fhardwarehouseinventory/lists"}