News for hackers. Stuff that matters.
Re:Show HN: Pbkit – Protobuf toolkit written in Deno/TypeScript by lf-non on Tuesday April 05, 2022 @08:39AM (#30918218)
If you are considering protobuf for browser <-> server communication (as opposed to server <-> server) a good alternative is Twirp [1] by twitch. Like gRPC it uses protobuf for API schema, but unlike gRPC it works out of the box with HTTP 1 without needing any proxies.

I found both the golang server integration and the typescript client generated to be idiomatic and easy to use. There are community integrations with other languages too - but ymmv.

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

Re:Show HN: Pbkit – Protobuf toolkit written in Deno/TypeScript by tommiegannert on Tuesday April 05, 2022 @09:06AM (#30918452)
Just be aware of the lack of streams: https://github.com/twitchtv/twirp/issues/3
Re:Show HN: Pbkit – Protobuf toolkit written in Deno/TypeScript by jenny91 on Tuesday April 05, 2022 @09:32AM (#30918759)
Any advantages to gRPC-web? We've been using it for a while and it's a bit clunky, but it works.

We stick envoy in the middle for gRPC-web <-> gRPC; what do I need for Twirp?

Re:Show HN: Pbkit – Protobuf toolkit written in Deno/TypeScript by lf-non on Tuesday April 05, 2022 @10:55AM (#30919813)
It works oob - the browser can directly talk to twirp service.

I used it because I basically wanted end-to-end type-safety without any infrastructure overhead and additional decode-encode hops in betweeen.

Re:Show HN: Pbkit – Protobuf toolkit written in Deno/TypeScript by jenny91 on Tuesday April 05, 2022 @01:13PM (#30921769)
Ah, but it's not gRPC compatible then; just very similar and uses the same proto syntax for services and messages?
Re:Show HN: Pbkit – Protobuf toolkit written in Deno/TypeScript by lf-non on Wednesday April 06, 2022 @01:20AM (#30928748)
Yes, its an alternative.

protobuf is a lower level specification that supports defining typed services. It does not dictate things like transport mechanism or other implementation details.

There are multiple protobuf compatible RPC implementations, gRPC obviously being the most popular one, twirp being another.