Next.js Discord

Discord Forum

RFR - request for recommendation

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hey guys.

I've been using a slightly custom version of the t3 stack for my new app at work.
Side note : The changes in question are that instead of next auth, I implemented Lucia.

Now, my question stems from the fact that trpc is not exactly made to deal with response headers and status codes. I believe seeing a github issue on their repo discussing this problem. The main argument being that trpc is there to serve as data transfer and not something that worries about anything else.

I did manage to make a solid api by monkey patching some stuff about it (by making changes to some of the types it exposes and extending them to allow something like this in the trpc handlers throw ctx.redirect(args).

That works awesome for client side calls but not so much for server components.

I'm considering switching to server actions, but my primary reason for not doing it is because we want to have some sane and typesafe api that is reusable across multiple apps (since the project is a monorepo of a few services).

What about you guys? Do you also use trpc with nextjs? Do you mix and match server actions with trpc?

0 Replies