What does HackerNews think of twirp?
A simple RPC framework with protobuf service definitions
- Error codes are well defined (vs "should I return 200 OK and error message as a JSON or return 40x HTTP code?")
- no semantics ambiguity ("should I use POST for query with parameters that don't fit URL query param, or POST is only for modifying?")
- API upgrades compatibility out of the box (protobuf fields identified by numbers, not names)
Not to mention cross-platform support and autogenerating code.
I use it in multiple Flutter+Go apps, with gRPC Web transparently baked in, and it just works.
Once I had to implement chunked file upload in the app and, used to multiform upload madness, was scared even to start. But without all that legacy HTTP crap, implementing upload took like 10 mins. It was so easy and clean, I almost didn't believe that such a dreadful thing as "file upload" could be so easy. (years of fighting HTTP legacy).
Compared to the "traditional" workflow with REST/JSON the downside for me is, of course, the fact that now you can't help but care about API. With web frameworks the serialization/deserealization into app objects happens automagically, so you throw JSON objects left and right, which is nice until you realize how much CPU/Memory is being wasted for no reason.
Also, check out drop-in replacements for cases where you don't need full functionality of gRPC:
- Twirp (Twitch light version of gRPC, with optional JSON encoding, HTTP1 support and without streaming) - https://github.com/twitchtv/twirp
- Connect - "Better gRPC" https://connect.build/docs/introduction/
They address your concerns in more detail in the Twirp release announcement (2018) - https://blog.twitch.tv/en/2018/01/16/twirp-a-sweet-new-rpc-f...
If you're happy with protobuf but just not with gRPC, you can check out Twirp [1] and DRPC [2]. Both aim to be simpler alternatives while keeping protobuf for serialization. Their development is Go focused though.
I haven't used any of the two yet though so I can't comment on their differences.
Other tech I use
- Serverless framework on AWS Lambda
- Postgres
- Sidekiq
- Dokku
- Sentry
- New Relic
- gRPC and Twirp [2]
- Netlify
- Firebase
I do think twirp code could be refactored and made a lot better though.
Personally I'm in love with the idea of protobufs, but I'm not terribly sold on the implementation. The language is great, but the mapping to code languages is not great. Eg, to make great idiomatic Go code, I need to litter my Protobuf with extensions (via Gogoprotobuf) and the readability of the Protobuf sort of goes down the tubes.
So I think the idea behind Protobuf is great, and the syntax itself looks great, but a small tweak to how it handles code generation would be very welcome.
Likewise gRPC feels quite verbose. I use it, but conceptually I massively prefer simplistic implementations like Twirp[1]. However, again Protobuf handles this really nicely in that I can use the same Protobuf file to describe a Twirp or gRPC Service - it's great.
[1]: https://github.com/twitchtv/twirp
So what do you think would be a better step forward?