Skip to content

Repository files navigation

grpcexp

grpcexp is an interactive explorer for interacting with grpc servers (built on top of grpcurl)

Usage examples

Unary call

Unary call demo

Streaming call

Streaming call demo

Usage

$ go run cmd/grpcexp/main.go --help
An interactive explorer for interacting with grpc servers.

Usage:
  grpcexp [flags]
  grpcexp [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  version     grpcexp version

Flags:
  -a, --addr string               grpc server address
  -H, --header stringArray        additional header in 'name: value' format (may be repeated)
  -h, --help                      help for grpcexp
      --import-path stringArray   directory used to resolve proto imports (may be repeated)
  -p, --port int                  grpc server port (default 50051)
      --proto stringArray         path to a .proto source file (may be repeated)
      --protoset string           path to a compiled protoset descriptor file
      --timeout duration          connection timeout (default 10s)
      --tls                       use TLS to connect to the server

Installation

Linux or MacOS

You can install the latest version of grpcexp by running the following command in your terminal.

bash -c "$(curl -fsSL https://raw.githubusercontent.com/prnvbn/grpcexp/main/installer.sh)"

Move the binary to a directory in your PATH. For e.g. /usr/local/bin on linux.

via homebrew

You can install grpcexp from prnvbn/homebrew-tap.

brew install prnvbn/tap/grpcexp

via go install

go install github.com/prnvbn/grpcexp/cmd/grpcexp@latest

Enabling Command Autocompletion

To enable autocomplete, add the following to your .bashrc or .bash_profile file:

# you can also generate completions for zsh and fish shells by replacing bash with zsh or fish
source <(grpcexp completion bash)

Why

Let me preface this by saying, I really like grpcurl but have a few UX nits:

I have to run ~5 commands to make one grpc call
$ grpcurl -plaintext :50051 list
grpc.reflection.v1.ServerReflection
grpc.reflection.v1alpha.ServerReflection
helloworld.Greeter
$ grpcurl -plaintext :50051 list helloworld.Greeter
helloworld.Greeter.SayHello
$ grpcurl -plaintext :50051 describe helloworld.Greeter.SayHello
helloworld.Greeter.SayHello is a method:
rpc SayHello ( .helloworld.HelloRequest ) returns ( .helloworld.HelloReply );
$ grpcurl -plaintext :50051 describe helloworld.HelloRequest
helloworld.HelloRequest is a message:
message HelloRequest {
string name = 1;
}
$ grpcurl -plaintext -d '{"name": "joe"}' :50051 helloworld.Greeter.SayHello
{
"message": "Hello joe"
}
the lack of POSIX/GNU-style --flags

personal taste.

manual JSON construction for complex types

With grpcurl, you have to manually construct JSON for nested messages, maps, lists, and oneofs which is very tedious.

Contributing

Feel free to open an issue or submit a pull request. I'm always open to suggestions and improvements :)

About

an interactive explorer for interacting with grpc servers. a tui on top of grpcurl

Topics

Resources

Stars

21 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages