What does HackerNews think of twirp?

A simple RPC framework with protobuf service definitions

Language: Go

#20 in Go
gRPC is so much cleaner and easier to work with for the APIs.

- 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/

Checkout Twirp, you get the good parts, protobufs and generated code, but its supports regular http, by no including streaming.

https://github.com/twitchtv/twirp

Take a look at Twirp (https://github.com/twitchtv/twirp) open sourced by TwitchTv. It's a lot lighter weight than gRPC. It does use Protobufs but addresses some of the concerns you mentioned, such as being able to test with JSON payloads, works over HTTP 1.1 and HTTP/2, good client libraries, and doesn't require a proxy.

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...

You can use protobuff without gRPC if that helps for your use case. Twitch has open sourced their HTTP1 protobuff client/server library: https://github.com/twitchtv/twirp
> But I do long for a simpler alternative

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.

[1] https://github.com/twitchtv/twirp

[2] https://github.com/storj/drpc/

Another proto based RPC framework with code generators mainly for Go that also explicitly says it's simpler than gRPC is Twirp from Twitch: https://github.com/twitchtv/twirp

I haven't used any of the two yet though so I can't comment on their differences.

I run a simple search service [1] with a Golang REST backend, and a frontend built with VueJS.

Other tech I use

- Serverless framework on AWS Lambda

- Postgres

- Sidekiq

- Dokku

- Sentry

- New Relic

- gRPC and Twirp [2]

- Netlify

- Firebase

[1] https://www.searchbx.com

[2] https://github.com/twitchtv/twirp

I prefer twirp's model of no http2 requirement and supports JSON. https://github.com/twitchtv/twirp

I do think twirp code could be refactored and made a lot better though.

Mind commenting on what you think would be better?

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?

I found gRPC to be a bit too heavyweight and complex. I'm pretty excited about twirp[1] right now.

[1]: https://github.com/twitchtv/twirp