https://github.com/ekkinox/grpc-demo
gRPC - SOA booster
https://github.com/ekkinox/grpc-demo
grpc grpc-go grpc-php http2 protobuf soa
Last synced: about 1 month ago
JSON representation
gRPC - SOA booster
- Host: GitHub
- URL: https://github.com/ekkinox/grpc-demo
- Owner: ekkinox
- License: mit
- Created: 2022-04-24T12:59:42.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-06T20:06:47.000Z (about 4 years ago)
- Last Synced: 2025-06-21T18:14:28.368Z (12 months ago)
- Topics: grpc, grpc-go, grpc-php, http2, protobuf, soa
- Language: JavaScript
- Homepage:
- Size: 167 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚀 gRPC: SOA booster
> Introduction session to [gRPC](https://grpc.io) as [SOA](https://en.wikipedia.org/wiki/Service-oriented_architecture) booster using [Golang](https://go.dev).
## Table of contents
- [Installation](#installation)
- [Stubs generation](#stubs-generation)
- [Available services](#available-services)
- [gRPC server](#grpc-server)
- [gRPC gateway](#grpc-gateway)
- [gRPC envoy proxy](#grpc-envoy-proxy)
## Installation
First install required dependencies:
- [docker](https://www.docker.com/)
- [docker-compose](https://docs.docker.com/compose/) (if not provided by docker install)
- [buf](https://docs.buf.build/installation)
Then start the stack:
```shell
docker-compose up -d
```
## Stubs generation
The protoc stubs are generated using [Buf](https://docs.buf.build/), following rules in [buf.gen.yaml](buf.gen.yaml) file.
To launch a new generation:
```shell
buf generate
```
Then check the [proto](proto) folder where you'll find:
- [go](proto/go): golang generated stubs for gRPC server and gRPC gateway
- [js](proto/js): javascript generated stubs for web clients
- [php](proto/php): PHP generated stubs for PHP application (as gRPC client)
## Available services
| Name | Host | Description |
|------------------|-----------------|------------------------------|
| gRPC server | localhost:50051 | The gRPC server (go) |
| gRPC gateway | localhost:8888 | The gRPC gateway (go) |
| gRPC envoy proxy | localhost:9999 | The gRPC envoy proxy (envoy) |
### gRPC server
This application is a simple server side go implementation of [the text_tools.proto](proto/text_tools.proto) Protobuf definition.
The code is located in [server](server) folder.
You can access it on `localhost:50051`, and use the provided [client/main.go](client/main.go) script to interact with it:
```shell
cd client && go run .
```
### gRPC gateway
This application is a [REST <-> gRPC reverse proxy](https://github.com/grpc-ecosystem/grpc-gateway) using autogenerated protoc stubs.
The code is located in [gateway](gateway) folder.
You can access it on `localhost:8888` to interact with it on following endpoint:
| Endpoint | Description |
|--------------------------------|-------------------------------------------------|
| [POST] /v1/transform | To call with REST the TransformText rpc |
| [POST] /v1/transform-and-split | To call with REST the TransformAndSplitText rpc |
### gRPC envoy proxy
This [envoy proxy](https://www.envoyproxy.io/) is running the `envoy.filters.http.grpc_web` filter to enable frontend application to interact using [gRPC-web](https://github.com/grpc/grpc-web).
The proxy configuration is located in [envoy](envoy) folder.
You can access it on `localhost:9999` to interact with it, and use the [frontend](frontend) client to test from a web application.