https://github.com/cloudwego/prutal
Pure Go alternative to protocol buffers with minimum code generation
https://github.com/cloudwego/prutal
Last synced: 12 months ago
JSON representation
Pure Go alternative to protocol buffers with minimum code generation
- Host: GitHub
- URL: https://github.com/cloudwego/prutal
- Owner: cloudwego
- License: apache-2.0
- Created: 2025-02-13T08:13:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-21T05:50:38.000Z (about 1 year ago)
- Last Synced: 2025-06-18T12:09:44.503Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 460 KB
- Stars: 19
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Prutal
Prutal is a pure Go alternative to [protocol buffers](https://protobuf.dev), it covers most of the functionality offered by Protocol Buffers.
Prutal aims to minimize code generation as much as possible while ensuring serialization and maintaining good performance.
**Since Prutal is NOT yet ready for production use, we are not providing usage documentation at this time, nor do we guarantee backward compatibility of the interface.**
## Feature Comparison
| Features | Prutal | Protobuf |
| -- | -- | -- |
| Supported Languages | Go | C++, Java, Python, Go, and more |
| Code Generation | ✅ | ✅ |
| Generated Code Size | 😄 compact | 😡 bulky |
| Serialization | ✅ | ✅ |
| Performance | ⭐️⭐️⭐️⭐️⭐️ | ⭐️⭐️⭐️ |
| Extensibility | 😄 Package | 😡 Plugin |
| Compatibility | ✅ (see Protobuf Compatibility) | ✅ |
| gRPC | ✅ | ✅ |
| Non-Pointer Field | ✅ (aka gogoproto.nullable) | ❌ |
## Protobuf Compatibility
* ✅ Works with code generated by the official Protocol Buffer Go
* ✅ Parsing .proto file. syntax: proto2, proto3, edition 2023
* ✅ Protobuf wire format
- double, float, bool, string, bytes
- int32, int64, uint32, uint64, sint32, sint64
- fixed32, fixed64, sfixed64, sfixed64
- enum
- repeated, map, oneof
* ✅ Packed / unpack (proto2)
- PACKED / EXPANDED (repeated field encoding, edition2023)
* ✅ Reserved
* ✅ Unknown Fields
* ⚠️ JSON support: JSON struct tag only
* ⚠️ Code generation: Go only
* ⚠️ [Protocol buffers well-known types](https://protobuf.dev/reference/protobuf/google.protobuf/)
- Prutal is able to generate code by reusing pkg [`google.golang.org/protobuf/type`](https://pkg.go.dev/google.golang.org/protobuf/types/known)
- Features of type like `Any` would be limited.
* ❌ [Groups (proto2)](https://protobuf.dev/programming-guides/proto2/#groups)
* ❌ [Overriding default scalar values (proto2, edition2023)](https://protobuf.dev/programming-guides/proto2/#explicit-default)
## How to use Prutal with gRPC
### Use Prutal without `prutalgen`
All you need is
```go
import (
_ "github.com/cloudwego/prutal/pkg/grpccodec"
)
```
### Use Prutal with `prutalgen`
check [grpc test case](tests/cases/grpc) for a full example
## Contributing
Contributor guide: [Contributing](CONTRIBUTING.md).
## License
Prutal is licensed under the terms of the Apache license 2.0. See [LICENSE](LICENSE) for more information.
Dependencies used by `prutal` are listed under [licenses](licenses).