trpc alternatives like zodios, ts-rest
I am using TRPC and really liking the developer experience. I recently got to know about zodios, ts-rest etc.
I believe they provide a similar experience but play along more nicely with normal REST api conventions.
To use TRPC endpoints from non-typescript backends, we would need to use something like OpenApi adapters. I don't know if the adapters are stable. What are your thoughts on this ?
The feeling that i get about these new alternatives is along the lines of, anything that uses a lot of typescript inference will eventually run into scale problems. (slow inference, needing to restart typescript). I even saw some github issues mentioning the typescript inference limit was reached or something.
I believe TRPC should be the least risky option when compared to the alternatives.
3 Replies
trpc-openapi
is in fact stable for creating rest endpoints. IMO it's best in cases where you only need to expose a few endpoints via rest, where most of them are only consumed via trpc clients.
If all or most of your endpoints need to be exposed via rest, something like zodios might make more sense b/c you're getting the rest endpoints out of the box@iway1 Thanks for the insights. I have not yet tried the new libraries. It will be interesting to see how they compare dx and stability wise.
I recommend you zodios + openapi-zod-client https://github.com/astahmer/openapi-zod-client
GitHub
GitHub - astahmer/openapi-zod-client: Generate a zodios (typescript...
Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml) - GitHub - astahmer/openapi-zod-client: Generate a zodios (typescript http client with zod validation...