Skip to content

zees-dev/go-grpc

Repository files navigation

Go gRPC

A simple gRPC client and server written in go.
Both the client and server use the same code generated by the protobuf definition (proto3).

This project is meant to be a template to allow one to quickly bootstrap a gRPC based project.

All architectural decisions are documented as architecture design records (ADR's) in the docs/adr directory.

Note: This project is a WIP and will continue to grow as expertise in gRPC based microservice architecture develops.


Local Setup

Pre-requisites

  • protoc compiler - pre-compiled binary for your OS
    • Note: add this to your path
  • protoc-gen-go - protoc plugin for go
    • go get github.com/golang/protobuf/protoc-gen-go

Build

  • Generate Protobuf source files:

    protoc --go_out=plugins=grpc:. ./api/protobuf-spec/hello.proto
  • Build solution:

    go build -o grpc main.go

Run

  • Run Server:

    ./grpc -type server
  • Run client - with message "my-message":

    ./grpc -type client my-message

Docker

Run server and client via docker-compose:

docker-compose up --build

Note: The client continously exits when gRPC server successfully recieves message from client


TODO

  • Server implementation
  • Client implementation
  • Unit Tests
  • Containerisation (Docker)
  • Create/Use distroless based prod docker image
  • Docs - Architecture Design Records
  • Godoc support
  • Setup Makefile
  • Github actions (CICD)

Tests

go test

License

License: MIT

About

A simple gRPC server and client in go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published