{"id":18048059,"url":"https://github.com/ivangfr/springboot-kafka-websocket","last_synced_at":"2025-07-06T15:08:16.457Z","repository":{"id":50683861,"uuid":"150784794","full_name":"ivangfr/springboot-kafka-websocket","owner":"ivangfr","description":"The goal of this project is to implement two Spring Boot applications: bitcoin-api and bitcoin-client. The bitcoin-api application simulates BTC price changes, while the bitcoin-client application listens to these changes and updates a real-time UI. The bitcoin-client UI is secured using Basic Authentication.","archived":false,"fork":false,"pushed_at":"2025-04-11T12:17:46.000Z","size":21336,"stargazers_count":65,"open_issues_count":0,"forks_count":36,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-20T00:06:41.054Z","etag":null,"topics":["basic-authentication","docker","java","kafka","mysql","spring-boot","spring-cloud-stream","spring-data-jpa","spring-security","spring-web-mvc","springdoc-openapi","thymeleaf","websocket"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivangfr.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"ivangfr"}},"created_at":"2018-09-28T19:15:34.000Z","updated_at":"2025-05-12T02:57:36.000Z","dependencies_parsed_at":"2025-01-15T11:13:40.126Z","dependency_job_id":"73062d20-c759-43b5-98ea-f55b51fa1399","html_url":"https://github.com/ivangfr/springboot-kafka-websocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivangfr/springboot-kafka-websocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-kafka-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-kafka-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-kafka-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-kafka-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivangfr","download_url":"https://codeload.github.com/ivangfr/springboot-kafka-websocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-kafka-websocket/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263922512,"owners_count":23530338,"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":["basic-authentication","docker","java","kafka","mysql","spring-boot","spring-cloud-stream","spring-data-jpa","spring-security","spring-web-mvc","springdoc-openapi","thymeleaf","websocket"],"created_at":"2024-10-30T20:11:07.233Z","updated_at":"2025-07-06T15:08:16.450Z","avatar_url":"https://github.com/ivangfr.png","language":"Java","funding_links":["https://github.com/sponsors/ivangfr"],"categories":[],"sub_categories":[],"readme":"= springboot-kafka-websocket\n\nThe goal of this project is to implement two https://docs.spring.io/spring-boot/index.html[`Spring Boot`] applications: `bitcoin-api` and `bitcoin-client`. The `bitcoin-api` application simulates `BTC` price changes, while the `bitcoin-client` application listens to these changes and updates a real-time UI. The `bitcoin-client` UI is secured using Basic Authentication.\n\n== Proof-of-Concepts \u0026 Articles\n\nOn https://ivangfr.github.io:[ivangfr.github.io], I have compiled my Proof-of-Concepts (PoCs) and articles. You can easily search for the technology you are interested in by using the filter. Who knows, perhaps I have already implemented a PoC or written an article about what you are looking for.\n\n== Additional Readings\n\n* [Medium]: https://medium.com/@ivangfr/building-a-web-chat-with-social-login-using-spring-boot-introduction-644702e6be8e[**Building a Web Chat with Social Login using Spring Boot: Introduction**]\n* [Medium]: https://medium.com/@ivangfr/list/news-producer-and-consumer-tutorial-815f134a1eda[**News Producer and Consumer Tutorial**]\n\n== Project Diagram\n\nimage::./documentation/project-diagram.jpeg[]\n\n== Applications\n\n* *bitcoin-api*\n+\n`Spring Boot` Web Java application service that simulates `BTC` price changes and pushes those changes to https://kafka.apache.org/[`Kafka`]\n\n* *bitcoin-client*\n+\n`Spring Boot` Web Java application that was implemented using `Thymeleaf` as HTML template. It reads from `Kafka` and updates its UI using `Websocket`. It has also a chat where users can talk to each other by sending messages publicly or privately.\n\n== Prerequisites\n\n* https://www.oracle.com/java/technologies/downloads/#java21[`Java 21`] or higher\n* A containerization tool (e.g., https://www.docker.com[`Docker`], https://podman.io[`Podman`], etc.)\n\n== Start Environment\n\n* Open a terminal and inside the `springboot-kafka-websocket` root folder run:\n+\n[source]\n----\ndocker compose up -d\n----\n\n* Wait for Docker containers to be up and running. To check it, run:\n+\n[source]\n----\ndocker ps -a\n----\n\n== Running applications with Maven\n\nInside the `springboot-kafka-websocket` root folder, run the following `Maven` commands in different terminals:\n\n* *bitcoin-api*\n+\n[source]\n----\n./mvnw clean spring-boot:run --projects bitcoin-api -Dspring-boot.run.jvmArguments=\"-Dserver.port=9081\"\n----\n\n* *bitcoin-client*\n+\n[source]\n----\n./mvnw clean spring-boot:run --projects bitcoin-client -Dspring-boot.run.jvmArguments=\"-Dserver.port=9082\"\n----\n\n== Running Applications as Docker containers\n\n=== Build Application's Docker Image\n\n* In a terminal, make sure you are inside the `springboot-kafka-websocket` root folder;\n\n* In order to build the application docker images, run the following script:\n+\n[source]\n----\n./build-docker-images.sh\n----\n\n=== Application's Environment Variables\n\n* *bitcoin-api*\n+\n|===\n|Environment Variable | Description\n\n|`MYSQL_HOST`\n|Specify host of the `MySQL` database to use (default `localhost`)\n\n|`MYSQL_PORT`\n|Specify port of the `MySQL` database to use (default `3306`)\n\n|`KAFKA_HOST`\n|Specify host of the `Kafka` message broker to use (default `localhost`)\n\n|`KAFKA_PORT`\n|Specify port of the `Kafka` message broker to use (default `29092`)\n|===\n\n* *bitcoin-client*\n+\n|===\n|Environment Variable | Description\n\n|`KAFKA_HOST`\n|Specify host of the `Kafka` message broker to use (default `localhost`)\n\n|`KAFKA_PORT`\n|Specify port of the `Kafka` message broker to use (default `29092`)\n|===\n\n=== Start Application's Docker container\n\n* In a terminal, make sure you are inside the `springboot-kafka-websocket` root folder;\n\n* Run the following script:\n+\n[source]\n----\n./start-apps.sh\n----\n\n== Applications URLs\n\n|===\n|Application |URL |Credentials (user/pass)\n\n|bitcoin-api\n|http://localhost:9081/swagger-ui.html\n|\n\n|bitcoin-client\n|http://localhost:9082\n|`user1/123` or `user2/123`\n|===\n\nThe gif below shows two users checking real-time the `BTC` price changes. Additionally, they are using a chat channel to communicate with each other.\n\nimage::./documentation/two-users-example.gif[]\n\n== Useful Links \u0026 Commands\n\n* *Kafdrop*\n+\n`Kafdrop` can be accessed at http://localhost:9000\n\n* *MySQL*\n+\n[source]\n----\ndocker exec -it -e MYSQL_PWD=secret mysql mysql -uroot --database bitcoindb\nselect * from prices;\n----\n\n== Shutdown\n\n* To stop applications\n** If they were started with `Maven`, go to the terminals where they are running and press `Ctrl+C`;\n** If they were started as Docker containers, go to a terminal and, inside the `springboot-kafka-websocket` root folder, run the script below:\n+\n[source]\n----\n./stop-apps.sh\n----\n* To stop and remove docker compose containers, network and volumes, go to a terminal and, inside the `springboot-kafka-websocket` root folder, run the following command:\n+\n[source]\n----\ndocker compose down -v\n----\n\n== Cleanup\n\nTo remove the Docker images created by this project, go to a terminal and, inside the `springboot-kafka-websocket` root folder, run the script below:\n[source]\n----\n./remove-docker-images.sh\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspringboot-kafka-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivangfr%2Fspringboot-kafka-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspringboot-kafka-websocket/lists"}