Hey everyone! Diving back into Prisma after a long...
# orm-help
n
Hey everyone! Diving back into Prisma after a long break. I have 10+ microservices that listen to server side subscriptions, and inside these I’d like to update some data that lives in Prisma. Is there anyway to bring prisma-client to these? I’m thinking that I’d need to roll it into a npm package I can share amongst the services but this feels overkill. Currently I use
graphql-request
but I really want to reduce some of the mutations that are only really used by the microservices/background jobs.
n
Hey Jamie 👋 Using the Prisma client to these should be totally possible 🙂 did you already through the new getting started? I think going through the first two pages should already clear most of your questions: https://www.prisma.io/docs/1.20/get-started/01-setting-up-prisma-demo-server-JAVASCRIPT-a001/
(There's also one for TyperScript)
n
Hey Nikolas! Thanks. The microservices are all separate repos right now. (I’m looking to combine these in time) but would prisma-client support this?
n
Hmm, there might be a bit more configuration overhead but generally I don't see a reason why this shouldn't work
Do you have any concrete concerns/questions about this?
n
I can figure it out. Might do the generate via Circle to push it to a pkg my other projects can use.
One thing
Prisma client. I’m guessing it involves writing a lot of Root queries for handling the lookups (if required) for relationships.
e.g. I want to get a users posts, I’d need to connect them manually via a root query
n
I’d need to connect them manually via a root query
I'm not sure what exactly you mean with this. What's different with the client (compared to bindings) that you need to implement resolvers for relations because the magic of the
info
object is gone that used to do that for you (what you gain though is type-safety and an easier-to-understand and more predictable API).
n
Yeah it’s mainly the
info
that’s gone which I’ve not kept up to date with. That pretty much answers my Q
n
Yep, be aware that the Prisma client only fetches scalar values of a model! Relations need to be fetched explicitly.
n
Ok boom!
Thanks very much
Time to get my Prisma on 🦜
n
🙏