Skip to content

justJavaProgrammer/grpc-crud

Repository files navigation

Simple CRUD operations using GRPC protocol.

Tech Stack:

  • Project Reactor
  • Spring Core
  • Spring R2DBC
  • Google GRpc dependencies(validators, creators, etc)
  • Gradle
  • Mapstruct
  • JUnit 5
  • Docker
  • Postgres
  • Flyway
  • Lombok

Available Endpoints

  • fetchBook(FetchBookRequest) to get the book by id, the ID MUST be a valid UUID string as described in RFC 4122
  • addBook(CreateBookRequest) to create a book. Book entity should be valid, constraints can be found in proto file
  • updateBook(UpdateBookRequest) to update the existing book. New book entity should be valid, constraints can be found in proto file
  • removeBook(DeleteBookRequest) to remove the book. If book doesn't exist the command perform nothing.

See the book.proto file for more info

Run project

To run project locally you will need installed Docker. Run the following bash script files:

- ./instance.docker.image.build.sh 
- ./instance.docker.image.run.sh

The following commands will build a Docker image and run it locally.

To test endpoints you can use the localhost:6565 endpoint.

DTOs

A Book DTO represent a simple information, such title, author, isbn, quantity and ID(UUID), cover image.

{
    "id": "56bb8088-70e0-43bf-9fde-fc69931ba28f",
    "name": "Three Days of Happiness",
    "author": "Sugaru Miaki",
    "isbn": "1975314212",
    "quantity": 92,
    "coverImage": "https://m.media-amazon.com/images/I/8151LO+e+9L._SL1500_.jpg"
}

Tests

To run tests use following command, if you have gradle installed:

gradle test 

If you are using IDE run the:

./gradlew test

Releases

No releases published

Packages

No packages published

Languages