{"id":20846754,"url":"https://github.com/kimgoetzke/practice-microservices","last_synced_at":"2026-05-04T17:31:59.254Z","repository":{"id":158016383,"uuid":"600499950","full_name":"kimgoetzke/practice-microservices","owner":"kimgoetzke","description":"Practice project with a basic microservice architecture (API gateway, config \u0026 discovery server, and service applications with Postgres databases), written in Java using the Spring Framework.","archived":false,"fork":false,"pushed_at":"2023-10-23T08:02:02.000Z","size":316,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-12T18:57:24.706Z","etag":null,"topics":["java","kafka","keycloak","microservices","postgres","resilience4j","spring-boot","spring-cloud","spring-eureka","spring-gateway","spring-webflux","testcontainers"],"latest_commit_sha":null,"homepage":"","language":"Java","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/kimgoetzke.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":"2023-02-11T17:26:54.000Z","updated_at":"2024-01-03T10:10:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"cfcc952b-da50-4ab2-a64c-ab8952a14cf4","html_url":"https://github.com/kimgoetzke/practice-microservices","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kimgoetzke/practice-microservices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimgoetzke%2Fpractice-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimgoetzke%2Fpractice-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimgoetzke%2Fpractice-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimgoetzke%2Fpractice-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kimgoetzke","download_url":"https://codeload.github.com/kimgoetzke/practice-microservices/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kimgoetzke%2Fpractice-microservices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32617671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: 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":["java","kafka","keycloak","microservices","postgres","resilience4j","spring-boot","spring-cloud","spring-eureka","spring-gateway","spring-webflux","testcontainers"],"created_at":"2024-11-18T02:17:51.543Z","updated_at":"2026-05-04T17:31:59.216Z","avatar_url":"https://github.com/kimgoetzke.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Microservices Project\n\nThis repo contains a simple, containerised microservice architecture, written in Java and using the Spring framework. The purpose of this project was to learn more about the interaction between microservices and their supporting infrastructure (and __not__ to create any meaningful API endpoints).\n\n\n## Architecture overview\n![Overview diagram](diagram.png)\n\n+ At this point, the notification service only records logs for each event received. It's only purpose was to provide the foundation of playground to work with Kafka.\n+ I have intentionally kept this project single-repo (code \u0026 Docker Hub images), even though this is not what I would do for a real application.\n\n## Instructions to use\nThe following inventory is created for testing purposes:\n\n| Name    | Quantity |\n|:--------|:---------|\n| Bicycle | 20       |\n| Scooter | 100      |\n| Car     | 3        |\n| Bus     | 0        |\n\n\n### Place order\nPOST `api/order`\n+ Expects JSON with `customerId` and `orderLineItemDtoList` (containing `name`, `price` and `quantity`)\n+ Example:\n   ```\n   {\n       \"customerId\": 5,\n       \"orderLineItemDtoList\":[\n           {\n               \"name\": \"Scooter\",\n               \"price\": 5000.00,\n               \"quantity\": 1\n           }\n       ]\n   }\n   ```\n+ If successful, returns HTTP status code `201` and JSON message containing order number - for example:\n   ```\n   {\n      \"status\": \"CREATED\",\n      \"message\": \"Order placed successfully.\",\n      \"orderNumber\": \"b835fd6d-052a-4f66-a2a4-8be7181fbcf7\"\n   }\n   ```\n+ Depending on error type, returns  `400`, `500`, `503`, or `504` \n\n###### Notes\n- Requests are made to `http://localhost:8181` (requires valid OAUth2.0 token, see 'Generate OAUth 2.0 token with Postman' below)\n- pgAdmin is available at `http://localhost:5050` (password: `password`)\n- KeyCloak is available at `http://localhost:8080` (username: `admin`, password: `admin`)\n\n## Instructions to run \n### With Docker Compose (recommended)\n1. __Clone repo__\n2. __Run Docker Compose__\n   1. Run `docker compose up -d`\n3. __Generate a new client secret__\n   1. Go to `http://localhost:8080/` and log into KeyCloak using the username `admin` and password `admin`\n   2. Select `Clients`, `microservices-cloud-client`, `Credentials,` and click `Regenerate` in the 'Client Secret' column\n   3. Copy the secret to generate a token (see 'Generate OAUth 2.0 token with Postman' below)\n4. __Generate token and start sending request__\n   1. Generate a valid OAuth2.0 token e.g. with Postman\n   2. Using a valid token, you can now send request to `localhost:8181`\n   3. You can also use pgAdmin to view the tables at `localhost:5050`\n   4. The Eureka discovery server status page is accessible at `localhost:8181/eureka/web`\n\n### Without Docker Compose (_not_ recommended)\nOnly recommended if you want to expand on this project.\n1. __Clone repo__\n2. __Create separate repo for configurations__\n   1. Manually create second, local Git repo for configuration files\n   2. Paste contents of the folder `resources/config-repo-files` into the newly created repo\n   3. Add and commit all files to the newly created repo\n   4. Open `application.properties` under `config-server/src/main/resources` \n   5. Update `spring.cloud.config.server.git.uri=file://${user.home}/IdeaProjects/Practice-Microservices-Config-Repo/` to reflect the correct path of the newly created repo\n3. __Set credentials...__ \n   1. ...for your local __Postgres database__ by (a) replacing variables in `application.properties` in config repo with the actual credentials or (b) injecting them as environmental variables when starting services\n   2. ...for the __discovery server__  repeat (a) or (b) above (default credentials are `eureka` / `password`)\n4. __Set up KeyCloak on Docker__\n   1. Follow the steps provided by [KeyCloak - Getting Started on Docker](https://www.keycloak.org/getting-started/getting-started-docker) to set up KeyCloak as a Docker image\n   2. Use default configuration with the following exceptions:\n      1. Make sure to set the port to `8181` or update the `api-gateway.properties` file accordingly\n      2. When creating a client, set `client authentication` to `On` and enable `Service accounts roles`\n      3. When creating a client, disable `Standard flow` and `Direct access grants`\n5. __Configure properties file for Jib__\n   1. Open `properties.gradle` in the root folder of the project and update your DockerHub credentials, or\n   2. Add a new file `local.properties` in your `.gradle/` folder with your DockerHub credentials\n6. __Build all services and run them in the following order:__ \n   1. `discovery-server`\n   2. `config-server`\n   3. `api-gateway`\n   4. All other services\n7. __Generate token and start sending request__\n   1. You can now use Postman or other apps to send request\n   2. Make sure to send your requests with a valid OAuth2.0 token\n\n###### Notes\nWithout further modification (and when __not__ using Docker Compose), ports used by default are:\n1. `8080` - `api-gateway`\n2. `8761` - `discovery-server`\n3. `8181` - KeyCloak Docker image \n\nPorts for all other services will be assigned and controlled by the discovery server. As a result, all requests to business services must be made through `localhost:8080`.\n\n## Generate a valid OAuth2.0 token with Postman\n+ Create a new request\n+ Select `Authorization` and set the following:\n  + Access token URL = `http://keycloak:8080/realms/practice-microservices-realm/protocol/openid-connect/token`\n  + Client ID = `microservices-cloud-client`\n  + Client Secret (follow steps above to generate from KeyCloak admin portal)\n  + Scope = `openid offline_access`\n+ Click \"Get New Access Token\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkimgoetzke%2Fpractice-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkimgoetzke%2Fpractice-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkimgoetzke%2Fpractice-microservices/lists"}