Separating the database and application layer (+ using multiple GraphQL servers with the same database layer)


#1

I’m trying to figure out how best to separate the database layer from my GraphQL server(s).

The idea is that I want to have 2 clusters in Prisma Cloud (one for dev and staging, and one for production) these two clusters should only contain the database layer abstraction that Prisma provides (so the ./database folder containing datamodel.graphql, prisma.yml, ./generated/prisma.graphql).

Then I have 2 application layer GraphQL servers that will be served from Heroku, and they all need to be able to talk to the same Prisma Cloud endpoint.

Where stuff starts to confuse me, is in terms of how I would gain access from my GraphQL servers to the prisma.graphql file that is generated doing $ prisma deploy, so that I can import the types I need into each of the servers schema.graphql files.

I guess I could just copy paste prisma.graphl into a folder on each server, and then import from there, but that would require me to update it on every single server every time I make changes to my datamodel which does not seem sufficient.

What would be the correct way to handle this separation?

Note: I’m currently working out from the node.js advanced boilerplate where database and application layer lives in the same project.


#2

I did have a small thread going with @agartha on Slack, which did give me a better understanding.

But my understanding kind of faded away again, as I became unsure in terms of whether or not it is required to define each service in graphqlconfig.yml even if I were to completely separate the two layers.

Is graphqlconfig.yml required for the server or for Prisma?