Proxy prisma calls to FE with tRPC
Hi there. First of all, I'd like to thank everyone involved in the T3 project. It is really awesome.
I have a question. Is there a way to just proxy prisma calls to FE with tRPC? So that we don't have to create procedures, duplicate inputs... Just something like:
And then on the FE:
if all you need is something simple.
And
when you need to do something with, let's say, permissions check or some other custom logic that prisma is not aware of.
That would be so cool, because, ATM, most of my procedures is boilerplate, where I create them just to make existing prisma endpoints available at FE with exactly the same API, for example:
9 Replies
at that point, why even use trpc?
@Neto You mean using react server components, so you just hit prisma from FE directly? Because with this approach, as I understand, every call to DB is always done from the server, not from the client, so we don't need any http API layer.
You don't need exactly yo use server components with react to use prisma
Vercel Documentation
How to Build a Fullstack App with Next.js, Prisma, and PostgreSQL
Create a fullstack application with Next.js, Prisma, PostgreSQL, and deploy to Vercel.
But then you have to use
@prisma/client and then there are compiled types, codegen, etc. all the stuff that we are so glad to get rid off with tRPC.As a example
So the question is - do we need tRPC at all with next.js 13 and server components? Am I missing something?
@theo would be great to have your input on this topic. Thanks.
Don't @ him
But iirc t3 will have to do something with it
But for rn, isn't even stable to real usage
Even then, typesafe calls still will be amazing to have
Timeout for @ing me, especially since I have 2 fucking videos on this
Also re: this request, no. tRPC proxies procedures, not arbitrary objects.
Don't proxy all of Prisma to client. That is a disaster.