Skip to content

ScalaPB meets ZIO: write purely functional gRPC services and clients using ZIO

License

Notifications You must be signed in to change notification settings

fillson-shady/zio-grpc

 
 

Repository files navigation

ZIO gRPC Logo

Snapshot Artifacts

Welcome to ZIO-gRPC

This library enables you to write purely functional gRPC services using ZIO.

Documentation

Highlights

  • Supports all types of RPCs (unary, client streaming, server streaming, bidirectional).
  • Uses ZIO's Stream to let you easily implement streaming requests.
  • Cancellable RPCs: client-side ZIO interruptions are propagated to the server to abort the request and save resources.

Installation

Find the latest snapshot in here.

Add the following to your project/plugins.sbt:

val zioGrpcVersion = "0.4.0"

addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.34")

libraryDependencies += "com.thesamet.scalapb.zio-grpc" %% "zio-grpc-codegen" % zioGrpcVersion

Add the following to your build.sbt:

val grpcVersion = "1.31.1"

PB.targets in Compile := Seq(
    scalapb.gen(grpc = true) -> (sourceManaged in Compile).value,
    scalapb.zio_grpc.ZioCodeGenerator -> (sourceManaged in Compile).value,
)

libraryDependencies ++= Seq(
    "com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion,
    "io.grpc" % "grpc-netty" % grpcVersion
)

Usage

Place your service proto files in src/main/protobuf, and the plugin will generate Scala sources for them. Learn more about how to use ZIO gRPC generated code.

See a full example at the examples directory.

About

ScalaPB meets ZIO: write purely functional gRPC services and clients using ZIO

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 91.5%
  • JavaScript 6.5%
  • CSS 1.7%
  • Nix 0.3%