Starter template for a monorepo for Go microservices using gRPC, Bazel, and Tilt
If you want to use Nix, all you need to do is
install Nix. Then, just run nix-shell
from
the repository root to get a fully-configured shell.
However, some of your tools (e.g. IDE) might behave better if you also install things locally using the directions below.
If you're using macOS or Linux, you can install all required tools easily using
the Homebrew bundle defined in Brewfile
:
brew bundle install
Note: Even if you're using Windows, you should probably use the Windows Subsystem for Linux and just run everything on a Linux terminal.
If for any reason you need to install them manually, this table contains all of the required tools:
Run the tidy.sh script to initialize your repository after cloning and installing prerequisites:
bazel run //:tidy
You should also run this script after doing any of the following:
- Modifying protobuf files
- Adding/remove dependencies to Go code
If you haven't already, start up a Kubernetes cluster:
minikube start
Then, run Tilt and follow the instructions in the terminal to open the web console:
tilt up
bazel run //src/example/service:server
bazel run //src/example/web/server
grpc_cli
is an easy way to issue requests to the gRPC server:
grpc_cli call localhost:50051 ExampleService/GetExample "id: 'foo'"
grpc_cli call localhost:50051 ExampleService/SetExample "id: 'foo', data: {text: 'bar'}"
grpc_cli call localhost:50051 ExampleService/GetExample "id: 'foo'"
Near term tasks:
- Add code quality scan to CI
- Add code coverage to CI
- Add Gazelle to CI
- Add PR comments for CI errors wherever possible
- Add git hooks and repository setup script
- Generify HTTP server
- Add documentation for CI
Potential future projects:
- Add service resource dependencies to Tilt environment
- Add project configuration/generator/wizard so people don't get features they don't want
- Add TypeScript React app to example HTTP server
- Add support for other backend languages
- Add Deno scripts to simplify custom workflows
- Add production deployment examples
- Add database to environment
- Add dynamic configs to environment
- Add ORM to any example server
- Add pubsub to any example server
- Add cache to any example server
- Add authentication to generic server
- Add authorization to generic server
- Add auditing to generic server
- Add monitoring to generic server
- Add distributed tracing to generic server
- Add API simulation tests
- Add end-to-end tests
- Add new service setup wizard