Easy-to-use and solution to generate entities and gRPC code from proto files.
This project provides a solid solution to generate gRPC code (client &/ server) from your proto files. It is based on the official Protocol Buffers Documentation tutorials and provides a simple way to generate code from your proto files. It will generate entities and gRPC (client & server) code directly your proto files to any of the available programming languages.
Searching for a GraphQL-like experience? Please check out some of our favorites amazing gRPC user interfaces, also listed on the Awesome gRPC repo:
- warthog: https://github.com/forest33/warthog
- wombat: https://github.com/rogchap/wombat
There are mainly two ways to use this project. Either you use the docker images directly or you use the bash alias functions to generate the code.
This generator is based on the grpc-dart project and provides a lot of options to generate the code for your needs. Please check out the grpc-dart official documentation for more details on all available parameters.
- Set the function in your bash
# create a bash alias function for a better overview and easier execution # add it to your .bashrc grpc-gen-dart() { docker run --rm -v $(pwd):/grpc-gen-dart ghcr.io/digi-lab-io/digi-lab-io-grpc-gen-dart:latest protoc "$@" }
- Call the function by passing your parameters
grpc-gen-dart -I=your_files/proto your_files/proto/*.proto --dart_out="grpc,generate_kythe_info:./your_files/generated/"
After this all files will be generated in the your_files/generated
directory. For a more detailed explanation of the parameters, please check out the official documentation.
Checkout the grpc-gen-dart-example for more details on all available parameters.
This generator is based on the grpcio package and provides a lot of options to generate the code for your needs. Please check out the protobuf python official documentation for more details on all available parameters.
- Set the function in your bash
# create a bash alias function for a better overview and easier execution # add it to your .bashrc grpc-gen-python() { docker run --rm -v $(pwd):/digi-lab-io/grpc-gen-python ghcr.io/digi-lab-io/digi-lab-io-grpc-gen-python:latest python -m grpc_tools.protoc "$@" }
- Call the function by passing your parameters
**grpc-gen-python -I=example/proto \ --python_out=./example/python/src/generated/ \ --pyi_out=./example/python/src/generated/ \ --grpc_python_out=./example/python/src/generated/ example/proto/*.proto**
After this all files will be generated in the your_files/generated
directory. For a more detailed explanation of the parameters, please check out the official documentation.
Checkout the grpc-gen-python-example for a working example.
This generator is based on the very solid and flexible ts-proto project and provides a lot of options to generate the code for your needs. Please check out their project, for more details on all available parameters.
- Set the function in your bash
# create a bash alias function for a better overview and easier execution # add it to your .bashrc grpc-gen-ts() { docker run --rm -v $(pwd):/digi-lab-io/grpc-gen-ts ghcr.io/digi-lab-io/digi-lab-io-grpc-gen-ts:latest protoc "$@" }
- Call the function by passing your parameters, in this case for a nestjs project
grpc-gen-ts -I=example/proto \ --ts_proto_opt=addGrpcMetadata=true \ --ts_proto_opt=returnObservable=true \ --ts_proto_opt=nestJs=true \ --ts_proto_out=./example/ts/src/generated/ \ --ts_proto_opt=addNestjsRestParameter=true \ example/proto/*.proto \ google/protobuf/timestamp.proto
After this all files will be generated in the your_files/generated
directory. For a more detailed explanation of the parameters, please check out the official documentation.
Checkout the grpc-gen-ts-example for a working example.
Contributions are welcome and we need help! This project is still in its early stages, and we need your help to make it better. Our goal is to provide an easy-to-use and solid solution to generate gRPC code from your proto files. Feel free to open issues or pull requests if you have any suggestions or ideas.
This project is licensed under the MIT License. See the LICENSE file for details.