How to share prisma schema between T3 apps hosted in vercel
Hi hi, so I've got 2 apps I'm developing using the T3 stack (created with create t3 ap), and I want to share 1 planetscale database and prisma client /schema between them. This seems to be an incredibly complicated rabbit hole I've gone down so I must be missing something. Surely this is a common task
I tried splitting the prisma configuration out to a separate repo and consuming it via git submodules or package.json, but then I end up with the issue where vercel doesn't have access credentials to install it.
I've been fiddling around for half a day trying to set up vercel access to a private GitHub package via .npmrc and personal access tokens but it's a cludge with minimal discussion online, so people must be doing something else for all this...
What's your solution for sharing your prisma schema between apps hosted in vercel?
8 Replies
I've been doen this rabbit hole https://isidoro-ferreiro.medium.com/share-your-prisma-client-across-projects-44d1c7aca6fd and attempted every variation I can come up with for getting a github personal access token working.
These docs are full of lies, this method does not work or at least is misleading to the point im doing something wrong https://vercel.com/guides/using-private-dependencies-with-vercel
Medium
Share your Prisma Client across projects
Prisma is a key pillar of our organizations backend, that has greatly improved the speed at which we build and deliver new products.
Vercel Documentation
How do I use private dependencies with Vercel?
Information on how to use private dependencies with a Vercel deployment.
use a monorepo?
extract your prisma schema and client into a separate package
this will be helpful
Thanks, I was trying to avoid using a monorepo this time as I keep using it as a solution to all my problems, but maybe that's the best way to handle this. Thanks @nexxel
yeah the alternative would be a private package then
Yeah that has not gone well lol, feels really messy setting that up in vercel for the cicd pipeline as none of the obvious or recommended things work and there is so little chatter online about it. Always weary of creating an implementation that everyone else has avoided
Thats sounds like the simplest and therefore best solution 🎉