{"id":21042721,"url":"https://github.com/yugabytedb-samples/yugastore-java","last_synced_at":"2025-05-15T17:31:03.921Z","repository":{"id":40669182,"uuid":"186942614","full_name":"YugabyteDB-Samples/yugastore-java","owner":"YugabyteDB-Samples","description":"An implementation of a sample e-commerce app composed of microservices written in Spring (Java), a UI based on React, and YugabyteDB as the distributed SQL database.","archived":false,"fork":false,"pushed_at":"2023-07-19T09:20:31.000Z","size":24153,"stargazers_count":148,"open_issues_count":23,"forks_count":66,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-03T12:11:26.445Z","etag":null,"topics":["demos","spring-boot","spring-data-jpa","yugabyte"],"latest_commit_sha":null,"homepage":"","language":"Java","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/YugabyteDB-Samples.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":"2019-05-16T03:15:13.000Z","updated_at":"2025-04-02T09:16:13.000Z","dependencies_parsed_at":"2023-02-15T08:01:11.390Z","dependency_job_id":null,"html_url":"https://github.com/YugabyteDB-Samples/yugastore-java","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/YugabyteDB-Samples%2Fyugastore-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fyugastore-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fyugastore-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fyugastore-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YugabyteDB-Samples","download_url":"https://codeload.github.com/YugabyteDB-Samples/yugastore-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254388052,"owners_count":22062976,"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":["demos","spring-boot","spring-data-jpa","yugabyte"],"created_at":"2024-11-19T14:08:47.268Z","updated_at":"2025-05-15T17:31:02.236Z","avatar_url":"https://github.com/YugabyteDB-Samples.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yugastore in Java\n\n![Homepage](docs/home.png)\nThis is an implementation of a sample ecommerce app. This microservices-based retail marketplace or eCommerce app is composed of **microservices written in Spring (Java)**, a **UI based on React** and **YugabyteDB as the [distributed SQL](https://www.yugabyte.com/tech/distributed-sql/) database**.\n\nIf you're using this demo app, please :star: this repository! We appreciate your support.\n\n## Trying it out\n\nThis repo contains all the instructions you need to [run the app on your laptop](#building-the-app).\n\nYou can also [try the app out](https://yugastore-ui.cfapps.io/) online, it is hosted on [Pivotal Web Services](https://run.pivotal.io/).\n\n# Versions\n\n* Java 17\n* Spring Boot 2.6.3\n* Spring Cloud 2021.0.0\n* Yugabyte Java Driver 4.6.0-yb-10\n* Python 3 (Data Loading)\n\n# Features\n\n* Written fully in Spring Framework\n* Desgined for multi-region and Kubernetes-native deployments\n* Features 6 Spring Boot microservices\n* Uses a discovery service that the microservices register with\n* Sample data has over 6K products in the store\n\n## Architecture\n\nThe architecture diagram of Yugastore is shown below.\n\n![Architecture of microservices based retail marketplace app](yugastore-java-architecture.png)\n\n\n| Microservice         | YugabyteDB API | Default host:port | Description           |\n| -------------------- | ---------------- | ---------------- | --------------------- |\n| [service discovery](https://github.com/yugabyte/yugastore-java/tree/master/eureka-server-local) | - | [localhost:8761](http://localhost:8761) | Uses **Eureka** for localhost. All microservices register with the Eureka service. This registration information is used to discover dynamic properties of any microservice. Examples of discovery include finding the hostnames or ip addresses, the load balancer and the port on which the microservice is currently running.\n| [react-ui](https://github.com/yugabyte/yugastore-java/tree/master/react-ui) | - | [localhost:8080](http://localhost:8080) | A react-based UI for the eCommerce online marketplace app.\n| [api-gateway](https://github.com/yugabyte/yugastore-java/tree/master/api-gateway-microservice) | - | [localhost:8081](http://localhost:8081) | This microservice handles all the external API requests. The UI only communicates with this microservice.\n| [products](https://github.com/yugabyte/yugastore-java/tree/master/products-microservice) | YCQL | [localhost:8082](http://localhost:8082) | This microservice contains the entire product catalog. It can list products by categories, return the most popular products as measured by sales rank, etc.\n| [cart](https://github.com/yugabyte/yugastore-java/tree/master/cart-microservice) | YSQL | [localhost:8083](http://localhost:8083) | This microservice deals with users adding items to the shopping cart. It has to be necessarily highly available, low latency and often multi-region.\n| [checkout](https://github.com/yugabyte/yugastore-java/tree/master/checkout-microservice) | YCQL | [localhost:8086](http://localhost:8086) | This deals with the checkout process and the placed order. It also manages the inventory of all the products because it needs to ensure the product the user is about to order is still in stock.\n| [login](https://github.com/yugabyte/yugastore-java/tree/master/login-microservice) | YSQL | [localhost:8085](http://localhost:8085) | Handles login and authentication of the users. *Note that this is still a work in progress.*\n\n# Build and run\n\nTo build, simply run the following from the base directory:\n\n```\n$ mvn -DskipTests package\n```\n\nTo run the app on host machine, you need to first install YugabyteDB, create the necessary tables, start each of the microservices and finally the React UI.\n\n## Running the app on host\n\nMake sure you have built the app as described above. Now do the following steps.\n\n## Step 1: Install and initialize YugabyteDB\n\nYou can [install YugabyteDB by following these instructions](https://docs.yugabyte.com/latest/quick-start/).\n\nNow create the necessary tables as shown below. Note that these steps would take a few seconds.\n\n```\n$ cd resources\n$ cqlsh -f schema.cql\n```\nNext, load some sample data.\n\n```\n$ cd resources\n$ ./dataload.sh\n```\n\nCreate the postgres tables in `resources/schema.sql` for the YSQL tables.\n\n## Step 2: Start the Eureka service discovery (local)\n\nYou can do this as follows:\n\n```\n$ cd eureka-server-local/\n$ mvn spring-boot:run\n```\n\nVerify this is running by browsing to the [Spring Eureka Service Discovery dashboard](http://localhost:8761/).\n\n## Step 2: Start the api gateway microservice\n\nTo run the products microservice, do the following in a separate shell:\n\n```\n$ cd api-gateway-microservice/\n$ mvn spring-boot:run\n```\n\n\n## Step 3: Start the products microservice\n\nTo run the products microservice, do the following in a separate shell:\n\n```\n$ cd products-microservice/\n$ mvn spring-boot:run\n```\n\n## Step 4: Start the checkout microservice\n\nTo run the products microservice, do the following in a separate shell:\n\n```\n$ cd checkout-microservice/\n$ mvn spring-boot:run\n```\n\n## Step 5: Start the checkout microservice\n\nTo run the cart microservice, do the following in a separate shell:\n\n```\n$ cd cart-microservice/\n$ mvn spring-boot:run\n```\n\n## Step 6: Start the UI\n\nTo do this, simply run `npm start` from the `frontend` directory in a separate shell:\n\n```\n$ cd react-ui\n$ mvn spring-boot:run\n```\n\nNow browse to the marketplace app at [http://localhost:8080/](http://localhost:8080/).\n\n# Running the app in docker containers\n\nThe dockers images are built along with the binaries when `mvn -DskipTests package` was run.\nTo run the docker containers, run the following script, after you have [Installed and initialized YugabyteDB](#step-1-install-and-initialize-yugabyte-db):\n\n```\n$ ./docker-run.sh\n```\nCheck all the services are registered on the [eureka-server](http://127.0.0.1:8761/).\nOnce all services are registered, you can browse the marketplace app at [http://localhost:8080/](http://localhost:8080/).\n\n\n\n## Screenshots\n\n\n### Home\n![Home Page](docs/home.png)\n\n### Product Category Page\n\n![Product Category](docs/product-category.png)\n\n### Product Detail Page\n\n![Product Page](docs/product.png)\n\n### Car\n\n![Cart](docs/cart.png)\n\n## Checkout\n\n![Checkout](docs/checkout.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugabytedb-samples%2Fyugastore-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyugabytedb-samples%2Fyugastore-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugabytedb-samples%2Fyugastore-java/lists"}