{"id":38366253,"url":"https://github.com/smiletrl/micro_ecommerce","last_synced_at":"2026-01-17T03:24:01.051Z","repository":{"id":51328150,"uuid":"337995885","full_name":"smiletrl/micro_ecommerce","owner":"smiletrl","description":"an ecommerce application with micro service infrastructure","archived":false,"fork":false,"pushed_at":"2021-07-12T01:14:09.000Z","size":10972,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-17T04:45:18.601Z","etag":null,"topics":["ecommerce","golang","grpc","istio","kubernetes","micro-service","minikube","mongodb","postgressql","rocketmq"],"latest_commit_sha":null,"homepage":"","language":"Go","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/smiletrl.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}},"created_at":"2021-02-11T10:26:28.000Z","updated_at":"2024-05-23T05:45:41.000Z","dependencies_parsed_at":"2022-09-10T18:00:42.669Z","dependency_job_id":null,"html_url":"https://github.com/smiletrl/micro_ecommerce","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/smiletrl/micro_ecommerce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smiletrl%2Fmicro_ecommerce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smiletrl%2Fmicro_ecommerce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smiletrl%2Fmicro_ecommerce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smiletrl%2Fmicro_ecommerce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smiletrl","download_url":"https://codeload.github.com/smiletrl/micro_ecommerce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smiletrl%2Fmicro_ecommerce/sbom","scorecard":{"id":833450,"data":{"date":"2025-08-11","repo":{"name":"github.com/smiletrl/micro_ecommerce","commit":"a470c86064d309894a0904d85cac5b7d11b686b0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/smiletrl/micro_ecommerce/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/smiletrl/micro_ecommerce/ci.yml/master?enable=pin","Warn: containerImage not pinned by hash: service.cart/Dockerfile:1","Warn: containerImage not pinned by hash: service.cart/Dockerfile:16: pin your Docker image by updating alpine:3.13.4 to alpine:3.13.4@sha256:ec14c7992a97fc11425907e908340c6c3d6ff602f5f13d899e6b7027c9b4133a","Warn: containerImage not pinned by hash: service.customer/Dockerfile:1","Warn: containerImage not pinned by hash: service.customer/Dockerfile:16: pin your Docker image by updating alpine:3.13.4 to alpine:3.13.4@sha256:ec14c7992a97fc11425907e908340c6c3d6ff602f5f13d899e6b7027c9b4133a","Warn: containerImage not pinned by hash: service.order/Dockerfile:1","Warn: containerImage not pinned by hash: service.order/Dockerfile:15: pin your Docker image by updating alpine:3.13.4 to alpine:3.13.4@sha256:ec14c7992a97fc11425907e908340c6c3d6ff602f5f13d899e6b7027c9b4133a","Warn: containerImage not pinned by hash: service.payment/Dockerfile:1","Warn: containerImage not pinned by hash: service.payment/Dockerfile:15: pin your Docker image by updating alpine:3.13.4 to alpine:3.13.4@sha256:ec14c7992a97fc11425907e908340c6c3d6ff602f5f13d899e6b7027c9b4133a","Warn: containerImage not pinned by hash: service.product/Dockerfile:1","Warn: containerImage not pinned by hash: service.product/Dockerfile:15: pin your Docker image by updating alpine:3.13.4 to alpine:3.13.4@sha256:ec14c7992a97fc11425907e908340c6c3d6ff602f5f13d899e6b7027c9b4133a","Warn: goCommand not pinned by hash: vendor/github.com/json-iterator/go/build.sh:10","Warn: goCommand not pinned by hash: vendor/google.golang.org/grpc/regenerate.sh:35","Warn: goCommand not pinned by hash: vendor/google.golang.org/grpc/vet.sh:38","Warn: goCommand not pinned by hash: vendor/google.golang.org/grpc/vet.sh:48","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of  10 containerImage dependencies pinned","Info:   4 out of   8 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":0,"reason":"74 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2020-0017 / GHSA-w73w-5m7g-f7qc","Warn: Project is vulnerable to: GO-2021-0053 / GHSA-c3h9-896r-86jm","Warn: Project is vulnerable to: GO-2024-2605 / GHSA-m7wr-2xf7-cm9p","Warn: Project is vulnerable to: GO-2024-2606 / GHSA-7jwh-3vrq-q3m8 / GHSA-mrww-27vc-gghv","Warn: Project is vulnerable to: GO-2022-1031 / GHSA-crxj-hrmp-4rwf","Warn: Project is vulnerable to: GO-2021-0112 / GHSA-f6mq-5m25-4r72","Warn: Project is vulnerable to: GO-2022-0968 / GHSA-gwc9-m7rh-j2ww","Warn: Project is vulnerable to: GO-2021-0356 / GHSA-8c26-wmh5-6g9v","Warn: Project is vulnerable to: GO-2024-2961","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2021-0113 / GHSA-ppp9-7jff-5vj2","Warn: Project is vulnerable to: GO-2022-1059 / GHSA-69ch-w2m2-3vjp","Warn: Project is vulnerable to: GO-2023-2153 / GHSA-m425-mq94-257g / GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2611 / GHSA-8r3f-844c-mc37","Warn: Project is vulnerable to: GO-2022-0236 / GHSA-h86h-8ppg-mxmh","Warn: Project is vulnerable to: GO-2021-0238 / GHSA-83g2-8m93-v3w7","Warn: Project is vulnerable to: GO-2022-0288","Warn: Project is vulnerable to: GO-2022-0969 / GHSA-69cg-p879-7622","Warn: Project is vulnerable to: GO-2022-1144 / GHSA-xrjj-mj9h-534m","Warn: Project is vulnerable to: GO-2023-1571 / GHSA-vvpx-j8f3-3w6h","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw","Warn: Project is vulnerable to: GO-2022-0493 / GHSA-p782-xgp4-8hr8","Warn: Project is vulnerable to: GO-2022-0762 / GHSA-3x58-xr87-2fcj","Warn: Project is vulnerable to: GO-2022-0588 / GHSA-x95h-979x-cf3j","Warn: Project is vulnerable to: GO-2022-0536 / GHSA-39qc-96h7-956f / GHSA-hgr8-6h9x-f7q9","Warn: Project is vulnerable to: GO-2020-0036 / GHSA-wxc4-f4m6-wwqv","Warn: Project is vulnerable to: GO-2022-0391 / GHSA-6jvc-q2x7-pchv / GHSA-76wf-9vgp-pj7w","Warn: Project is vulnerable to: GO-2022-0635 / GHSA-7f33-f4f5-xwgw","Warn: Project is vulnerable to: GO-2022-0646 / GHSA-f5pg-7wfw-84q9","Warn: Project is vulnerable to: GO-2022-0784 / GHSA-36xw-fx78-c5r4","Warn: Project is vulnerable to: GHSA-6g2q-w5j3-fwh4","Warn: Project is vulnerable to: GO-2022-0921 / GHSA-c72p-9xmj-rx3w","Warn: Project is vulnerable to: GO-2022-0938 / GHSA-c2h3-6mxw-7mvq","Warn: Project is vulnerable to: GO-2022-0360 / GHSA-5j5w-g665-5m35","Warn: Project is vulnerable to: GO-2022-0344 / GHSA-crp2-qrr5-8pq7","Warn: Project is vulnerable to: GO-2024-2846 / GHSA-c9cp-9c75-9v8c","Warn: Project is vulnerable to: GO-2022-0482 / GHSA-5ffw-gxpp-mxpf","Warn: Project is vulnerable to: GO-2022-1147 / GHSA-2qjp-425j-52j9","Warn: Project is vulnerable to: GO-2023-1573 / GHSA-259w-8hf6-59c2","Warn: Project is vulnerable to: GO-2023-1574 / GHSA-hmfx-3pcx-653p","Warn: Project is vulnerable to: GO-2023-2412 / GHSA-7ww5-4wqc-m92c","Warn: Project is vulnerable to: GO-2025-3528 / GHSA-265r-hfxg-fhmg","Warn: Project is vulnerable to: GHSA-j249-ghv5-7mxv","Warn: Project is vulnerable to: GHSA-6hwg-w5jg-9c6x","Warn: Project is vulnerable to: GO-2024-2521","Warn: Project is vulnerable to: GO-2024-2500 / GHSA-3fwx-pjgw-3558","Warn: Project is vulnerable to: GO-2024-2913 / GHSA-v994-f8vw-g7j4","Warn: Project is vulnerable to: GO-2024-2914 / GHSA-xmmx-7jpf-fx42","Warn: Project is vulnerable to: GO-2022-0390 / GHSA-2mm7-x5h6-5pvq","Warn: Project is vulnerable to: GO-2022-0985 / GHSA-rc4r-wh2q-q6c4","Warn: Project is vulnerable to: GO-2022-1107 / GHSA-vp35-85q5-9f25","Warn: Project is vulnerable to: GO-2023-1699 / GHSA-232p-vwff-86mp","Warn: Project is vulnerable to: GO-2023-1700 / GHSA-33pg-m6jh-5237","Warn: Project is vulnerable to: GO-2023-1701 / GHSA-6wrf-mxfj-pf5p","Warn: Project is vulnerable to: GHSA-jq35-85cj-fj4p","Warn: Project is vulnerable to: GHSA-mq39-4gv4-mvpx","Warn: Project is vulnerable to: GO-2024-2512 / GHSA-xw73-rw38-6vjc","Warn: Project is vulnerable to: GO-2025-3829 / GHSA-4vq8-7jfc-9cvp","Warn: Project is vulnerable to: GHSA-fwv2-65wh-2w8c","Warn: Project is vulnerable to: GO-2021-0227 / GHSA-3vm4-22fp-5rfm","Warn: Project is vulnerable to: GO-2022-0197 / GHSA-4r78-hx75-jjj2 / GHSA-mv93-wvcp-7m7r","Warn: Project is vulnerable to: GO-2020-0014 / GHSA-vfw5-hrgq-h5wf","Warn: Project is vulnerable to: GO-2020-0015 / GHSA-5rcv-m4m3-hfh7","Warn: Project is vulnerable to: GO-2022-0229 / GHSA-cjjc-xp8v-855w","Warn: Project is vulnerable to: GO-2020-0012 / GHSA-ffhg-7mh4-33c4","Warn: Project is vulnerable to: GO-2025-3372 / GHSA-6wxm-mpqj-6jpf","Warn: Project is vulnerable to: GO-2025-3488 / GHSA-6v2p-p543-phr9"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T18:21:34.556Z","repository_id":51328150,"created_at":"2025-08-23T18:21:34.556Z","updated_at":"2025-08-23T18:21:34.556Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28492816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T02:39:23.645Z","status":"ssl_error","status_checked_at":"2026-01-17T02:34:19.649Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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","golang","grpc","istio","kubernetes","micro-service","minikube","mongodb","postgressql","rocketmq"],"created_at":"2026-01-17T03:24:00.953Z","updated_at":"2026-01-17T03:24:01.022Z","avatar_url":"https://github.com/smiletrl.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Micro service ecommerce\n\nAn ecommerce application with micro service infrastructure\n\n-------------------------\n- [Reference](#reference)\n- [Technical Stack](#technical-stack)\n- [Background](#background)\n- [Alternative](#alternative)\n- [UI Result](#ui-result)\n- [Services](#services)\n- [Local Installment, development \u0026 deployment](#local-installment-development--deployment)\n- [Project Structure](#project-structure)\n- [Distributed Transaction](#distributed-transaction)\n- [Paid Service](#paid-service)\n-------------------------\n\n### Reference\n- [Go Standard Layout](https://github.com/golang-standards/project-layout)\n- [Micro Service Concept](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-overview-microservices)\n\n### Technical Stack\n- [Golang \u003e= 1.14](https://golang.org/)\n- [PostgreSQL](https://www.postgresql.org/)\n- [MongoDB](https://www.mongodb.com/)\n- [Redis](https://redis.io/)\n- [gRPC](https://github.com/grpc/grpc-go)\n- [MiniKube](https://minikube.sigs.k8s.io/docs/start/)\n- [Kubernetes](https://kubernetes.io/)\n- [Istio](https://istio.io/)\n- [Terraform](https://www.terraform.io/)\n- [RocketMQ](https://rocketmq.apache.org/)\n\n### Background\nThis project shows a simple ecommerce app running based on micro service architecture. It could run in a local environment with miniKube for local development. The primary language is Golang for these micro services. Kubernetes \u0026 istio are used for service register \u0026 discovery.\n\nIdeally, each service would have its own database. In this project, one database, especially postgresSQL will be shared among a few services. But each service will only have access to its own tables.\n\nFor people who are new, but interested in micro service, this project is supposed to provide basic usage for items:\n\n- Kubernetes \u0026 Istio for service register, discovery and more micro service features.\n- gRPC for sync communication between micro services to provide low latency internal service response.\n- RocketMQ for async communication to decouple services to focus on individual service development.\n- Terraform configuration for local development \u0026 deployment. It's supposed to be easily to be migrated to an online cloud environment, such as AWS.\n\n\u003cb\u003eNote:\u003c/b\u003e The main purpose of this project is for micro service architecture demonstration. While different service configuration and code in this project might be a good sample start, every technology will need optimization in real production environments to fit in different project needs, and ecommerce requirements.\n\n### Alternative\nThere're alternative framework solutions, which bring both advantage and disadvantage.\n\n- [Go kit](https://github.com/go-kit/kit)\n- [Go micro](https://github.com/asim/go-micro)\n\n### UI Result\nAfter installment of this project in local, try sending a few sample api requests\n\n```\ncurl -X GET http://127.0.0.1/api/v1/cart_item\ncurl -X POST http://127.0.0.1/api/v1/cart_item\n```\n\nThen the UI result may look like\n\nKubernetes UI\n![Kubernetes UI](https://raw.githubusercontent.com/smiletrl/micro_ecommerce/master/assets/kubernetes%20UI.png)\n\nJaeger UI\n![Jaeger UI](https://raw.githubusercontent.com/smiletrl/micro_ecommerce/master/assets/Jeager%20UI.png)\n\nKiali UI\n![Kiali UI](https://raw.githubusercontent.com/smiletrl/micro_ecommerce/master/assets/Kiali%20UI.png)\n\n### Services\nServices include following at this moment. Different service might use different database \u0026 different language. Right now, Golang is the only language, but python, nodejs or vuejs might be picked for other service, such as analytical, frontend services.\n\nThree databases are used at this moment, Redis, PostgresSQL, MongoDB.\n\nCheck below links for service details. These services are not real functional, but should provide a basic idea on the way.\n\n- [Customer](https://github.com/smiletrl/micro_ecommerce/tree/master/service.customer), Golang \u0026 PostgreSQL\n- [Cart](https://github.com/smiletrl/micro_ecommerce/tree/master/service.cart), Golang \u0026 Redis\n- [Product](https://github.com/smiletrl/micro_ecommerce/tree/master/service.product) Golang \u0026 MongoDB \u0026 gRPC Server\n- [Order](https://github.com/smiletrl/micro_ecommerce/tree/master/service.order), Golang\n- [Payment](https://github.com/smiletrl/micro_ecommerce/tree/master/service.payment), Golang \u0026 RocketMQ\n\nAccording to some big Chinese Companies(Alibaba, [Didi, 2018](https://developer.aliyun.com/article/664608)) reports, kafka could perform poorly when kafka topic numebr has increased above 256. This project is for ecommerce, which has pretty similar business logic like alibaba, so RocketMQ is picked for regular business logic process.\n\n### Local Installment, development \u0026 deployment\n- Install [Docker](https://www.docker.com/)\n- Install [minikube](https://minikube.sigs.k8s.io/docs/start/) (minikube version: v1.19.0 in my mac). After successful installment, start it with command `minikube start` and  enable tunnel with command `minilube tunnel` for load balance. Also, command `minikube dashboard` could be used to enable dashbaord to visiually view kubernetes service \u0026 configurations. If you have played with kubernetes before, you might have file `~/.kube/config` already. To make it simple, mv this config file with a different name before minikube installment, such as `mv ~/.kube/config ~/.kube/config-backup`.\n- Install [Istio](https://istio.io/latest/docs/setup/getting-started/) (client version: 1.9.2 in my mac)\n- Install [Terraform](https://www.terraform.io/) (Terraform v0.14.7 in my mac)\n- Install [RocketMQ](https://rocketmq.apache.org/docs/quick-start/) (version 4.8.0 in my mac). Note, this version only work with JDK 1.8. Choose this jdk version [in mac](https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/). If you want to use JDK1.9+, more adjustment is required. See [issue](https://github.com/apache/rocketmq/issues/2553). The two commands might also be required for installment `mkdir -p ~/store/commitlog/`, `mkdir -p ~/store/consumequeue/`.\n- Install local postgresSQL with command `make db-start`. This will install a local postgresSQL version through docker.\n- Create an account at docker.io(https://hub.docker.com/) if you don't have an account already. Create repositories, such as `docker.io/smiletrl/micro_ecommerce_customer` for customer service defined at this project. Replace `smiletrl` with your own account name. Create other repositories like customer services at hub.docker.com. Then try to replace `docker.io/smiletrl/micro_ecommerce_xxx` with `docker.io/{Your_account_name}/micro_ecommerce_xxx` at `/Mikefile`.\n- Upload local services docker images to docker.io. For example, to upload cart service, run command `make build-cart`. Use similar strategy for other services to upload service docker image to docker.io. Some service might be missing in makefile for build, play with it and see how it works^.\n- Copy content from `/infrastructure/local/envs/dev/terraform.tfvars.example` to `/infrastructure/local/envs/dev/terraform.tfvars`, and replace content `smiletrl` with your own docker hub account name in the tfvars file.\n- Copy content from `/infrastructure/local/terraform.tfvars.example` to `/infrastructure/local/terraform.tfvars`. Run command `minikube ssh 'grep host.minikube.internal /etc/hosts | cut -f1'` to get minikube ssh instance ip for local host in your local machine. Then replace the ip_host value `\"192.168.65.2\"` with your own ip from minikube ssh instance in the new tfvars file.\n- Replace ip value `192.168.65.2` from `/config/k8s.yaml` with your own IP from above step.\n- After above components are set up and running, run command `make terraform`. For online environment, use aws s3 bucket or similar service for remote state. Here, we simply use local state file for local development. If all goes well, this command with terraform will deploy local services to local minikube. You may see these services \u0026 their pods in namespace `dev` in minikube dashboard, or through kubectl. To verify this is working, open `http://127.0.0.1/api/v1/cart_item` in your browser, if you see `succeed!` in the browser, you are successful!\n- Local development can also happen without kubernetes. For example, run `STAGE=/Users/smiletrl/go/src/github.com/smiletrl/micro_ecommerce/config/local.yaml go run service.product/cmd/main.go` to start local product service. Replace `/Users/smiletrl/go/src/github.com/smiletrl/micro_ecommerce/config/local.yaml` with your local path to this local yaml file. Then the service is available at `http:127.0.0.1:1325`.\n- After code changes in service cart, to deploy the change to local kubernetes, use command `make deploy-cart`. Use similar strategy to deploy other services to kubernetes.\n\n### Project Structure\n\n```\ngithub.com/smiletrl/micro_service\n|-- .github\n|-- build\n|-- config\n|   |-- github.yaml\n|   |-- k8s.yaml\n|   |-- local.yaml\n|   |-- prod.yaml\n|-- infrastructure\n|   |-- local\n|   |   |-- host.tf\n|   |   |-- main.tf\n|   |   |-- envs\n|   |   |   |-- dev\n|   |   |   |   |-- cluster.tf\n|   |   |   |   |-- gateway.yaml\n|   |   |   |   |-- main.tf\n|   |   |   |   |-- terraform.tfvars.example\n|   |   |   |   |-- variables.tf\n|   |   |   |   |-- virtual_services.yaml\n|   |-- online\n|   |   |-- prod\n|   |   |-- staging\n|-- migrations\n|   |-- 2021xxxx.down.sql\n|   |-- 2021xxxx.up.sql\n|-- pkg\n|   |-- auth\n|   |-- config\n|   |-- constants\n|   |-- context\n|   |-- entity\n|   |-- errors\n|   |-- healthcheck\n|   |-- jwt\n|   |-- migration\n|   |-- mongodb\n|   |-- postgresql\n|   |-- redis\n|   |-- rocketmq\n|   |-- test\n|-- service.cart\n|-- service.customer\n|-- service.order\n|-- service.payment\n|-- service.product\n|-- testdata\n|-- vendor\n|-- .gitignore\n|-- database.yml\n|-- go.mod\n|-- go.sum\n|-- Makefile\n|-- README.md\n```\n\n## Distributed Transaction\nThis project doesn't add the distributed transaction support. But if you are interested, here're what we recommend:\n\nFor strong consistency scenarios, use [TCC approach](https://www.alibabacloud.com/blog/an-in-depth-analysis-of-distributed-transaction-solutions_597232). For eventual consistency scenarios, consider RocketMQ message.\n\nRocketMQ has supported transaction message natively, which saves big effort to do transaction message.\n\nFor example, once order has paid successfully, we need to do a bunch of things:\n\n```\n------- One TCC transaction -----\n\n1. Change payment service state\n2. Change order service state\n3. Change product sku stock\n\n------ Subscribe to roceketmq message if (1,2,3) succeeds ----\n\n4. Add credit to customer\n5. Add commission to referer\n6. Send notification to staff\n...\n```\n\nIn above process, (1,2,3) can be implemented within TCC one transaction because they need strong consistency. One failed change will break the bussiness, and they need to be just one transaction.\n\n(4,5,6) can be implemented with RocketMQ message. Even one step has failed, it doesn't affect the business flow. With RocketMQ retry and dead-letter-queue, we can finally solve possible issues, and get to the eventual consistency.\n\nIf tcc transaction (1,2,3) has failed, then we won't send rocketmq message. Otherwise, the rocketmq message will be sent out. This flow can be within one RocketMQ transaction message, so we can guarantee (1,2,3) and rocketmq message to be within one transaction.\n\nThis TCC framework https://github.com/opentrx/seata-golang is suggested.\n\n## Paid Service\n\nWe offer paid service for ecommerce application development. [Get in touch](mailto:smiletrl@yahoo.com) if you want to talk ^\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmiletrl%2Fmicro_ecommerce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmiletrl%2Fmicro_ecommerce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmiletrl%2Fmicro_ecommerce/lists"}