{"id":42686415,"url":"https://github.com/letsramp/sample-microservices","last_synced_at":"2026-01-29T12:24:12.028Z","repository":{"id":131746679,"uuid":"601835344","full_name":"letsramp/sample-microservices","owner":"letsramp","description":"Sample cloud-first application forked from GoogleCloudPlatform/microservices-demo with added support for REST and Thrift APIs.","archived":false,"fork":false,"pushed_at":"2025-10-07T16:52:07.000Z","size":36824,"stargazers_count":14,"open_issues_count":0,"forks_count":13,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-10-07T18:36:46.329Z","etag":null,"topics":["cloud-native","cloud-native-microservices","grpc","rest","test","test-automation","testing","testing-tools","thrift","thrift-client","thrift-protocol","thrift-server"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/letsramp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","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":"2023-02-14T23:27:31.000Z","updated_at":"2025-10-07T16:37:24.000Z","dependencies_parsed_at":"2025-07-11T19:22:04.117Z","dependency_job_id":"82b1affd-7650-4a0b-b25e-12bfe7868a26","html_url":"https://github.com/letsramp/sample-microservices","commit_stats":{"total_commits":811,"total_committers":115,"mean_commits":7.052173913043478,"dds":0.7040690505548706,"last_synced_commit":"a99d7a76d536a9e176a57b9716ecf2c4fa2fba75"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/letsramp/sample-microservices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsramp%2Fsample-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsramp%2Fsample-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsramp%2Fsample-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsramp%2Fsample-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/letsramp","download_url":"https://codeload.github.com/letsramp/sample-microservices/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsramp%2Fsample-microservices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28877612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"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":["cloud-native","cloud-native-microservices","grpc","rest","test","test-automation","testing","testing-tools","thrift","thrift-client","thrift-protocol","thrift-server"],"created_at":"2026-01-29T12:24:10.304Z","updated_at":"2026-01-29T12:24:12.018Z","avatar_url":"https://github.com/letsramp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"- [Introduction](#introduction)\n  - [Use Cases](#use-cases)\n  - [Implementation](#implementation)\n- [Usage](#usage)\n  - [1. Install pre-requisite tools](#1-install-pre-requisite-tools)\n  - [2. Clone sample services](#2-clone-sample-services)\n  - [3. Build and Push Images (Optional)](#3-build-and-push-images-optional)\n    - [Build images from source](#build-images-from-source)\n    - [Push services to container registry](#push-services-to-container-registry)\n  - [4. Deploy](#4-deploy)\n  - [5. Interacting with the microservices](#5-interacting-with-the-microservices)\n    - [Add to cart using gRPC API](#add-to-cart-using-grpc-api)\n    - [Add to cart using REST API](#add-to-cart-using-rest-api)\n    - [Add to cart using Thrift API](#add-to-cart-using-thrift-api)\n    - [Verify contents of cart](#verify-contents-of-cart)\n  - [6. Exploring the demo tests](#6-exploring-the-demo-tests)\n    - [Running the tests from the Skyramp CLI](#running-the-tests-from-the-skyramp-cli)\n    - [Creating or generating tests](#creating-or-generating-tests)\n- [Contributing Code](#contributing-code)\n\n\n# Introduction\n\nThis is a demo project based on [GCP Online Boutique](https://github.com/GoogleCloudPlatform/microservices-demo) with added support for REST and Thrift APIs. It is designed to be used during cloud-native development for testing across different APIs–REST, gRPC, and Thrift. It is extensible in support of future functionality (e.g. GraphQL).\n\n## Use Cases\n\n1. Use as a test project for developing cloud-native dev tools.\n2. Learn how to implement Thrift (and REST) support for an existing project.\n\nImplemented by the [Skyramp](https://skyramp.dev) team.\n\n## Implementation\nFor each microservice in the repo, REST and Thrift implementations open up separate ports to listen to the corresponding traffic. Implementations are in the `rest.go` and `thrift.go` files in the top-level directory for each service. \n\nDefault ports for REST and Thrift are hardcoded in the `main.go` file in each service directory. For example, the `carts` microservice has the following ports defined:\n\n```\nconst (\n\tserverCrt         = \"server.crt\"\n\tserverKey         = \"server.key\"\n\tdefaultThriftPort = \"50000\"\n\tdefaultRestPort   = \"60000\"\n)\n```\n# Usage\n\n## 1. Install pre-requisite tools\n- docker\n- curl (required for REST)\n- jq (optional)\n- kubectl (optional)\n\n\n## 2. Clone sample services\n```\ngit clone https://github.com/letsramp/sample-microservices.git\ncd sample-microservices/src\n```\n\n## 3. Build and Push Images (Optional)\n\nImages for sample-microservices are already available in a publically accessible registry. To use your own registry, follow these steps.\n\n### Build images from source \n```\ndocker compose build\n```\n\n### Push services to container registry\nUpdate the host path/s in the docke-compose.yaml file to point to your own docker registry. Push images by running:\n\n```\ndocker compose push\n```\n\n## 4. Deploy\n\nDeploy Online Boutique by running the following command:\n\n```\ndocker compose up\n```\nNow, familiarize yourself with the application by navigating to http://127.0.0.1:8080 on your browser.\n\n\u003cbr/\u003e\u003cbr/\u003e\n\u003cimg width=\"1728\" alt=\"Online Boutique\" src=\"https://user-images.githubusercontent.com/1672645/217123094-00e455d5-316d-44f3-8e80-b56da07b668d.png\"\u003e\n\u003cbr/\u003e\u003cbr/\u003e\n\n\u003e 📝 **NOTE:** If you are using Docker Desktop, you can look at the logs for `cart service` to see that we've opened up separate ports for gRPC(7070), REST(60000), and Thrift(50000) traffice to the service. \n\n\n\u003cimg width=\"1127\" alt=\"carts-ports\" src=\"https://user-images.githubusercontent.com/1672645/217123495-9a516fe5-3bf1-4e97-bd46-2270ae130df6.png\"\u003e\n\n\n## 5. Interacting with the microservices\n\nTo demonstrate the REST and Thrift implementations, we've created simple clients (`src/clients`) for the \"add to cart\" scenario for each of the APIs. The client code is accessible from the `clients` container in the cluster.\n\nTo connect to the `clients` container, run the following command in your terminal:\n\n```\ndocker compose exec -it clients ash\n```\n\nOptionally, you can download and install [Docker Desktop](https://www.docker.com/products/docker-desktop/) to follow along.\n\nIf you are using Docker Desktop, click on the `clients_1` container and go to the CLI from there.\n\n\u003cimg width=\"1122\" alt=\"CLI for the clients container\" src=\"https://user-images.githubusercontent.com/1672645/217331154-3be0e78b-3c22-43c3-bdb2-ac5b5365c50b.png\"\u003e\n\n\n### Add to cart using gRPC API\n\n1. In the `clients` container, navigate to the grpc/golang folder and download the required `go` modules.\n```\ncd /grpc/golang\ngo mod download\n```\n\n2. In the `addCart.go` file, you will notice that we open a connection to port 7070 of `cart` microservice which listens to grpc traffic. \n\n```\nconn, err := grpc.Dial(\"cartservice:7070\", grpc.WithInsecure())\n```\n\n3. Run the code in the file to add an item to the cart.\n\n```\ngo run ./cmd/cart\n```\nExpected result\n```\nSuccessfully added the item to the cart.\n```\n\nHaving seen how to successfully add an item to the cart with a gRPC client calling the gRPC endpoint, we can see how to do the same through the REST and Thrift endpoints.\n\n### Add to cart using REST API\n\nSince cURL is already installed in the `clients` container, you can issue a request directly from the CLI of the container to add an item to the cart.\n\n```\ncurl -X 'POST' 'http://cartservice:60000/cart/user_id/abcde' \\\n  -H 'accept: application/json' \\\n  -H 'content-type: application/json' \\\n  -d '{\n  \"product_id\": \"OLJCESPC7Z\",\n  \"quantity\": 1\n}'\n```\n\nAgain, notice that the request is being sent to port `60000` of `cart` microservice which listens to REST traffic.\n\nResult\n\n```\n{\"success\":\"200 OK\"}\n```\n\n### Add to cart using Thrift API\n\n1. In the `clients` container, navigate to the thrift/golang folder and download the required `go` modules for the Thrift client.\n\nSetup\n```\ncd /thrift/golang\ngo mod download\n```\n\n2. In the `addCart.go` file, you will notice that we open a connection to port 50000 of `cart` microservice which listens to Thrift traffic. \n\n```\nclientAddr := \"cartservice:50000\"\n```\n\n3. Now, run the code in the file to add an item to the cart.\n\n```\ngo run ./cmd/cart\n```\n\nResult:\n\n```\n\"Successfully added the item to the cart.\"\n```\n\n\n### Verify contents of cart\n\nYou can now fetch the contents of the cart using REST API to see that a total of 3 items were added (one using each supported API).\n\n```\ncurl -X 'GET' \\\n  'http://cartservice:60000/cart/user_id/abcde' \\\n   -H 'accept: application/json'\n```\n\nResult:\n\n```\n{\"user_id\":\"abcde\",\"items\":[{\"product_id\":\"OLJCESPC7Z\",\"quantity\":3}]}\n```\n\n## 6. Exploring the demo tests\n\nThis repo contains a number of test scenarios used for demo purposes. These test scenarios are located under the `skyramp` folder in `grpc-demo`, `rest-demo`, and `thrift-demo`. The test scenarios can be run using the Skyramp client. Visit the [Skyramp Docs](https://skyramp.dev/docs/get-started/install-client/) for instructions on installing the Skyramp client.\n\n### Running the tests from the Skyramp CLI\n\nOnce the microservices have been deployed to a cluster, you can run the demo tests with the Skyramp CLI. See the [Walkthrough](https://skyramp.dev/docs/get-started/walkthrough/) in the Skyramp Docs for one method of deployment with Skyramp Deployer.\n\nTo run the tests for the REST demo, as an example, navigate to the `rest-demo` folder in a terminal:\n```bash\ncd sample-microservices/skyramp/rest-demo\n```\nYou can see the existing test description files under `tests`:\n```bash\ncheckout-test.yaml\ntest-load.yaml       \ntest-trace-bOl4.yaml\n```\nRunning the `checkout-test` test with Skyramp Tester...\n```bash\nskyramp tester checkout-test -n test-rest-demo\n```\nWill produce output similar to this:\n```bash\nStarting tests\nTester finished\nTest [REST] Checkout system testcase------\n [Status: finished] [Started at: 2023-11-04 16:41:21 PDT] [End: 2023-11-04 16:41:22 PDT] [Duration: 1s]\n  - pattern0.scenario1\n    [Status: finished] [Started at: 2023-11-04 16:41:22 PDT] [Duration: 0s]\n  - pattern0.scenario1.0.addCartRequest\n    [Status: finished] [Started at: 2023-11-04 16:41:22 PDT] [Duration: 0s]\n    Executed: {\"success\":\"200 OK\"}\n  - pattern0.scenario1.1.getCartRequest\n    [Status: finished] [Started at: 2023-11-04 16:41:22 PDT] [Duration: 0s]\n    Executed: {\"user_id\":\"abcde\",\"items\":[{\"product_id\":\"OLJCESPC7Z\",\"quantity\":2}]}\n  - pattern0.scenario1.2.assert\n    [Status: finished] [Started at: N/A]\n    Assert: requests.getCartRequest.res.user_id == \"abcde\"\n    Passed: true\n  - pattern0.scenario1.3.checkoutRequest\n    [Status: finished] [Started at: 2023-11-04 16:41:22 PDT] [Duration: 0s]\n    Executed: {\"order_id\":\"1cae99ba-f22e-42cd-8b4d-79160ef3ae72\",\"shipping_tracking_id\":\"2c287fac-104a-4a4b-a3fc-32f1ec3a7495\",\"shipping_cost\":{\"currency_code\":\"USD\",\"units\":10,\"nanos\":100},\"shipping_address\":{\"street_address\":\"1600 Amp street\",\"city\":\"Mountain View\",\"state\":\"CA\",\"country\":\"USA\"},\"items\":[{\"item\":{\"product_id\":\"OLJCESPC7Z\",\"quantity\":2}}]}\n  - pattern0.scenario1.4.assert\n    [Status: finished] [Started at: N/A]\n    Assert: requests.checkoutRequest.res.items[0].item.product_id == \"OLJCESPC7Z\"\n    Passed: true\n```\n### Creating or generating tests\n\nTest files can be created manually or generated using the `skyramp generate` command. The test files can then be edited and customized for your specific testing requirements. For more information on creating or generating tests, see the Skyramp Docs covering the [Test Description](https://www.skyramp.dev/docs/tester/test-description/) and the specific [CLI command - tester generate](https://www.skyramp.dev/docs/reference/cli-commands/tester/generate/).\n\nNotice from the Skyramp docs that there are a number of possible options for generating tests. Tests can be generated using an API schema definition with [OpenAPI](https://www.openapis.org) or [Protocol Buffers](https://protobuf.dev) as well as with telemetry trace data from an observability provider like [Pixie](https://px.dev).\n\nYou will see in the `skyramp/rest-demo` folder in this repo that there are `openapi` and `trace` folders containing example input files for generating tests.  The `test-trace-bOl4.yaml` demo test description was generated from trace data. Here are a few examples to illustrate test generation options with various inputs:\n\n```bash\nskyramp tester generate \\\n--trace-file trace/trace.json\n```\n```bash\nskyramp tester generate \\\n--protocol openapi \\\n--api-schema openapi/demo.yaml \\\n--alias test-rest-demo \\\n--port 60000\n```\n```bash\nskyramp tester generate \\\n--telemetry-provider pixie \\\n--cluster-id cluster-id \\\n--namespace namespace \\\n--start-time \"-5m\" \n```\n```bash\nskyramp tester generate grpc \\\n--api-schema file.proto \\\n--alias namespace \\\n--port port \\\n--service service\n```\n\n# Contributing Code\n\nPRs are welcome!  \n\nThis project follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md) .\n\n\u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletsramp%2Fsample-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletsramp%2Fsample-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletsramp%2Fsample-microservices/lists"}