Next.js + GraphQl
Hi guys I am new to coding and start to understand the front end structures and how to build it with React or Next.js. My question is now: would it be a good idea to use graqhql and typescript together with Next.js? What other options are popular/ a good idea?
11 Replies
with a graphql service
you can generate typescript content
and react/next specific hooks
https://the-guild.dev/graphql/codegen
if you are using graphql for the type safety, you should look into trpc
Can I go for either one of them to achieve the same result? how is trpc different to graqhql or in which way better?
With t3 stack
I prefer trpc
Graphql is too complex for its own good
The biggest trade off is that graphql is language agnostic whole trpc assumes a nodejs backend while graphql is another language completely and you have to understand its fundamentals before moving forward whereas trpc's just JavaScript and arguably more ergonomic.
*while. Thanks, autocorrect
thanks I found that helpful! 👍 trpc sounds great then. Can I use trpc everywhere where I use graphql? I built a small app using aws amplify for the backend with graphql. Could I go ahead and exchange it for trpc?
I haven't used trpc with a graphql endpoint before, so I can't speak to that. There's some overlap in concepts, like the use of resolvers, but I don't think you can communicate with a graphql endpoint as is with trpc or vice versa
Yeah. It looks like that's the case https://trpc.io/docs/further-reading
Further Reading | tRPC
Who is this for?
Thanks, I learned something new. So as it seems it depends on the endpoint then. Which database do you use with trpc if not aws amplify?
I'm shopping around since I was using heroku before they nuked the free tier. For now, I'm using cockroachdb. I'm guessing you're asking for cloud options. You can also use rds if you want to stay on aws or dynamodb
I see wow there is so many databases and NoSQL languages its a bit confusing. I'm going to have a look at them thanks.
most sql databases are use mostly the same concept
some of them expand some concepts
if the underlying language of the data is sql, in theory you can switch databases without any issues