{"id":18113780,"url":"https://github.com/fraidev/hash-challenge","last_synced_at":"2026-04-09T02:31:24.648Z","repository":{"id":116054033,"uuid":"360215124","full_name":"fraidev/hash-challenge","owner":"fraidev","description":"GO and Node.js microservices that calculate custom product discounts per user","archived":false,"fork":false,"pushed_at":"2021-04-30T22:31:06.000Z","size":322,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T19:33:49.061Z","etag":null,"topics":["golang","grpc","javascript","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","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/fraidev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2021-04-21T15:15:19.000Z","updated_at":"2021-04-30T22:31:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb71df25-4a24-4e9b-9eea-ec9416040d1b","html_url":"https://github.com/fraidev/hash-challenge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fraidev/hash-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraidev%2Fhash-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraidev%2Fhash-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraidev%2Fhash-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraidev%2Fhash-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fraidev","download_url":"https://codeload.github.com/fraidev/hash-challenge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraidev%2Fhash-challenge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31582590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"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":["golang","grpc","javascript","nodejs","typescript"],"created_at":"2024-11-01T02:09:56.973Z","updated_at":"2026-04-09T02:31:24.630Z","avatar_url":"https://github.com/fraidev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hash-challenge\n\n## Introduction \nThis project proposes two microservices working together to display a product list with discounts per users.\n\nThe first microservice is the product service, written with Typescript, using NodeJS. \n\nThe second microservice is the discount service, written with GO Language.\n\nIn this monorepo we also have a another project, the proto-generator, written with Typescript and NodeJS, that project take the proto file and generate the GRPC interfaces for both services.\n\n## Flow\n\nThe product service has a web service with only one endpoint, the \"/product\". This endpoint expect to receive user id as header request. This service will get all the products from database and send via GRPC only the product ids to discount service with the user id. The discount service will get the user and produts from database by ids, and will calculate the discount with a rule engine. After will response de product service with the value and percentage of the discount. And finaly product service will response the web request with a json of all products and their discounts.\n\n\n## How to execute / Deploy\n\n### Requirements\n* docker\n* docker-compose\n\nRuns product service, discount service, postgres database and apply some records in database. Everything inside the Dockers containers.\n\n```sh\ngit clone https://github.com/fraifelipe/hash-challenge\n\ncd hash-challenge\n\ndocker-compose up --build -d\n```\n\n## How to Test\n\nBirth date case\n```sh\ncurl -H \"USER-ID: 9f4abbe9-113c-4099-8bef-2184d030f2c3\" localhost:8080/product\n```\n\nNot birth date case\n```sh\ncurl -H \"USER-ID: 3f045e1b-3ff7-429c-9ca1-e4e7585b48a6\" localhost:8080/product\n```\n\n## Disclaimer\nThis project has tests, but all database intergration tests only make sense with a database with the records that is in populate script. In real world projects normaly has tests that add more records and check if this records were added. But in this project only get records is a requirement, thus, that don't have add records methods and I only check the records from script.\n\nNormally at a bigger project I would add a library or struct for helps with DI and IOC, helping scaling the code and to test, but I didn't see a code smell or difficult to test in this small project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraidev%2Fhash-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffraidev%2Fhash-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraidev%2Fhash-challenge/lists"}