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.
On 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.
-
bitcoin-api
Spring BootWeb Java application service that simulatesBTCprice changes and pushes those changes toKafka -
bitcoin-client
Spring BootWeb Java application that was implemented usingThymeleafas HTML template. It reads fromKafkaand updates its UI usingWebsocket. It has also a chat where users can talk to each other by sending messages publicly or privately.
-
Open a terminal and inside the
springboot-kafka-websocketroot folder run:docker compose up -d -
Wait for Docker containers to be up and running. To check it, run:
docker ps -a
Inside the springboot-kafka-websocket root folder, run the following Maven commands in different terminals:
-
bitcoin-api
./mvnw clean spring-boot:run --projects bitcoin-api -Dspring-boot.run.jvmArguments="-Dserver.port=9081" -
bitcoin-client
./mvnw clean spring-boot:run --projects bitcoin-client -Dspring-boot.run.jvmArguments="-Dserver.port=9082"
-
In a terminal, make sure you are inside the
springboot-kafka-websocketroot folder; -
In order to build the application docker images, run the following script:
./build-docker-images.sh
-
bitcoin-api
Environment Variable Description MYSQL_HOSTSpecify host of the
MySQLdatabase to use (defaultlocalhost)MYSQL_PORTSpecify port of the
MySQLdatabase to use (default3306)KAFKA_HOSTSpecify host of the
Kafkamessage broker to use (defaultlocalhost)KAFKA_PORTSpecify port of the
Kafkamessage broker to use (default29092) -
bitcoin-client
Environment Variable Description KAFKA_HOSTSpecify host of the
Kafkamessage broker to use (defaultlocalhost)KAFKA_PORTSpecify port of the
Kafkamessage broker to use (default29092)
| Application | URL | Credentials (user/pass) |
|---|---|---|
bitcoin-api |
||
bitcoin-client |
|
The gif below shows two users checking real-time the BTC price changes. Additionally, they are using a chat channel to communicate with each other.
-
Kafdrop
Kafdropcan be accessed at http://localhost:9000 -
MySQL
docker exec -it -e MYSQL_PWD=secret mysql mysql -uroot --database bitcoindb select * from prices;
-
To stop applications
-
If they were started with
Maven, go to the terminals where they are running and pressCtrl+C; -
If they were started as Docker containers, go to a terminal and, inside the
springboot-kafka-websocketroot folder, run the script below:./stop-apps.sh
-
-
To stop and remove docker compose containers, network and volumes, go to a terminal and, inside the
springboot-kafka-websocketroot folder, run the following command:docker compose down -v

