Skip to content

Commit 60a5f57

Browse files
authored
Update README to clarify use cases and architecture (#184)
1 parent b4920b2 commit 60a5f57

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,25 @@ HTTP/1.1 200 OK
8585
}
8686
```
8787

88-
---
89-
90-
The library works with all ScalaPB-based GRPC code-generators:
91-
92-
* [ScalaPB](https://scalapb.github.io) services with `Future` monad
93-
* [fs2-grpc](https://github.com/typelevel/fs2-grpc), built on top of `cats-effect` and `fs2`
94-
* [ZIO gRPC](https://scalapb.github.io/zio-grpc/), built on top of `ZIO`
88+
## Use cases
9589

96-
At the moment, only unary (non-streaming) methods are supported.
90+
* Expose existing gRPC-services as REST APIs without modifying the original application code, alongside gRPC. gRPC
91+
services are used for inter-service communication, while ConnectRPC REST APIs are exposed for external clients who
92+
speak traditional HTTP with JSON instead of binary protobuf (browsers, for example).
93+
* Use ConnectRPC protocol for both inter-service and external traffic (fully ditch gRPC as communication protocol),
94+
while keeping the original gRPC service interfaces (easy switch to ConnectRPC with no changes into application code).
9795

9896
## Architecture
9997

10098
![Layered architecture](docs/layered-architecture.svg)
10199

102-
The diagram above shows the high level architecture:
100+
The diagram above shows how `connect-rpc-scala` fits into the overall architecture:
103101

104102
* Code generation libraries generate code from protobuf definitions. The code is used by the application layer to
105103
communicate with other services / implement the logic.
106104
* Under the hood generated code uses gRPC abstractions, such as `Channel`, `ServiceDefinition`, `Stub`, etc.
107-
* The `connect-rpc-scala` library implements those gRPC abstractions, unblocking use of the ConnectRPC protocol
108-
to communicate with other services / expose ConnectRPC servers.
105+
* The `connect-rpc-scala` library implements those gRPC abstractions, unblocking reuse of the same
106+
application code for both gRPC & ConnectRPC protocol servers (see the Use Cases section).
109107
* Under the hood the library uses `http4s` or `netty` clients/servers to expose protobuf-based services as REST APIs.
110108

111109
The library provides two frontends:
@@ -155,6 +153,12 @@ Built-in [GRPC Transcoding](https://cloud.google.com/endpoints/docs/grpc/transco
155153
| - Request body field mapping, e.g. <br/>`body: "request"`, `body: "*"` |||
156154
| - Path suffixes, e.g., `/v1/{name=projects/*/locations/*}/datasets` |||
157155

156+
The library works with all ScalaPB code-generators:
157+
158+
* [ScalaPB](https://scalapb.github.io) services with `Future` monad
159+
* [fs2-grpc](https://github.com/typelevel/fs2-grpc) for `cats-effect`/`fs2`
160+
* [zio-grpc](https://scalapb.github.io/zio-grpc/) for `ZIO`
161+
158162
## Usage
159163

160164
![Maven Central](https://img.shields.io/maven-central/v/me.ivovk/connect-rpc-scala-core_3?style=flat-square&color=green)

0 commit comments

Comments
 (0)