Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone have a nice combination of tooling for typed handlers + client generation.

Thinking maybe Zod + Zod open API.

Really looking to replicate similar spec first workflow similar to protobuf services.

https://typespec.io/ also looks promising but seems early.




My tool https://openapi-code-generator.nahkies.co.nz/overview/about generates typed handlers based around koa (routing, req/res validation using zod) from openapi 3, as well as typed clients with optional zod validation using fetch/axios.

It also supports typespec using their transpilation to openapi 3 tooling


Check out https://www.speakeasy.com/. We generate fully type-safe SDK from OpenAPI and for our TS offering we delegate the type checking to Zod.


I think you are looking for https://ts-rest.com/


Nice. I'm looking to migrate away from a legacy custom framework over Express and this could help.

If someone has tried both, can anyone share how it compares with tRPC[0]?

[0] https://trpc.io/


From my understanding trpc is very similar, however, the rpc mechanism is not a standard. ts-rest produces openapi schemas and speaks REST over http, as well as a typed client.

That being said, I am actually slowly migrating off ts-rest and adopting @effect/schema and @effect/platform/HttpApi, I foresee this being the direction the typescript ecosystem heads in over the next few years. However, the APIs are not stable yet and it has a bit of a learning curve, so would not adopt lightly


I really wanted to adopt tRPC but the deal breaker was it being opinionated on status codes without allowing configurability. Because I needed to meet an existing API spec, that meant ts-rest was a better option. I think there's an aditional option with a native spec generator in frameworks like Hono, and maybe Elysia.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: