DEV Community

Discussion on: Has anyone used Apollo Server 2 w/ Prisma?

Collapse
 
nikomontana profile image
Niko Montana

Well it seems that @leob didnt quite get the conzept of prisma. I must admit, at first I didnt to.

The most misleading point in this topic is that prisma got an "graphql like" query language. Which does not mean it automatically provides graphql to you.

Now for even better understanding, leave prisma out of this paragraph. You have installed your Apollo server - great! Now you are writing your first resolver which should display all "to-do" items to the client. How do you fetch the data from the database?

You should be able to understand now that prisma is exactly this - an ORM.

@Domiritus Yeah, would also like to know if somebody is rocking with this setup in production.

I tried prisma for some node apps and really liked the workflow - it feels like next gen to me, especially when prisma admin started! Prisma and TypeScript is really fast for me.

My team was really thinking about scaling and we got into Apollo because with Apollo Platform you have valuable insights about your performance and much more.

What I discovered is that there can be some limitations with prisma with nested queries - sometimes you have to run 2 queries, which kind of sucks but they told me they are working on this. I dont bother because I can always run direct SQL queries to.
And from Apollo side we are currently searching a solution to provide webhooks for third party companies.

Hope that helps =)

Collapse
 
leob profile image
leob

Got it, yes Prisma is an ORM, from there site:

"Prisma replaces traditional ORMs and can be used to build GraphQL servers, REST APIs, microservices & more"

What confused me is that apart from their ORM ('Prisma') they are also offering a GraphQL server called 'GraphQL Yoga' (github.com/prisma/graphql-yoga). But then again, Yoga is again based on Apollo-Server (and a few other packages).

So yes they're marketing it as "easiest way to run a GraphQL server" but it's basically an ORM, which you can use with Apollo (server). Apologies for causing unnecessary confusion :-)

Collapse
 
alan345 profile image
Alan • Edited

Great answer!

My limitations so far with Prisma are:
-the 1000 max node. In my backend, sometimes, I have to sum all Prices: invoice { id price }. If you used ctx.db.query.invoices(), you will get a max of 1000 nodes.. (stackoverflow.com/questions/573132...). I also used in parallel a server SQL to run my customs queries to solve that issue.. (youtube.com/watch?time_continue=15...)

-running in production. Because everything is in docker, the database and the Apollo server are in the same image. I could not find any documentation regarding the good practices.

-they started with graphCool, then Prisma and now Prisma2. Hard to follow. And Im really afraid of the breaking changes.

-Order by related fields: You have a table wit column companyName/UserName. you pull id Invoice user { id UserName} with ctx.db.query.companys(). You can order the table by companyName, but Not by UserName. (1 user has 1 company)
(github.com/prisma/prisma/issues/95)

For the rest, Prisma is amazing.. I recommend it!

Collapse
 
chemicalkosek profile image
Kosek • Edited

I think you can set up the limit for yourself from Prisma 1.32.1

port: 4466
        databases:
          default:
            connector: postgres
            host: postgres
            port: 5432
            user: prisma
            password: prisma
            queueSize: 10000
Enter fullscreen mode Exit fullscreen mode