5 ms·
Shameless plug to my project Phero [0]. It’s a bit like gRPC but specifically for full stack TypeScript projects. It has a minimal API, literally one function,
by kamilafsar 4y ago
Shameless plug to my project Phero [0]. It’s a bit like gRPC but specifically for full stack TypeScript projects.
It has a minimal API, literally one function, with which you can expose your server’s functions. It will generate a Typesafe SDK for your frontend(s), packed with all models you’re using. It will also generate a server which will automatically validate input & output to your server.
One thing I’ve seen no other similar solution do is the way we do error handling: throw an error on the server and catch it on the client as if it was a local error.
As I said, it’s only meant for teams who have full stack TypeScript. For teams with polyglot stacks an intermediate like protobuf or GraphQL might make more sense. We generate a TS declaration file instead.
[0] https://github.com/phero-hq/phero https://github.com/phero-hq/phero
- throwthere 4y agotRPC is another similar library. https://trpc.io/docs/v10/quickstart https://trpc.io/docs/v10/quickstart
- jasperpressplay 4y agoThere’re some key differences though, one being you can use plain typescript types to define your models, instead of a validation lib like zod :)
- simlevesque 4y agoZod gives you a lot more of control on the schema.
- jasperpressplay 4y agoThat’s an interesting point, can you give an example of that?
- simlevesque 4y agoYou can use any custom validation there is for any field.