I have a repo that is dedicated for my database an...
# prisma-client
k
I have a repo that is dedicated for my database and making migration schema changes. So far in a separate microservice i have an api that simply introspects the database to get the latest table schemas and works with the orm. Rather than introspecting the database, does it make sense to publish the generated prisma client to a private npm package? so instead my api microservice, rather than introspecting the database to look for latest changes, it could just update to the latest npm version of the package? wondering if anyone else has gone down a similar usecase or rather than republishing the entire PrismaClient, is it better to publish just the schema.prisma and hae the other microservice run prisma generate?
1
n
Hey 👋 I have seen several users creating an npm package which has the PrismaClient, generated Prisma types and the schema file. Here’s an article that a user wrote on the same.
k
Does that still work?
I came across a github dicussion where people were discussing it doesn't
n
I assume it should work as it was working before, I haven’t come across any breaking change which would make it to not work. Can you share the GitHub Discussion link which you came across?
k
Oh youre saying you've used this method? (in the article)
n
I haven’t followed the exact instructions of this article but let me try it out and check. But In general sharing a schema file through npm package and using it in a separate repository works. Thanks for sharing the GitHub discussion link.
k
Well i guess im asking what does prisma reccomend to do for this usecase
n
Hi 👋 Apologies for the delay in getting back to you on the follow-up. There isn’t any official recommendation on if you should share the entire
PrismaClient
and
types
in the npm package or just share the
schema.prisma
and
types
and generate PrismaClient on the microservice. To keep the npm package small in size I would say just sharing the schema file and types should work.