Does anyone here use graphQL + trpc?

At first this might seem like a silly question considering they're always positioned as pick one or the other, but in our system we use graphql for some greenfield reads and REST for some GETS + writes Our backend is in django, and we mostly use nextJS for its frontend. Was wondering if the decision to combine the 2 would sound dumb since we could still benefit from parsing the data we get back from graphql/our django backend with zod + get "E2E types" in the FE
3 Replies
Neto
Neto2y ago
you can use gql on the procedure page -> trpc procedure -> gql call -> trpc return
cje
cje2y ago
thats a great use case for trpc actually well depends, what do you need the inbetween layer for if for example you want to hide an api key there, then it makes a ton of sense if you can just talk gql between the FE and your Django backend without an inbetween step, that might be easier, and you can still use GQL typegen to get a good typesafe experience
char
charOP2y ago
oh i guess i dont need the in between layer. so we can just use trpc for REST and gql typegen in parallel? i just wanted a sanity check for if that was weird. but i guess not any weirder than doing REST and gql in parallel appreciate the responses!
Want results from more Discord servers?
Add your server