Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pandakn/grpcgenie
GrpcGenie is a command-line tool that generates gRPC handler files from .proto definitions. It simplifies the process of creating gRPC server implementations by automatically generating boilerplate code.
https://github.com/pandakn/grpcgenie
cli go grpc tools
Last synced: about 1 month ago
JSON representation
GrpcGenie is a command-line tool that generates gRPC handler files from .proto definitions. It simplifies the process of creating gRPC server implementations by automatically generating boilerplate code.
- Host: GitHub
- URL: https://github.com/pandakn/grpcgenie
- Owner: pandakn
- License: mit
- Created: 2024-08-18T08:37:04.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-14T06:43:36.000Z (2 months ago)
- Last Synced: 2024-09-29T15:41:12.109Z (about 2 months ago)
- Topics: cli, go, grpc, tools
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GrpcGenie
`GrpcGenie` is a command-line tool that generates gRPC handler files from .proto definitions. It simplifies the process of creating gRPC server implementations by automatically generating boilerplate code.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [How It Works](#how-it-works)
- [License](#license)## Installation
To install GrpcGenie, use the following command (Deploying in the future. Stay tuned! 📅🚀):
```bash
git clone https://github.com/pandakn/GrpcGenie.gitcd GrpcGenie
go build -o grpcgenie cmd/grpcgenie/main.go
# or
make build
```## Usage
GrpcGenie is used via the command line. Here's the basic syntax:
#### grpcgenie [flags]
##### Flags
- `-p, --proto`: Required. Tell GrpcGenie where your .proto file lives.
- `-o, --output`: Required. Where do you want the generated Go handler file to be saved?
- `-d, --package`: Required. Name for your Go package (think of it like a label).
- `-g, --go-package-path`: Required. The path to your Go package (e.g., github.com/your-username/your-project).
- `-r, --grpc-package`: Required. Name of the gRPC package defined in your .proto file.#### Example
```bash
./grpcgenie --proto example/hello/hellopd/hello.proto \
--output example/hello/hellohandler/hello_grpc_handler.go \
--package hellohandler \
--go-package-path github.com/pandakn/GrpcGenie/example/hello \
--grpc-package hellopd
``````
📦
example/
└── hello/
├── hellohandler/
│ └── hello_grpc_handler.go // from grpcgennie
└── hellopd/
├── hello.pb.go
├── hello.proto
└── hello_grpc.pb.go
```## How It Works
- GrpcGenie parses the specified .proto file to extract service and method information.
- It uses this information to generate a Go file containing handler stuff for each gRPC method.
- The generated file includes all necessary imports and a struct that implements the gRPC service interface.## License
Licensed under [MIT License](./LICENSE)