Migrate to tRPC?

Hi! Is there an option to use tRPC instead of GraphQL?

Hi @codestomping I wouldn’t say that there is a current option, however, @peterp has some experience with using tRPC and RedwoodJS that perhaps he can share.

Yup, we’re using tRPC in www.snaplet.dev, but I would suggest that you look at the pros and cons to consider what you’re gaining from tRPC vs GraphQL: One on hand you’re getting type safety, but that’s totally doable in GraphQL.

In my mind there is no real difference, use GraphQL in the way that you use tRPC and you’ve got essentially the same thing… but way more flexible and tested in millions of websites.

1 Like

Valid points I’d be fine using graphql if migrating is a major hassle. However, I use typescript everywhere so tRPC, as you know, will just make the frontend/backend type safety much simpler. I’m just getting started with Redwood it looks great but I’d really prefer tRPC over graphQL is possible. Can you share some steps to migrate Redwood to tRPC? I’m willing to sacrifice the flexibility of graphql to make the overall api simpler.

FYI, RedwoodJS does auto generate types from GraphQL that you can use in the web side.

See auto-generated types in TypeScript | RedwoodJS Docs

If you’re curious, you can find the generated types in the .redwood/types , web/types/graphql.d.ts , and api/types/graphql.d.ts directories.

Oh, I know that’s why I’d be fine if migrating is not too much of a hassle. I’m just more interested in not needing those extra files at all.