https://github.com/ankorstore/yokai-grpc-template
gRPC application template based on the Yokai Go framework.
https://github.com/ankorstore/yokai-grpc-template
dependency-injection framework go golang grpc grpc-go grpc-server modular observability open-telemetry yokai
Last synced: about 2 months ago
JSON representation
gRPC application template based on the Yokai Go framework.
- Host: GitHub
- URL: https://github.com/ankorstore/yokai-grpc-template
- Owner: ankorstore
- License: mit
- Created: 2024-03-19T08:23:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-08T06:50:57.000Z (5 months ago)
- Last Synced: 2025-05-08T07:34:47.767Z (5 months ago)
- Topics: dependency-injection, framework, go, golang, grpc, grpc-go, grpc-server, modular, observability, open-telemetry, yokai
- Language: Go
- Homepage:
- Size: 79.1 KB
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yokai gRPC Template
[](https://opensource.org/licenses/MIT)
[](https://go.dev/)
[](https://ankorstore.github.io/yokai/)> gRPC application template based on the [Yokai](https://github.com/ankorstore/yokai) Go framework.
* [Documentation](#documentation)
* [Overview](#overview)
* [Layout](#layout)
* [Makefile](#makefile)
* [Getting started](#getting-started)
* [Installation](#installation)
* [With GitHub](#with-github)
* [With gonew](#with-gonew)
* [Usage](#usage)## Documentation
For more information about the [Yokai](https://github.com/ankorstore/yokai) framework, you can check its [documentation](https://ankorstore.github.io/yokai).
## Overview
This template provides:
- a ready to extend [Yokai](https://github.com/ankorstore/yokai) application, with the [gRPC server](https://ankorstore.github.io/yokai/modules/fxgrpcserver/) module installed
- a ready to use [dev environment](docker-compose.yaml), based on [Air](https://github.com/air-verse/air) (for live reloading)
- a ready to use [Dockerfile](Dockerfile) for production
- some examples of [service](internal/service/example.go) and [test](internal/service/example_test.go) to get started### Layout
This template is following the [recommended project layout](https://go.dev/doc/modules/layout#server-project):
- `cmd/`: entry points
- `configs/`: configuration files
- `internal/`:
- `service/`: gRPC service and test examples
- `bootstrap.go`: bootstrap
- `register.go`: dependencies registration
- `proto/`: protobuf definition and stubs### Makefile
This template provides a [Makefile](Makefile):
```
make up # start the docker compose stack
make down # stop the docker compose stack
make logs # stream the docker compose stack logs
make fresh # refresh the docker compose stack
make stubs # generate gRPC stubs with protoc (ex: make stubs from=proto/example.proto)
make test # run tests
make lint # run linter
```## Getting started
### Installation
#### With GitHub
You can create your repository [using the GitHub template](https://github.com/new?template_name=yokai-grpc-template&template_owner=ankorstore).
It will automatically rename your project resources and push them, this operation can take a few minutes.
Once ready, after cloning and going into your repository, simply run:
```shell
make fresh
```#### With gonew
You can install [gonew](https://go.dev/blog/gonew), and simply run:
```shell
gonew github.com/ankorstore/yokai-grpc-template github.com/foo/bar
cd bar
make fresh
```### Usage
Once ready, the application will be available on:
- `localhost:50051` for the application gRPC server
- [http://localhost:8081](http://localhost:8081) for the application core dashboardIf you update the [proto definition](proto/example.proto), you can run `make stubs from=proto/example.proto` to regenerate the stubs.
Usage examples with [gRPCurl](https://github.com/fullstorydev/grpcurl):
- with `ExampleService/ExampleUnary`:
```shell
grpcurl -plaintext -d '{"text":"hello"}' localhost:50051 example.ExampleService/ExampleUnary
{
"text": "response from grpc-app: you sent hello"
}
```- with `ExampleService/ExampleStreaming`:
```shell
grpcurl -plaintext -d '@' localhost:50051 example.ExampleService/ExampleStreaming <