Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivangfr/spring-boot-grpc-client-server
This project aims to create two Spring Boot applications using gRPC: movie-grpc-server and movie-grpc-client. The movie-grpc-lib project defines the gRPC interface that both applications use.
https://github.com/ivangfr/spring-boot-grpc-client-server
client-server grpc java postgresql protocol-buffers spring-boot web
Last synced: 4 months ago
JSON representation
This project aims to create two Spring Boot applications using gRPC: movie-grpc-server and movie-grpc-client. The movie-grpc-lib project defines the gRPC interface that both applications use.
- Host: GitHub
- URL: https://github.com/ivangfr/spring-boot-grpc-client-server
- Owner: ivangfr
- Created: 2024-08-29T13:17:33.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-08T06:30:24.000Z (5 months ago)
- Last Synced: 2024-09-30T15:41:07.304Z (4 months ago)
- Topics: client-server, grpc, java, postgresql, protocol-buffers, spring-boot, web
- Language: Java
- Homepage:
- Size: 2.75 MB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# spring-boot-grpc-client-server
This project aims to create two [`Spring Boot`](https://docs.spring.io/spring-boot/index.html) applications using [`gRPC`](https://grpc.io/): `movie-grpc-server` and `movie-grpc-client`. The `movie-grpc-lib` project defines the `gRPC` interface that both applications use.
## Proof-of-Concepts & Articles
On [ivangfr.github.io](https://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.
## Additional Readings
- \[**Medium**\] [**Implementing gRPC Server and Client using Spring Boot**](https://medium.com/@ivangfr/implementing-grpc-server-and-client-using-spring-boot-4411b26138be)
## Applications
- **movie-grpc-lib**
A Maven project that defines the `gRPC` interface (using [`Protocol Buffers`](https://protobuf.dev/)) for managing movies. This library is shared by both the `movie-grpc-server` and `movie-grpc-client` to ensure they can communicate properly over `gRPC`.
- **movie-grpc-server**
A Spring Boot web application that has `movie-grpc-lib` as dependency. It implements the `gRPC` functions for managing movies and runs a `gRPC` server to handle `movie-grpc-client` calls. The movies are stored in a [`PostgreSQL`](https://www.postgresql.org/) database.
- **movie-grpc-client**
A Spring Boot shell application that has `movie-grpc-lib` as dependency. It has a `stub` used to call `movie-grpc-server` functions.
## Packaging and Installing movie-grpc-lib
In a terminal and inside `spring-boot-grpc-client-server` root folder, run the command below:
```
./mvnw clean install --projects movie-grpc-lib
```## Start PostgreSQL Docker container
Run the command below to start `postgres` Docker container
```
docker run -d --name postgres \
-p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=moviesdb \
postgres:16.3
```## Running applications
- **movie-grpc-server**
In a terminal and inside `spring-boot-grpc-client-server` root folder, run the following command:
```
./mvnw clean spring-boot:run --projects movie-grpc-server
```- **movie-grpc-client**
Open another terminal, make sure you are in `spring-boot-grpc-client-server` root folder. Then, run the command below to build the executable jar file:
```
./mvnw clean package --projects movie-grpc-client -DskipTests
```Finally, to start the client shell, run:
```
./movie-grpc-client/target/movie-grpc-client-0.0.1-SNAPSHOT.jar
```## Demo
![demo](/documentation/demo.gif)
## Shutdown
- To stop the applications, go to the terminals where they are running and press `Ctrl+C`;
- To stop the postgres Docker container, run:
```
docker rm -fv postgres
```