Next.js Discord

Discord Forum

E2E Typesafety with route handlers next

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
Are people still using tRPC? Thinking about how to set up e2e typesafe endpoints in Next. I was gonna use Next server actions, but saw this:
Server Actions are designed for mutations that update server-side state; they are not recommended for data fetching. Accordingly, frameworks implementing Server Actions typically process one action at a time and do not have a way to cache the return value.

6 Replies

is there a reason you can't use the route handlers? https://nextjs.org/docs/app/building-your-application/routing/route-handlers and then do some zod schema validation on both the client and server to make sure it's typesafe?
@James4u If they started their project in t3 stack, they would continue using tRPC.
Giant pandaOP
I did not start my project with the t3 stack